2012-10-17 13:09:16 -07:00
|
|
|
#########################################################################
|
|
|
|
# #
|
|
|
|
# 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 Q Public License version 1.0. #
|
|
|
|
# #
|
|
|
|
#########################################################################
|
|
|
|
|
2010-01-25 05:47:28 -08:00
|
|
|
CC=$(NATIVECC) $(NATIVECCCOMPOPTS)
|
|
|
|
FC=$(FORTAN_COMPILER)
|
2010-05-04 00:46:14 -07:00
|
|
|
CMO_FILES=$(MODULES:=.cmo)
|
|
|
|
CMX_FILES=$(MODULES:=.cmx)
|
|
|
|
CMA_FILES=$(LIBRARIES:=.cma)
|
|
|
|
CMXA_FILES=$(LIBRARIES:=.cmxa)
|
|
|
|
O_FILES=$(C_FILES:=.o)
|
2010-05-04 03:37:53 -07:00
|
|
|
|
2013-05-03 08:52:56 -07:00
|
|
|
CUSTOM_FLAG=`if [ -n "$(C_FILES)" ]; then echo '-custom'; fi`
|
2010-05-04 03:37:53 -07:00
|
|
|
ADD_CFLAGS+=$(CUSTOM_FLAG)
|
2013-05-03 08:52:56 -07:00
|
|
|
FORTRAN_LIB=`if [ -n "$(F_FILES)" ]; then echo '$(FORTRAN_LIBRARY)'; fi`
|
2010-05-04 03:37:53 -07:00
|
|
|
ADD_CFLAGS+=$(FORTRAN_LIB)
|
|
|
|
ADD_OPTFLAGS+=$(FORTRAN_LIB)
|
2010-01-25 05:47:28 -08:00
|
|
|
|
2010-05-05 02:45:49 -07:00
|
|
|
check:
|
2013-05-03 08:52:56 -07:00
|
|
|
@if [ -n "$(FORTRAN_COMPILER)" -o -z "$(F_FILES)" ]; then \
|
|
|
|
$(MAKE) run-all; \
|
|
|
|
fi
|
2010-05-05 02:45:49 -07:00
|
|
|
|
2010-01-25 05:47:28 -08:00
|
|
|
run-all:
|
|
|
|
@for file in $(C_FILES); do \
|
|
|
|
$(CC) -c -I$(PREFIX)/lib/ocaml/caml $$file.c; \
|
|
|
|
done;
|
|
|
|
@for file in $(F_FILES); do \
|
|
|
|
$(FORTRAN_COMPILER) -c -I$(PREFIX)/lib/ocaml/caml $$file.f; \
|
|
|
|
done;
|
|
|
|
@for file in *.ml; do \
|
2013-04-29 10:02:29 -07:00
|
|
|
if [ -f `basename $$file ml`precheck ]; then \
|
2013-05-03 08:52:56 -07:00
|
|
|
CANKILL=$(CANKILL) sh `basename $$file ml`precheck || continue; \
|
|
|
|
fi; \
|
2010-03-17 02:11:27 -07:00
|
|
|
printf " ... testing '$$file':"; \
|
2013-05-03 08:52:56 -07:00
|
|
|
$(MAKE) run-file DESC=ocamlc COMP='$(OCAMLC)' COMPFLAGS='$(ADD_COMPFLAGS) $(ADD_CFLAGS) $(O_FILES) -w a $(CMA_FILES) -I $(TTOP)/testsuite/lib $(CMO_FILES)' FILE=$$file PROGRAM_ARGS=$(PROGRAM_ARGS) \
|
|
|
|
&& if [ -z "$(BYTECODE_ONLY)" ]; then \
|
|
|
|
$(MAKE) run-file DESC=ocamlopt COMP='$(OCAMLOPT)' COMPFLAGS='$(ADD_COMPFLAGS) $(ADD_OPTFLAGS) $(O_FILES) -w a $(CMXA_FILES) -I $(TTOP)/testsuite/lib $(CMX_FILES)' FILE=$$file PROGRAM_ARGS=$(PROGRAM_ARGS); \
|
|
|
|
fi \
|
|
|
|
&& if [ ! -z $(UNSAFE) ]; then \
|
|
|
|
$(MAKE) run-file DESC=ocamlc-unsafe COMP='$(OCAMLC)' COMPFLAGS='-w a -unsafe -I $(TTOP)/testsuite/lib $(CMO_FILES)' FILE=$$file \
|
|
|
|
&& if [ -z "$(BYTECODE_ONLY)" ]; then \
|
2013-04-29 10:02:29 -07:00
|
|
|
$(MAKE) run-file DESC=ocamlopt-unsafe COMP='$(OCAMLOPT)' COMPFLAGS='-w a -unsafe -I $(TTOP)/testsuite/lib $(CMX_FILES)' FILE=$$file; \
|
2013-05-03 08:52:56 -07:00
|
|
|
fi; \
|
|
|
|
fi \
|
|
|
|
&& echo " => passed" || echo " => failed"; \
|
|
|
|
done
|
2010-01-25 05:47:28 -08:00
|
|
|
|
|
|
|
run-file:
|
2010-03-17 02:11:27 -07:00
|
|
|
@printf " $(DESC)"
|
2012-07-27 04:31:21 -07:00
|
|
|
@rm -f program program.exe
|
2013-04-29 10:02:29 -07:00
|
|
|
@$(COMP) $(COMPFLAGS) $(FILE) -o program$(EXE)
|
2013-05-03 08:52:56 -07:00
|
|
|
@F="`basename $(FILE) .ml`"; \
|
|
|
|
if [ -f $$F.runner ]; then \
|
|
|
|
sh $$F.runner; \
|
2010-01-28 07:42:08 -08:00
|
|
|
else \
|
2013-05-03 08:52:56 -07:00
|
|
|
./program$(EXE) $(PROGRAM_ARGS) > $$F.result; \
|
|
|
|
fi \
|
|
|
|
&& \
|
|
|
|
if [ -f $$F.checker ]; then \
|
|
|
|
DIFF="$(DIFF)" sh $$F.checker; \
|
2010-01-28 07:42:08 -08:00
|
|
|
else \
|
2013-05-03 08:52:56 -07:00
|
|
|
$(DIFF) $$F.reference $$F.result >/dev/null; \
|
|
|
|
fi
|
2010-01-25 05:47:28 -08:00
|
|
|
|
2011-06-15 05:14:14 -07:00
|
|
|
promote: defaultpromote
|
|
|
|
|
2010-01-25 05:47:28 -08:00
|
|
|
clean: defaultclean
|
2013-04-29 10:02:29 -07:00
|
|
|
@rm -f *.result program program.exe
|