Commit 29849d9b authored by Kim Nguyễn's avatar Kim Nguyễn
Browse files

Modify the Makefile to automatically rebuild OCaml objects when some Make...

Modify the Makefile to automatically rebuild OCaml objects when some Make Variable they depend on changes.
parent 770bff98
configure.log
cduce
build_flags
cduce*_js_runtime*
tests/js/*.js
!tests/js/cducetop_js_runtime.js
......
......@@ -113,6 +113,9 @@ else
FORPACKOPT=
endif
STDLIB_CD=stdlib/Io.cd stdlib/Fmt.cd stdlib/List.cd
STDLIB_CDO=$(STDLIB_CD:.cd=.cdo)
INSTALL := install -c
ifeq ($(NATIVE),true)
......@@ -345,9 +348,7 @@ cducetop_js_runtime.js:
CURL=false NETCLIENT=false NETCLIENT4=false NETSTRING=false \
CGI=false PXP_WLEX=false STD_LIBDIR=/static/stdlib/ \
cducetop_js_runtime
$(HIDE) js_of_ocaml --extern-fs -I . --file=stdlib/List.cdo \
--file=stdlib/Io.cdo \
--file=stdlib/Fmt.cdo \
$(HIDE) js_of_ocaml --extern-fs -I . $(STDLIB_CDO:%=--file=%) \
+nat.js +weak.js +toplevel.js cducetop_js_runtime
......@@ -374,7 +375,7 @@ clean:
$(HIDE) test -n "$(OCAMLIFACE)" && (cd $(OCAMLIFACE); $(MAKE) clean) || true
$(HIDE) rm -f `find . -name "*~"`
$(HIDE) rm -f *.cmi *.cmo *.cma *.cmx *.a *.cmxa *.cmt *.cmti *.o *~ META
$(HIDE) rm -f cduce$(EXE) ocamlprof.dump
$(HIDE) rm -f cduce$(EXE) ocamlprof.dump build_flags
$(HIDE) rm -f cduce*js_runtime*
$(HIDE) rm -f dtd2cduce$(EXE) webiface$(EXE) evaluator$(EXE)
$(HIDE) rm -Rf prepro package
......@@ -409,16 +410,25 @@ misc/q_symbol.cmo: misc/q_symbol.ml
parser/parser.$(EXTENSION): PACKAGES += camlp4.extend
.ml.cmo:
DUMMY := $(shell test ! -f build_flags -o \
\( "$(FORPACKOPT) $(SYNTAX_PARSER) $(INCLUDES) $(EXTRA_LINK_OPTS)" != \
"$(cat build_flags)" \) && \
rm -f build_flags && \
echo $(FORPACKOPT) $(SYNTAX_PARSER) $(INCLUDES) $(EXTRA_LINK_OPTS) > build_flags )
build_flags:
$(HIDE) echo $(FORPACKOPT) $(SYNTAX_PARSER) $(INCLUDES) $(EXTRA_LINK_OPTS) > build_flags
%.cmo: %.ml build_flags
@echo "Build $@"
$(HIDE)$(CAMLC) -c $(SYNTAX_PARSER) $(INCLUDES) $<
.ml.cmx:
%.cmx: %.ml build_flags
@echo "Build $@"
$(HIDE) $(CAMLOPT) $(FORPACKOPT) -c $(SYNTAX_PARSER) $(INCLUDES) $<
.mli.cmi:
%.cmi: %.mli build_flags
@echo "Build $@"
$(HIDE) $(CAMLC) -c $(SYNTAX_PARSER) $(INCLUDES) $<
......@@ -439,10 +449,9 @@ cduceres.o: win32/cduce.rc win32/cduce_logo-bw.ico
done
# Stdlib
STDLIB_CD=List.cd Io.cd Fmt.cd
stdlib: cduce $(STDLIB_CD:%=stdlib/%)
stdlib: cduce $(STDLIB_CD)
for i in $(STDLIB_CD) ; do \
./cduce --compile -I stdlib stdlib/$$i ; \
./cduce --compile -I stdlib $$i ; \
done
# Documentation
......@@ -478,4 +487,3 @@ $(OCAMLIFACE)/caml_cduce.cmx:
@echo "Build $@"
@cd $(OCAMLIFACE); \
$(MAKE) -s MODE=opt CAMLOPT="$(OCAMLFIND) $(CAMLOPT_P)" caml_cduce.cmx
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment