Makefiles: deduplicate the default rules

After this commit, ocamldep is called with the -shash option under
Unix, which was not the case before but should not change anything
in practice.
master
Sébastien Hinderer 2017-01-14 18:37:30 +01:00
parent 83aff485b3
commit 7a24ff49e5
3 changed files with 54 additions and 99 deletions

View File

@ -196,54 +196,10 @@ natruntop:
$(MAKE) ocamlnat
@rlwrap --help 2>/dev/null && rlwrap $(NATRUNTOP) || $(NATRUNTOP)
# Default rules
.SUFFIXES: .ml .mli .cmo .cmi .cmx
.ml.cmo:
$(CAMLC) $(COMPFLAGS) -c $<
.mli.cmi:
$(CAMLC) $(COMPFLAGS) -c $<
.ml.cmx:
$(CAMLOPT) $(COMPFLAGS) -c $<
partialclean::
for d in \
utils parsing typing bytecomp asmcomp middle_end \
middle_end/base_types driver toplevel tools; \
do \
rm -f $$d/*.cm[ioxt] $$d/*.cmti $$d/*.annot $$d/*.[so] $$d/*~; \
done
rm -f *~
depend: beforedepend
(for d in utils parsing typing bytecomp asmcomp middle_end \
middle_end/base_types driver toplevel; \
do \
$(CAMLDEP) $(DEPFLAGS) $$d/*.mli $$d/*.ml; \
done) > .depend
$(CAMLDEP) $(DEPFLAGS) -native \
-impl driver/compdynlink.mlopt >> .depend
$(CAMLDEP) $(DEPFLAGS) -bytecode \
-impl driver/compdynlink.mlbyte >> .depend
alldepend:: depend
distclean:
$(MAKE) clean
rm -f boot/ocamlrun boot/ocamlrun.exe boot/camlheader boot/ocamlyacc \
boot/*.cm* boot/libcamlrun.a
rm -f config/Makefile config/m.h config/s.h
rm -f tools/*.bak
rm -f ocaml ocamlc
rm -f testsuite/_log
.PHONY: all backup bootstrap
.PHONY: partialclean beforedepend alldepend cleanboot coldstart
.PHONY: cleanboot coldstart
.PHONY: compare core coreall
.PHONY: coreboot depend distclean
.PHONY: coreboot
.PHONY: ocamltools ocamltoolsopt
.PHONY: ocamltoolsopt.opt opt-core opt opt.opt
.PHONY: promote promote-cross

View File

@ -151,60 +151,10 @@ natruntop:
$(MAKEREC) ocamlnat
@rlwrap --help 2>/dev/null && $(EXTRAPATH) rlwrap $(NATRUNTOP) || $(EXTRAPATH) $(NATRUNTOP)
# Default rules
.SUFFIXES: .ml .mli .cmo .cmi .cmx
.ml.cmo:
$(CAMLC) $(COMPFLAGS) -c $<
.mli.cmi:
$(CAMLC) $(COMPFLAGS) -c $<
.ml.cmx:
$(CAMLOPT) $(COMPFLAGS) -c $<
partialclean::
rm -f utils/*.cm* utils/*.$(O) utils/*.$(S)
rm -f parsing/*.cm* parsing/*.$(O) parsing/*.$(S)
rm -f typing/*.cm* typing/*.$(O) typing/*.$(S)
rm -f bytecomp/*.cm* bytecomp/*.$(O) bytecomp/*.$(S)
rm -f asmcomp/*.cm* asmcomp/*.$(O) asmcomp/*.$(S)
rm -f middle_end/*.cm* middle_end/*.$(O) middle_end/*.$(S)
rm -f middle_end/base_types/*.cm* middle_end/base_types/*.$(O) \
middle_end/base_types/*.$(S)
rm -f driver/*.cm* driver/*.$(O) driver/*.$(S)
rm -f toplevel/*.cm* toplevel/*.$(O) toplevel/*.$(S)
rm -f tools/*.cm* tools/*.$(O) tools/*.$(S)
depend: beforedepend
(for d in utils parsing typing bytecomp asmcomp middle_end \
middle_end/base_types driver toplevel; \
do $(CAMLDEP) -slash $(DEPFLAGS) $$d/*.mli $$d/*.ml; \
done) > .depend
$(CAMLDEP) -slash $(DEPFLAGS) -native \
-impl driver/compdynlink.mlopt >> .depend
$(CAMLDEP) -slash $(DEPFLAGS) -bytecode \
-impl driver/compdynlink.mlbyte >> .depend
alldepend:: depend
distclean:
$(MAKEREC) clean
rm -f asmrun/.depend.nt byterun/.depend.nt \
otherlibs/bigarray/.depend.nt \
otherlibs/str/.depend.nt
rm -f boot/ocamlrun boot/ocamlrun.exe boot/camlheader boot/ocamlyacc \
boot/*.cm* boot/libcamlrun.a
rm -f config/Makefile config/m.h config/s.h
rm -f tools/*.bak
rm -f ocaml ocamlc
rm -f testsuite/_log
.PHONY: all backup bootstrap clean
.PHONY: partialclean beforedepend alldepend cleanboot coldstart
.PHONY: all backup bootstrap
.PHONY: cleanboot coldstart
.PHONY: compare core coreall
.PHONY: coreboot depend distclean
.PHONY: coreboot
.PHONY: ocamltools ocamltoolsopt
.PHONY: ocamltoolsopt.opt opt-core opt opt.opt
.PHONY: promote promote-cross

View File

@ -329,9 +329,11 @@ utils/config.ml: utils/config.mlp config/Makefile
-e 's|%%WITH_SPACETIME%%|$(WITH_SPACETIME)|' \
$< > $@
.PHONY: partialclean
partialclean::
rm -f utils/config.ml
.PHONY: beforedepend
beforedepend:: utils/config.ml
# FlexDLL sources missing error messages
@ -729,6 +731,8 @@ stdlib/libcamlrun.$(A): byterun/libcamlrun.$(A)
clean::
$(MAKE) -C byterun clean
rm -f stdlib/libcamlrun.$(A)
.PHONY: alldepend
alldepend::
$(MAKE) -C byterun depend
@ -1015,3 +1019,48 @@ partialclean::
rm -f bytecomp/opcodes.ml
beforedepend:: bytecomp/opcodes.ml
# Default rules
.SUFFIXES: .ml .mli .cmo .cmi .cmx
.ml.cmo:
$(CAMLC) $(COMPFLAGS) -c $<
.mli.cmi:
$(CAMLC) $(COMPFLAGS) -c $<
.ml.cmx:
$(CAMLOPT) $(COMPFLAGS) -c $<
partialclean::
for d in utils parsing typing bytecomp asmcomp middle_end \
middle_end/base_types driver toplevel tools; do \
rm -f $$d/*.cm[ioxt] $$d/*.cmti $$d/*.annot $$d/*.$(S) \
$$d/*.$(O) $$d/*.$(SO) $d/*~; \
done
rm -f *~
.PHONY: depend
depend: beforedepend
(for d in utils parsing typing bytecomp asmcomp middle_end \
middle_end/base_types driver toplevel; \
do $(CAMLDEP) -slash $(DEPFLAGS) $$d/*.mli $$d/*.ml; \
done) > .depend
$(CAMLDEP) -slash $(DEPFLAGS) -native \
-impl driver/compdynlink.mlopt >> .depend
$(CAMLDEP) -slash $(DEPFLAGS) -bytecode \
-impl driver/compdynlink.mlbyte >> .depend
alldepend:: depend
distclean: clean
rm -f asmrun/.depend.nt byterun/.depend.nt \
otherlibs/bigarray/.depend.nt \
otherlibs/str/.depend.nt
rm -f boot/ocamlrun boot/ocamlrun$(EXE) boot/camlheader \
boot/ocamlyacc boot/*.cm* boot/libcamlrun.$(A)
rm -f config/Makefile config/m.h config/s.h
rm -f tools/*.bak
rm -f ocaml ocamlc
rm -f testsuite/_log