Clean up Makefile
This commit is contained in:
parent
7c8c2e2dc2
commit
02f308ffbd
11
.gitignore
vendored
11
.gitignore
vendored
@ -1,10 +1,3 @@
|
||||
print
|
||||
print_aarch64
|
||||
print_mips32
|
||||
print_x64
|
||||
bldtst
|
||||
bldtst_aarch64
|
||||
bldtst_mips32
|
||||
bldtst_x64
|
||||
bldtst_llvm
|
||||
a.out
|
||||
bin
|
||||
tmp
|
||||
|
||||
55
Makefile
55
Makefile
@ -1,32 +1,45 @@
|
||||
bindir ?= ./bin
|
||||
|
||||
CFLAGS := -nostdlib -static -fuse-ld=lld -fno-stack-protector
|
||||
|
||||
CLANG_WNO := -Wno-incompatible-library-redeclaration
|
||||
GCC_WNO := -Wno-builtin-declaration-mismatch
|
||||
|
||||
MIPS_CFLAGS := --target=mips-linux-gnu -fno-pic
|
||||
MIPSEL_CFLAGS := --target=mipsel-linux-gnu -fno-pic
|
||||
X86_64_CFLAGS := --target=x86_64-linux-gnu
|
||||
|
||||
AARCH64_CFLAGS := --target=aarch64-linux-gnu
|
||||
|
||||
all: buildtest
|
||||
|
||||
clean:
|
||||
if test -f print; then rm print; fi
|
||||
if test -f print_x64; then rm print_x64; fi
|
||||
if test -f print_aarch64; then rm print_aarch64; fi
|
||||
if test -f print_mips32; then rm print_mips32; fi
|
||||
if test -f bldtst; then rm bldtst; fi
|
||||
if test -f bldtst_llvm; then rm bldtst_llvm; fi
|
||||
if test -f bldtst_x64; then rm bldtst_x64; fi
|
||||
if test -f bldtst_aarch64; then rm bldtst_aarch64; fi
|
||||
if test -f bldtst_mips32; then rm bldtst_mips32; fi
|
||||
rm $(bindir)/*
|
||||
|
||||
buildtest: bldtst bldtst_llvm bldtst_x64 bldtst_aarch64 bldtst_mips32
|
||||
$(bindir)/:
|
||||
mkdir -p ${bindir}
|
||||
|
||||
.PHONY: all buildtest clean
|
||||
headers := sys.h int.h
|
||||
buildtest: $(bindir)/bldtst $(bindir)/bldtst_llvm $(bindir)/bldtst_x64 $(bindir)/bldtst_aarch64 $(bindir)/bldtst_mips $(bindir)/bldtst_mipsel
|
||||
|
||||
|
||||
bldtst: buildtest.c arch/*.c
|
||||
gcc -static -nostdlib -Wno-builtin-declaration-mismatch -fno-stack-protector -o bldtst buildtest.c arch/*.c
|
||||
.PHONY: all clean buildtest
|
||||
|
||||
bldtst_llvm: buildtest.c arch/*.c
|
||||
clang -nostdlib -Wno-incompatible-library-redeclaration -static -fuse-ld=lld -fno-stack-protector -o bldtst_llvm buildtest.c arch/*.c
|
||||
|
||||
bldtst_x64: buildtest.c arch/x86_64.c
|
||||
clang --target=x86_64-linux-gnu -nostdlib -Wno-incompatible-library-redeclaration -static -fuse-ld=lld -fno-stack-protector -o bldtst_x64 buildtest.c arch/x86_64.c
|
||||
${bindir}/bldtst: buildtest.c $(headers) arch/* | $(bindir)/
|
||||
gcc $(CFLAGS) $(GCC_WNO) -o $@ buildtest.c arch/*.c
|
||||
|
||||
bldtst_aarch64: buildtest.c arch/aarch64.c
|
||||
clang --target=aarch64-linux-gnu -nostdlib -Wno-incompatible-library-redeclaration -static -fuse-ld=lld -fno-stack-protector -o bldtst_aarch64 buildtest.c arch/aarch64.c
|
||||
${bindir}/bldtst_llvm: $(headers) buildtest.c arch/* | $(bindir)/
|
||||
clang $(CFLAGS) $(CLANG_WNO) -o $@ buildtest.c arch/*.c
|
||||
|
||||
bldtst_mips32: buildtest.c arch/mips.c
|
||||
clang --target=mips-linux-gnu -nostdlib -Wno-incompatible-library-redeclaration -static -fuse-ld=lld -fno-stack-protector -fno-pic -o bldtst_mips32 buildtest.c arch/mips.c
|
||||
${bindir}/bldtst_x64: $(headers) buildtest.c arch/x86_64.c arch/generic.h | $(bindir)/
|
||||
clang $(X86_64_CFLAGS) $(CFLAGS) $(CLANG_WNO) -o $@ buildtest.c arch/x86_64.c
|
||||
|
||||
${bindir}/bldtst_aarch64: $(headers) buildtest.c arch/aarch64.c arch/generic.h | $(bindir)/
|
||||
clang $(AARCH64_CFLAGS) $(CFLAGS) $(CLANG_WNO) -o $@ buildtest.c arch/aarch64.c
|
||||
|
||||
${bindir}/bldtst_mips: $(headers) buildtest.c arch/mips.c arch/generic.h | $(bindir)/
|
||||
clang $(MIPS_CFLAGS) $(CFLAGS) $(CLANG_WNO) -o $@ buildtest.c arch/mips.c
|
||||
|
||||
${bindir}/bldtst_mipsel: $(headers) buildtest.c arch/mips.c arch/generic.h | $(bindir)/
|
||||
clang $(MIPSEL_CFLAGS) $(CFLAGS) $(CLANG_WNO) -o $@ buildtest.c arch/mips.c
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user