mirror of
https://github.com/uutils/coreutils
synced 2024-11-10 07:04:16 +00:00
Merge pull request #362 from Arcterus/lto
Add stripping and LTO options to Makefile
This commit is contained in:
commit
175be826ba
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
|
||||
|
|
|
@ -34,6 +34,11 @@ To build only a few of the available utilities:
|
|||
make BUILD='UTILITY_1 UTILITY_2'
|
||||
```
|
||||
|
||||
To build with LTO and stripping:
|
||||
```
|
||||
make ENABLE_LTO=y ENABLE_STRIP=y
|
||||
```
|
||||
|
||||
Installation Instructions
|
||||
-------------------------
|
||||
|
||||
|
|
Loading…
Reference in a new issue