summaryrefslogtreecommitdiff
path: root/testsuite/tests/asmgen/Makefile
diff options
context:
space:
mode:
authorXavier Leroy <xavier.leroy@inria.fr>2017-10-02 15:09:21 +0200
committerXavier Leroy <xavier.leroy@inria.fr>2017-10-02 15:09:21 +0200
commit0d839d4b42ff28ab75667500c1a6d396276d0eb8 (patch)
tree3d253ccb349b6ac603e5fb0dcf481c0ceb672017 /testsuite/tests/asmgen/Makefile
parentb9709db3ff7cc9d6c30310899162a2c5a20fae2e (diff)
downloadocaml-tests_asmcomp_revised.tar.gz
Split tests/asmcomp into tests/asmgen and /tests/asmcomptests_asmcomp_revised
tests/asmgen contains the custom C-- code generator and the tests written in C-- tests/asmcomp contains the tests written in OCaml The purpose of this split is to make it easier to skip or remove entirely the asmgen tests in the future. Also: modernize the asm stubs in asmgen and remove the stubs for no-longer-supported architectures.
Diffstat (limited to 'testsuite/tests/asmgen/Makefile')
-rw-r--r--testsuite/tests/asmgen/Makefile122
1 files changed, 122 insertions, 0 deletions
diff --git a/testsuite/tests/asmgen/Makefile b/testsuite/tests/asmgen/Makefile
new file mode 100644
index 0000000000..f6d0c238ff
--- /dev/null
+++ b/testsuite/tests/asmgen/Makefile
@@ -0,0 +1,122 @@
+#**************************************************************************
+#* *
+#* OCaml *
+#* *
+#* Xavier Clerc, SED, INRIA Rocquencourt *
+#* *
+#* Copyright 2010 Institut National de Recherche en Informatique et *
+#* en Automatique. *
+#* *
+#* All rights reserved. This file is distributed under the terms of *
+#* the GNU Lesser General Public License version 2.1, with the *
+#* special exception on linking described in the file LICENSE. *
+#* *
+#**************************************************************************
+
+BASEDIR=../..
+
+include $(BASEDIR)/../config/Makefile
+
+INCLUDES=\
+ -I $(OTOPDIR)/parsing \
+ -I $(OTOPDIR)/utils \
+ -I $(OTOPDIR)/typing \
+ -I $(OTOPDIR)/middle_end \
+ -I $(OTOPDIR)/bytecomp \
+ -I $(OTOPDIR)/asmcomp
+
+OTHEROBJS=\
+ $(OTOPDIR)/compilerlibs/ocamlcommon.cma \
+ $(OTOPDIR)/compilerlibs/ocamloptcomp.cma
+
+OBJS=parsecmmaux.cmo parsecmm.cmo lexcmm.cmo
+
+ADD_COMPFLAGS=$(INCLUDES) -w -40 -g
+
+default:
+ @if $(BYTECODE_ONLY) || $(SKIP) ; then $(MAKE) skips ; else \
+ $(MAKE) all; \
+ fi
+
+all:
+ @$(MAKE) arch codegen
+ @$(MAKE) tests
+
+main.cmo: parsecmm.cmo
+
+codegen: parsecmm.ml lexcmm.ml $(OBJS:.cmo=.cmi) $(OBJS) main.cmo
+ @$(OCAMLC) $(LINKFLAGS) -o codegen $(OTHEROBJS) $(OBJS) main.cmo
+
+parsecmm.mli parsecmm.ml: parsecmm.mly
+ @$(OCAMLYACC) -q parsecmm.mly
+
+lexcmm.ml: lexcmm.mll
+ @$(OCAMLLEX) -q lexcmm.mll
+
+CASES=fib tak quicksort quicksort2 soli \
+ arith checkbound tagged-fib tagged-integr tagged-quicksort tagged-tak \
+ catch-try catch-rec even-odd even-odd-spill pgcd
+ARGS_fib=-DINT_INT -DFUN=fib main.c
+ARGS_tak=-DUNIT_INT -DFUN=takmain main.c
+ARGS_quicksort=-DSORT -DFUN=quicksort main.c
+ARGS_quicksort2=-DSORT -DFUN=quicksort main.c
+ARGS_soli=-DUNIT_INT -DFUN=solitaire main.c
+ARGS_integr=-DINT_FLOAT -DFUN=test main.c
+ARGS_arith=mainarith.c
+ARGS_checkbound=-DCHECKBOUND main.c
+ARGS_tagged-fib=-DINT_INT -DFUN=fib main.c
+ARGS_tagged-integr=-DINT_FLOAT -DFUN=test main.c
+ARGS_tagged-quicksort=-DSORT -DFUN=quicksort main.c
+ARGS_tagged-tak=-DUNIT_INT -DFUN=takmain main.c
+ARGS_catch-try=-DINT_INT -DFUN=catch_exit main.c
+ARGS_catch-rec=-DINT_INT -DFUN=catch_fact main.c
+ARGS_even-odd=-DINT_INT -DFUN=is_even main.c
+ARGS_even-odd-spill=-DINT_INT -DFUN=is_even main.c
+ARGS_pgcd=-DINT_INT -DFUN=pgcd_30030 main.c
+
+skips:
+ @for c in $(CASES); do \
+ echo " ... testing '$$c': => skipped"; \
+ done
+
+one:
+ @$(call CCOMP,$(NAME).out $(ARGS_$(NAME)) $(NAME).$(O) $(ARCH).$(O)) \
+ && echo " => passed" || echo " => failed"
+
+clean: defaultclean
+ @rm -f ./codegen *.out *.out.manifest *.$(O) *.exe
+ @rm -f parsecmm.ml parsecmm.mli lexcmm.ml
+ @rm -f $(CASES:=.s)
+
+include $(BASEDIR)/makefiles/Makefile.common
+
+ifeq "$(CCOMPTYPE)-$(ARCH)" "msvc-amd64"
+# these tests are not ported to MSVC64 yet
+SKIP=true
+else
+SKIP=false
+endif
+
+ifeq "$(WITH_SPACETIME)" "true"
+# These tests have not been ported for Spacetime
+SKIP=true
+endif
+
+ifeq ($(CCOMPTYPE),msvc)
+CCOMP=set -o pipefail ; $(CC) $(CFLAGS) /Fe$(1) | tail -n +2
+else
+CCOMP=$(CC) $(CFLAGS) -o $(1)
+endif
+tests: $(CASES:=.$(O))
+ @for c in $(CASES); do \
+ printf " ... testing '$$c':"; \
+ $(MAKE) one NAME=$$c; \
+ done
+
+promote:
+
+arch: $(ARCH).$(O)
+
+i386.obj: i386nt.asm
+ @set -o pipefail ; \
+ $(ASM) $@ $^ | tail -n +2