aboutsummaryrefslogtreecommitdiffstats
path: root/test/monniaux
diff options
context:
space:
mode:
authorDavid Monniaux <David.Monniaux@univ-grenoble-alpes.fr>2021-09-13 15:42:25 +0200
committerDavid Monniaux <David.Monniaux@univ-grenoble-alpes.fr>2021-09-13 15:42:25 +0200
commite5ab7a571b1bfe8606bd100d20eec79d6dcd39f1 (patch)
treebcce65b4d2d5449f01f2b377205aa306b7333386 /test/monniaux
parenta297e5ff34ff9729ec56838543ef8d044a49f683 (diff)
downloadcompcert-kvx-e5ab7a571b1bfe8606bd100d20eec79d6dcd39f1.tar.gz
compcert-kvx-e5ab7a571b1bfe8606bd100d20eec79d6dcd39f1.zip
Makefile for csmith
Diffstat (limited to 'test/monniaux')
-rw-r--r--test/monniaux/csmith/Makefile89
1 files changed, 73 insertions, 16 deletions
diff --git a/test/monniaux/csmith/Makefile b/test/monniaux/csmith/Makefile
index 56313452..ab1c36b1 100644
--- a/test/monniaux/csmith/Makefile
+++ b/test/monniaux/csmith/Makefile
@@ -1,23 +1,80 @@
-CSMITH?=/local/monniaux/packages/csmith-2.3.0/bin/csmith
-MAX=1000
+INCLUDES=-I/usr/include/csmith
+TARGET_CCOMP=../../../ccomp
+TARGET_CC=gcc
+#EXECUTE=kvx-cluster --
-include ../rules.mk
-KVX_CCOMPFLAGS+=-I/local/monniaux/packages/csmith-2.3.0/include/csmith-2.3.0 -fstruct-passing -fbitfields
+all:
-TARGETS_S=$(shell seq --format src%06.f.ccomp.kvx.s 0 $(MAX))
-TARGETS_C=$(shell seq --format src%06.f.c 0 $(MAX))
-TARGETS_O=$(shell seq --format src%06.f.ccomp.kvx.o 0 $(MAX))
+.SECONDARY:
-all: c s o
+ifndef CSMITH
+CSMITH=csmith
+endif
-s: $(TARGETS_S)
-c: $(TARGETS_C)
-o: $(TARGETS_O)
+MAX=10
+PREFIX=ran%06.f
-src%.c :
- $(CSMITH) --output $@ --seed $*
+CCOMPOTS=-static
+CCOMPFLAGS+= -fstruct-passing -fbitfields -fno-cse2 -stdlib ../../../runtime
-clean:
- -rm -f $(TARGETS_C) $(TARGETS_S) $(TARGETS_O)
+TESTS_C=$(shell seq --format $(PREFIX)/source.c 1 $(MAX))
+
+TESTS_CCOMP_TARGET_S=$(TEST_C:.c=.ccomp.target.s)
+TESTS_GCC_TARGET_S=$(TEST_C:.c=.gcc.target.s)
+TESTS_GCC_HOST_S=$(TEST_C:.c=.gcc.host.s)
+TESTS_CCOMP_TARGET_OUT=$(shell seq --format $(PREFIX)/example.ccomp.target.out 1 $(MAX))
+TESTS_GCC_TARGET_OUT=$(shell seq --format $(PREFIX)/example.gcc.target.out 1 $(MAX))
+TESTS_GCC_HOST_OUT=$(shell seq --format $(PREFIX)/example.gcc.host.out 1 $(MAX))
+TESTS_CMP=$(shell seq --format $(PREFIX)/example.target.cmp 1 $(MAX)) # $(shell seq --format $(PREFIX)/example.host_target.cmp 1 $(MAX))
+
+
+all: $(TESTS_CCOMP_TARGET_OUT) $(TESTS_GCC_TARGET_OUT) $(TESTS_CCOMP_TARGET_S) $(TESTS_GCC_TARGET_S) $(TESTS_CMP) $(TESTS_C)
+
+tests_c: $(TESTS_C)
+
+tests_s: $(TESTS_CCOMP_TARGET_S)
+
+%.ccomp.target.s : %.c
+ $(TARGET_CCOMP) $(INCLUDES) $(CCOMPOPTS) $(CCOMPFLAGS) -S -o $@ $<
+
+%.gcc.target.s : %.c
+ $(TARGET_CC) $(INCLUDES) $(CCOMPOPTS) -S -o $@ $<
+
+%.gcc.host.s : %.c
+ $(CC) $(INCLUDES) $(CFLAGS) -S -o $@ $<
+
+%.target.o : %.target.s
+ $(TARGET_CC) -c -o $@ $<
+
+%.host.o : %.host.s
+ $(CC) $(CFLAGS) -c -o $@ $<
-.PHONY: s c o clean
+%.target.out : %.target
+ $(EXECUTE) $< | tee $@
+
+%.host.out : %.host
+ ./$< | tee $@
+
+ran%/example.ccomp.target: ran%/source.ccomp.target.o
+ $(TARGET_CCOMP) $(CCOMPOPTS) $(CCOMPFLAGS) $+ -o $@
+
+ran%/example.gcc.target: ran%/source.gcc.target.o
+ $(TARGET_CC) $(TARGET_CFLAGS) $+ -o $@
+
+ran%/example.gcc.host: ran%/source.gcc.host.o
+ $(CC) $(CFLAGS) $+ -o $@
+
+ran%/source.c:
+ mkdir -p ran$*
+ $(CSMITH) --seed $* --output ran$*/source.c
+
+ran%/example.target.cmp : ran%/example.gcc.target.out ran%/example.ccomp.target.out
+ cmp $+ > $@
+
+ran%/example.host_target.cmp : ran%/example.gcc.host.out ran%/example.ccomp.target.out
+ cmp $+ > $@
+
+.PHONY: all clean tests_c tests_c
+
+clean:
+ -rm -rf ran*