diff options
author | Kimplul <kimi.h.kuparinen@gmail.com> | 2024-04-20 10:47:49 +0300 |
---|---|---|
committer | Kimplul <kimi.h.kuparinen@gmail.com> | 2024-04-20 10:47:49 +0300 |
commit | 8a98b46ef2b5673fcdf0a9a466857a5de044dfc5 (patch) | |
tree | ae548496da015f3319760479e09cfe5a0b1eba5d /deps/lightening/tests/Makefile | |
parent | 1cc7990ef7d5483d0434dda412f2d88e0b17df27 (diff) | |
download | posthaste-8a98b46ef2b5673fcdf0a9a466857a5de044dfc5.tar.gz posthaste-8a98b46ef2b5673fcdf0a9a466857a5de044dfc5.zip |
add lightening jit
Diffstat (limited to 'deps/lightening/tests/Makefile')
-rw-r--r-- | deps/lightening/tests/Makefile | 87 |
1 files changed, 87 insertions, 0 deletions
diff --git a/deps/lightening/tests/Makefile b/deps/lightening/tests/Makefile new file mode 100644 index 0000000..793f225 --- /dev/null +++ b/deps/lightening/tests/Makefile @@ -0,0 +1,87 @@ +TESTS ?= $(sort $(basename $(wildcard *.c))) +TARGETS ?= native ia32 aarch64 armv7 mips64el mipsel ppc64le + +# Suitable values of cross-compiler variables for Debian: +# +# make test CC_IA32=i668-linux-gnu-gcc CC_AARCH64=aarch64-linux-gnu-gcc +# +# The relevant packages that you need to run this: +# +# dpkg --add-architecture i386 +# dpkg --add-architecture arm64 +# apt-get update -qq +# apt-get install -y \ +# libc6-dev:amd64 gcc make \ +# qemu binfmt-support qemu-user-static \ +# gcc-i686-linux-gnu libc6-dev-i386-cross libc6:i386 \ +# gcc-aarch64-linux-gnu libc6-dev-arm64-cross libc6:arm64 +# +CC = gcc +CC_IA32=guix environment --pure -s i686-linux --ad-hoc gcc-toolchain -- gcc +CC_AARCH64=guix environment --pure -s aarch64-linux --ad-hoc gcc-toolchain -- gcc +CC_ARMv7=guix environment --pure -s armhf-linux --ad-hoc gcc-toolchain -- gcc +CC_MIPS64EL=guix environment --pure -s mips64el-linux --ad-hoc gcc-toolchain -- gcc +CC_MIPSEL=guix environment --pure -s mipsel-linux --ad-hoc gcc-toolchain -- gcc +CC_PPC64LE=guix environment --pure -s powerpc64le-linux --ad-hoc gcc-toolchain -- gcc +CFLAGS = -Wall -O0 -g $(DEBUG) +LDFLAGS = -lpthread +RUNNER = + +all: $(foreach TARGET,$(TARGETS),$(addprefix test-$(TARGET)-,$(TESTS))) + +check: $(addprefix test-$(TARGET),$(TARGETS)) + +test-vg-%: $(addprefix test-%-,$(TESTS)) + @echo "Running unit tests..." + @set -e; for test in $?; do \ + echo "Testing: $$test"; \ + valgrind -q --error-exitcode=1 ./$$test; \ + done + @echo "Success." + +test-%: $(addprefix test-%-,$(TESTS)) + @echo "Running unit tests..." + @set -e; for test in $?; do \ + echo "Testing: $$test"; \ + ./$$test; \ + done + @echo "Success." + +.PHONY: test check + +lightening-%.o: ../lightening.h ../lightening/*.c ../lightening/*.h + $(CC) $(CFLAGS) $(CPPFLAGS) -I.. -o $@ -c ../lightening/lightening.c + +test-native-%: %.c lightening-native.o test.h + $(CC) $(CFLAGS) $(CPPFLAGS) -I.. -o $@ lightening-native.o $< $(LDFLAGS) + +test-ia32-%: CC = $(CC_IA32) +test-ia32-%: %.c lightening-ia32.o test.h + $(CC) $(CFLAGS) $(CPPFLAGS) -I.. -o $@ lightening-ia32.o $< $(LDFLAGS) + +test-aarch64-%: CC = $(CC_AARCH64) +test-aarch64-%: %.c lightening-aarch64.o test.h + $(CC) $(CFLAGS) $(CPPFLAGS) -I.. -o $@ lightening-aarch64.o $< $(LDFLAGS) + +test-armv7-%: CC = $(CC_ARMv7) +test-armv7-%: %.c lightening-armv7.o test.h + $(CC) $(CFLAGS) $(CPPFLAGS) -I.. -o $@ lightening-armv7.o $< $(LDFLAGS) + +test-mips64el-%: CC = $(CC_MIPS64EL) +test-mips64el-%: %.c lightening-mips64el.o test.h + $(CC) $(CFLAGS) $(CPPFLAGS) -I.. -o $@ lightening-mips64el.o $< $(LDFLAGS) + +test-mipsel-%: CC = $(CC_MIPSEL) +test-mipsel-%: %.c lightening-mipsel.o test.h + $(CC) $(CFLAGS) $(CPPFLAGS) -I.. -o $@ lightening-mipsel.o $< $(LDFLAGS) + +test-ppc64le-%: CC = $(CC_PPC64LE) +test-ppc64le-%: %.c lightening-ppc64le.o test.h + $(CC) $(CFLAGS) $(CPPFLAGS) -I.. -o $@ lightening-ppc64le.o $< $(LDFLAGS) + +.PRECIOUS: $(foreach TARGET,$(TARGETS),$(addprefix test-$(TARGET)-,$(TESTS))) +.PRECIOUS: $(foreach TARGET,$(TARGETS),lightening-$(TARGET).o) + +clean: + rm -f $(foreach TARGET,$(TARGETS),$(addprefix test-$(TARGET)-,$(TESTS))) + rm -f $(foreach TARGET,$(TARGETS),lightening-$(TARGET).o) |