mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-29 03:57:44 +00:00
Add stripping and LTO options to Makefile
This commit is contained in:
parent
35f43126e4
commit
af40114664
2 changed files with 28 additions and 6 deletions
29
Makefile
29
Makefile
|
@ -1,10 +1,25 @@
|
|||
# Config options
|
||||
ENABLE_LTO ?= n
|
||||
ENABLE_STRIP ?= n
|
||||
|
||||
# Binaries
|
||||
RUSTC ?= rustc
|
||||
RM := rm
|
||||
RUSTC ?= rustc
|
||||
RM := rm
|
||||
|
||||
# Flags
|
||||
RUSTCFLAGS := --opt-level=3
|
||||
RMFLAGS :=
|
||||
RUSTCFLAGS := --opt-level=3
|
||||
RMFLAGS :=
|
||||
|
||||
# Handle config setup
|
||||
ifeq ($(ENABLE_LTO),y)
|
||||
RUSTCBINFLAGS := $(RUSTCFLAGS) -Z lto
|
||||
else
|
||||
RUSTCBINFLAGS := $(RUSTCFLAGS)
|
||||
endif
|
||||
|
||||
ifneq ($(ENABLE_STRIP),y)
|
||||
ENABLE_STRIP :=
|
||||
endif
|
||||
|
||||
# Install directories
|
||||
PREFIX ?= /usr/local
|
||||
|
@ -135,7 +150,8 @@ build/gen/$(1).rs: build/mkmain
|
|||
build/mkmain $(1) build/gen/$(1).rs
|
||||
|
||||
build/$(1): build/gen/$(1).rs build/$($(1)_RLIB) | build deps
|
||||
$(RUSTC) $(RUSTCFLAGS) -L build/ -o build/$(1) build/gen/$(1).rs
|
||||
$(RUSTC) $(RUSTCBINFLAGS) -L build/ -o build/$(1) build/gen/$(1).rs
|
||||
$(if $(ENABLE_STRIP),strip build/$(1),)
|
||||
endef
|
||||
|
||||
define CRATE_BUILD
|
||||
|
@ -179,7 +195,8 @@ $(foreach test,$(TESTS),$(eval $(call TEST_BUILD,$(test))))
|
|||
-include build/uutils.d
|
||||
build/uutils: uutils/uutils.rs build/mkuutils $(RLIB_PATHS)
|
||||
build/mkuutils build/gen/uutils.rs $(BUILD)
|
||||
$(RUSTC) $(RUSTCFLAGS) -L build/ --dep-info $@.d build/gen/uutils.rs -o $@
|
||||
$(RUSTC) $(RUSTCBINFLAGS) -L build/ --dep-info $@.d build/gen/uutils.rs -o $@
|
||||
$(if $(ENABLE_STRIP),strip build/uutils)
|
||||
|
||||
# Dependencies
|
||||
-include build/rust-crypto.d
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue