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
|
|
|
|
|
|
|
CUSTOM_FLAG=`if [ -z "$(C_FILES)" ]; then true; else echo '-custom'; fi`
|
|
|
|
ADD_CFLAGS+=$(CUSTOM_FLAG)
|
|
|
|
FORTRAN_LIB=`if [ -z "$(F_FILES)" ]; then true; else echo '$(FORTRAN_LIBRARY)'; fi`
|
|
|
|
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:
|
|
|
|
@if [ -n "$(FORTRAN_COMPILER)" -o -z "$(F_FILES)" ]; then $(MAKE) run-all; fi
|
|
|
|
|
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 \
|
|
|
|
CANKILL=$(CANKILL) sh `basename $$file ml`precheck || continue; \
|
|
|
|
fi; \
|
2010-03-17 02:11:27 -07:00
|
|
|
printf " ... testing '$$file':"; \
|
2013-04-29 10:02:29 -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) && \
|
2012-01-18 01:51:16 -08:00
|
|
|
if [ -z "$(BYTECODE_ONLY)" ]; then \
|
2013-04-29 10:02:29 -07:00
|
|
|
$(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); \
|
2012-01-18 01:51:16 -08:00
|
|
|
fi && \
|
2010-01-25 05:47:28 -08:00
|
|
|
if [ ! -z $(UNSAFE) ]; then \
|
2013-04-29 10:02:29 -07:00
|
|
|
$(MAKE) run-file DESC=ocamlc-unsafe COMP='$(OCAMLC)' COMPFLAGS='-w a -unsafe -I $(TTOP)/testsuite/lib $(CMO_FILES)' FILE=$$file && \
|
2012-01-18 01:51:16 -08:00
|
|
|
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; \
|
2012-01-18 01:51:16 -08:00
|
|
|
fi; \
|
2010-01-25 05:47:28 -08:00
|
|
|
fi && \
|
|
|
|
echo " => passed"; \
|
|
|
|
done;
|
|
|
|
|
|
|
|
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)
|
2010-01-28 07:42:08 -08:00
|
|
|
@if [ -f `basename $(FILE) ml`runner ]; then \
|
|
|
|
sh `basename $(FILE) ml`runner; \
|
|
|
|
else \
|
2013-04-29 10:02:29 -07:00
|
|
|
./program$(EXE) $(PROGRAM_ARGS) > `basename $(FILE) ml`result; \
|
2012-07-27 04:31:21 -07:00
|
|
|
fi || (echo " => failed" && exit 1)
|
2010-01-28 07:42:08 -08:00
|
|
|
@if [ -f `basename $(FILE) ml`checker ]; then \
|
2013-04-29 10:02:29 -07:00
|
|
|
DIFF="$(DIFF)" sh `basename $(FILE) ml`checker; \
|
2010-01-28 07:42:08 -08:00
|
|
|
else \
|
2012-07-27 04:31:21 -07:00
|
|
|
$(DIFF) `basename $(FILE) ml`reference `basename $(FILE) ml`result > /dev/null; \
|
|
|
|
fi || (echo " => failed" && exit 1)
|
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
|