build.sh (684B)
1 #!/bin/sh 2 # builds rifle with clang and lld, then links every tool name to it in bin/. no GNU toolchain, no libc: c.h is the libc 3 set -e 4 cd "$(dirname "$0")" 5 CC=${CC:-cc} 6 [ "$1" = 32 ] && M32="-m32 -msse2" # ./build.sh 32: one i386 binary, runs on 32 and 64-bit x86 7 $CC -std=gnu11 -O2 -Wall -Wextra -Wno-missing-field-initializers -Wno-empty-body -Wno-deprecated-non-prototype -Wno-unused-parameter \ 8 $M32 -static -nostdlib -ffreestanding -fno-builtin -fno-stack-protector -fno-asynchronous-unwind-tables \ 9 -fno-pie -ffunction-sections -fdata-sections -fuse-ld=lld -Wl,--gc-sections -Wl,-s -Wl,-z,norelro \ 10 -o rifle rifle.c 11 rm -rf bin && mkdir bin 12 ./rifle --install bin