ocaml/testsuite/makefiles/Makefile.several

44 lines
1.7 KiB
Makefile
Raw Normal View History

# $Id$
CC=$(NATIVECC) $(NATIVECCCOMPOPTS)
FC=$(FORTAN_COMPILER)
CMO_FILES=$(patsubst %,%.cmo,$(MODULES))
CMX_FILES=$(patsubst %,%.cmx,$(MODULES))
CMA_FILES=$(patsubst %,%.cma,$(LIBRARIES))
CMXA_FILES=$(patsubst %,%.cmxa,$(LIBRARIES))
O_FILES=$(patsubst %,%.$(O),$(C_FILES) $(F_FILES))
ifdef C_FILES
ADD_CFLAGS+=-custom
endif
ifdef F_FILES
ADD_CFLAGS+=$(FORTRAN_LIBRARY)
ADD_OPTFLAGS+=$(FORTRAN_LIBRARY)
endif
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 \
echo -n " ... testing '$$file':"; \
$(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:
@echo -n " $(DESC)"
@$(COMP) $(COMPFLAGS) $(FILE) -o program
@./program $(PROGRAM_ARGS) > `basename $(FILE) ml`result
@diff -q `basename $(FILE) ml`reference `basename $(FILE) ml`result > /dev/null || (echo " => failed" && exit 1)
clean: defaultclean
@rm -f *.result ./program