diff test/Makefile.template @ 36:677c03c382b8

Backed out changeset e26874655738
author Paper <paper@tflc.us>
date Fri, 25 Apr 2025 17:40:55 -0400
parents
children 4b5a557aa64f
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/Makefile.template	Fri Apr 25 17:40:55 2025 -0400
@@ -0,0 +1,53 @@
+CPPFLAGS += -g -O2 -I../include -Wall -Wpedantic -Werror=strict-aliasing
+CFLAGS += $(CPPFLAGS) -std=c99
+CXXFLAGS += $(CPPFLAGS) -std=c++11
+
+HEADERS = ../include/vec/vec.h \
+	../include/vec/impl/ppc/altivec.h \
+	../include/vec/impl/x86/avx2.h \
+	../include/vec/impl/x86/avx512f.h \
+	../include/vec/impl/x86/mmx.h \
+	../include/vec/impl/x86/sse2.h \
+	../include/vec/impl/x86/sse41.h \
+	../include/vec/impl/cpu.h \
+	../include/vec/impl/fallback.h \
+	../include/vec/impl/generic.h \
+	test_align.h \
+	test_arith.h \
+	test_compare.h \
+	test_shift.h
+BINS = test-generic test-host test-cxx
+OBJS = vec-generic.o vec-host.o test.o test-cxx.o
+
+.PHONY: all clean test
+
+all: $(BINS)
+
+vec-generic.o: ../src/vec.c $(HEADERS)
+	$(CC) $(CFLAGS) -DVEC_SUPPRESS_HW=1 -c -o $@ $<
+
+vec-host.o: ../src/vec.c $(HEADERS)
+	$(CC) $(CFLAGS) -c -o $@ $<
+
+test.o: test.c
+	$(CC) $(CFLAGS) -c -o $@ $<
+
+test-cxx.o: test.cc
+	$(CXX) $(CXXFLAGS) -c -o $@ $<
+
+test-generic: vec-generic.o test.o
+	$(CC) $(LDFLAGS) -o $@ $^
+
+test-host: vec-host.o test.o
+	$(CC) $(LDFLAGS) -o $@ $^
+
+test-cxx: test-cxx.o $(HEADERS)
+	$(CXX) $(LDFLAGS) -o $@ $<
+
+clean:
+	$(RM) $(BINS) $(OBJS)
+
+test: clean $(BINS)
+	./test-generic
+	./test-host
+	./test-cxx