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