2010-01-25 05:47:28 -08:00
|
|
|
# $Id$
|
|
|
|
|
|
|
|
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-03 08:00:11 -07:00
|
|
|
ADD_CFLAGS+=`if [ -z $(C_FILES) ]; then true; else echo '-custom'; fi`
|
|
|
|
ADD_CFLAGS+=`if [ -z $(F_FILES) ]; then true; else echo '$(FORTRAN_LIBRARY)'; fi`
|
|
|
|
ADD_OPTFLAGS+=`if [ -z $(F_FILES) ]; then true; else echo '$(FORTRAN_LIBRARY)'; 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 \
|
2010-03-17 02:11:27 -07:00
|
|
|
printf " ... testing '$$file':"; \
|
2010-01-25 05:47:28 -08:00
|
|
|
$(MAKE) run-file DESC=ocamlc COMP='$(OCAMLC)' COMPFLAGS='$(ADD_COMPFLAGS) $(ADD_CFLAGS) $(O_FILES) -w a $(CMA_FILES) -I ../../lib $(CMO_FILES)' FILE=$$file PROGRAM_ARGS=$(PROGRAM_ARGS) && \
|
|
|
|
$(MAKE) run-file DESC=ocamlopt COMP=$(PREFIX)/bin/ocamlopt COMPFLAGS='$(ADD_COMPFLAGS) $(ADD_OPTFLAGS) $(O_FILES) -w a $(CMXA_FILES) -I ../../lib $(CMX_FILES)' FILE=$$file PROGRAM_ARGS=$(PROGRAM_ARGS) && \
|
|
|
|
if [ ! -z $(UNSAFE) ]; then \
|
|
|
|
$(MAKE) run-file DESC=ocamlc-unsafe COMP=$(PREFIX)/bin/ocamlc COMPFLAGS='-w a -unsafe -I ../../li $(CMO_FILES)' FILE=$$file && \
|
|
|
|
$(MAKE) run-file DESC=ocamlopt-unsafe COMP=$(PREFIX)/bin/ocamlopt COMPFLAGS='-w a -unsafe -I ../../lib $(CMX_FILES)' FILE=$$file; \
|
|
|
|
fi && \
|
|
|
|
echo " => passed"; \
|
|
|
|
done;
|
|
|
|
|
|
|
|
run-file:
|
2010-03-17 02:11:27 -07:00
|
|
|
@printf " $(DESC)"
|
2010-01-25 05:47:28 -08:00
|
|
|
@$(COMP) $(COMPFLAGS) $(FILE) -o program
|
2010-01-28 07:42:08 -08:00
|
|
|
@if [ -f `basename $(FILE) ml`runner ]; then \
|
|
|
|
sh `basename $(FILE) ml`runner; \
|
|
|
|
else \
|
|
|
|
./program $(PROGRAM_ARGS) > `basename $(FILE) ml`result; \
|
|
|
|
fi
|
|
|
|
@if [ -f `basename $(FILE) ml`checker ]; then \
|
|
|
|
sh `basename $(FILE) ml`checker; \
|
|
|
|
else \
|
|
|
|
diff -q `basename $(FILE) ml`reference `basename $(FILE) ml`result > /dev/null || (echo " => failed" && exit 1); \
|
|
|
|
fi
|
2010-01-25 05:47:28 -08:00
|
|
|
|
|
|
|
clean: defaultclean
|
|
|
|
@rm -f *.result ./program
|