46 lines
1.5 KiB
Makefile
46 lines
1.5 KiB
Makefile
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:
|
|
rm $(bindir)/*
|
|
|
|
$(bindir)/:
|
|
mkdir -p ${bindir}
|
|
|
|
headers := sys.h int.h
|
|
buildtest: $(bindir)/bldtst $(bindir)/bldtst_llvm $(bindir)/bldtst_x64 $(bindir)/bldtst_aarch64 $(bindir)/bldtst_mips $(bindir)/bldtst_mipsel
|
|
|
|
|
|
.PHONY: all clean buildtest
|
|
|
|
|
|
${bindir}/bldtst: buildtest.c $(headers) arch/* | $(bindir)/
|
|
gcc $(CFLAGS) $(GCC_WNO) -o $@ buildtest.c arch/*.c
|
|
|
|
${bindir}/bldtst_llvm: $(headers) buildtest.c arch/* | $(bindir)/
|
|
clang $(CFLAGS) $(CLANG_WNO) -o $@ buildtest.c arch/*.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
|