mutated_ocaml / testsuite / makefiles / Makefile.one

# $Id: Makefile.one 12649 2012-06-27 12:29:20Z doligez $

CMI_FILES=$(MODULES:=.cmi)
CMO_FILES=$(MODULES:=.cmo)
CMX_FILES=$(MODULES:=.cmx)
CMA_FILES=$(LIBRARIES:=.cma)
CMXA_FILES=$(LIBRARIES:=.cmxa)
ML_LEX_FILES=$(LEX_MODULES:=.ml)
ML_YACC_FILES=$(YACC_MODULES:=.ml)
MLI_YACC_FILES=$(YACC_MODULES:=.mli)
ML_FILES=$(ML_LEX_FILES) $(ML_YACC_FILES)
O_FILES=$(C_FILES:=.o)
ADD_CMO_FILES=$(ADD_MODULES:=.cmo)
ADD_CMX_FILES=$(ADD_MODULES:=.cmx)

GENERATED_SOURCES=$(ML_LEX_FILES) $(ML_YACC_FILES) $(MLI_YACC_FILES)

CUSTOM_FLAG=`if [ -z "$(C_FILES)" ]; then true; else echo '-custom'; fi`
ADD_CFLAGS+=$(CUSTOM_FLAG)

default: compile run

compile: $(ML_FILES) $(CMO_FILES) $(MAIN_MODULE).cmo
	@for file in $(C_FILES); do \
	  $(NATIVECC) $(NATIVECCCOMPOPTS) -c -I$(TOPDIR)/byterun $$file.c; \
	done;
	@rm -f program.byte program.byte.exe
	@$(OCAMLC) $(ADD_COMPFLAGS) $(ADD_CFLAGS) -o program.byte $(O_FILES) $(CMA_FILES) $(CMO_FILES) $(ADD_CMO_FILES) $(MAIN_MODULE).cmo
	@if [ -z "$(BYTECODE_ONLY)" ]; then \
	  rm -f program.native program.native.exe; \
	  $(MAKE) $(CMX_FILES) $(MAIN_MODULE).cmx; \
	  $(OCAMLOPT) $(ADD_COMPFLAGS) -o program.native $(O_FILES) $(CMXA_FILES) $(CMX_FILES) $(ADD_CMX_FILES) $(MAIN_MODULE).cmx; \
	fi

run:
	@printf " ... testing with ocamlc"
	@./program.byte $(EXEC_ARGS) > $(MAIN_MODULE).result || (echo " => failed" && exit 1)
	@$(DIFF) $(MAIN_MODULE).reference $(MAIN_MODULE).result > /dev/null || (echo " => failed" && exit 1)
	@if [ -z "$(BYTECODE_ONLY)" ]; then \
	  printf " ocamlopt"; \
	  ./program.native $(EXEC_ARGS) > $(MAIN_MODULE).result || (echo " => failed" && exit 1); \
	  $(DIFF) $(MAIN_MODULE).reference $(MAIN_MODULE).result > /dev/null || (echo " => failed" && exit 1); \
	fi
	@echo " => passed"

promote: defaultpromote

clean: defaultclean
	@rm -f *.result ./program.* $(GENERATED_SOURCES) $(O_FILES)
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.