Files

40 lines
1.3 KiB
Makefile

alias b := build
alias s := stat
alias z := stat-size
target := "x86_64-unknown-linux-gnu"
build:
RUSTFLAGS="\
-Zunstable-options \
\
-Zlocation-detail=none -Zfmt-debug=none \
\
-Clinker=clang -Clink-arg=-fuse-ld=lld \
-Clink-arg=-Wl,--gc-sections -Clink-arg=-Wl,--as-needed -Clink-arg=-Wl,--strip-all -Clink-arg=-Wl,--build-id=none \
\
-Cpanic=immediate-abort --remap-path-prefix=$PWD=[src] \
" cargo \
\
-Zbuild-std=core,alloc,std,panic_abort \
-Zbuild-std-features="optimize_for_size" \
\
b -r --target {{ target }}
# Base, does like nothing
strip --strip-all --strip-unneeded target/{{ target }}/release/rust-teeny
# BS, I don't want these
strip -R .comment -R .note.\* target/{{ target }}/release/rust-teeny
# Only OK because we don't do unwinding
strip -R .eh_frame\* target/{{ target }}/release/rust-teeny
# Not sure why .gnu.version and .gnu.hash don't break if I remove them in my machine, but that's very relative and its related to dynamic loading, but they could reduce size by `0.2 KiB`
stat:
stat target/{{ target }}/release/rust-teeny
stat-size:
stat target/{{ target }}/release/rust-teeny -c "%s" | numfmt --to=iec-i