mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-29 20:17:45 +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
|
# Binaries
|
||||||
RUSTC ?= rustc
|
RUSTC ?= rustc
|
||||||
RM := rm
|
RM := rm
|
||||||
|
|
||||||
# Flags
|
# Flags
|
||||||
RUSTCFLAGS := --opt-level=3
|
RUSTCFLAGS := --opt-level=3
|
||||||
RMFLAGS :=
|
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
|
# Install directories
|
||||||
PREFIX ?= /usr/local
|
PREFIX ?= /usr/local
|
||||||
|
@ -135,7 +150,8 @@ build/gen/$(1).rs: build/mkmain
|
||||||
build/mkmain $(1) build/gen/$(1).rs
|
build/mkmain $(1) build/gen/$(1).rs
|
||||||
|
|
||||||
build/$(1): build/gen/$(1).rs build/$($(1)_RLIB) | build deps
|
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
|
endef
|
||||||
|
|
||||||
define CRATE_BUILD
|
define CRATE_BUILD
|
||||||
|
@ -179,7 +195,8 @@ $(foreach test,$(TESTS),$(eval $(call TEST_BUILD,$(test))))
|
||||||
-include build/uutils.d
|
-include build/uutils.d
|
||||||
build/uutils: uutils/uutils.rs build/mkuutils $(RLIB_PATHS)
|
build/uutils: uutils/uutils.rs build/mkuutils $(RLIB_PATHS)
|
||||||
build/mkuutils build/gen/uutils.rs $(BUILD)
|
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
|
# Dependencies
|
||||||
-include build/rust-crypto.d
|
-include build/rust-crypto.d
|
||||||
|
|
|
@ -34,6 +34,11 @@ To build only a few of the available utilities:
|
||||||
make BUILD='UTILITY_1 UTILITY_2'
|
make BUILD='UTILITY_1 UTILITY_2'
|
||||||
```
|
```
|
||||||
|
|
||||||
|
To build with LTO and stripping:
|
||||||
|
```
|
||||||
|
make ENABLE_LTO=y ENABLE_STRIP=y
|
||||||
|
```
|
||||||
|
|
||||||
Installation Instructions
|
Installation Instructions
|
||||||
-------------------------
|
-------------------------
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue