1# Test for ocamldep and -no-alias-deps 2# There are two versions: 3# Makefile.build uses -no-alias-deps only for lib.ml/mli 4# Makefile.build2 has no lib.ml, and uses -no-alias-deps for components too 5 6OCAMLDEP=$(OCAMLRUN) $(OTOPDIR)/tools/ocamldep 7SOURCES = A.ml B.ml C.ml D.ml 8LINKS = $(SOURCES:%=Lib%) 9DEPENDS = depend.mk depend.mk2 depend.mod depend.mod2 depend.mod3 10 11all: clean 12 @$(MAKE) build > /dev/null 13 @$(MAKE) $(DEPENDS) > /dev/null 14 @$(MAKE) compare 15 16build: depend.mk depend.mk2 17 rm -f $(LINKS) 18 if $(NATIVECODE_ONLY); then : ; else \ 19 $(MAKE) -f Makefile.build byte; \ 20 rm -f *.cm* lib.ml; \ 21 $(MAKE) -f Makefile.build2 byte; fi 22 if $(BYTECODE_ONLY); then :; else \ 23 $(MAKE) -f Makefile.build opt; \ 24 rm -f *.cm* lib.ml; \ 25 $(MAKE) -f Makefile.build2 opt; fi 26 27# Create links for prefixed versions of the components 28Lib%.ml: %.ml 29 cp $< $@ 30 31# Dependencies for Makefile.build, compiling and linking lib.cmo 32depend.mk: $(LINKS) 33 cp lib_impl.ml lib.ml 34 $(OCAMLDEP) -as-map lib.ml lib.mli > $@ 35 $(OCAMLDEP) -map lib.ml -open Lib $(LINKS) >> $@ 36 37# Dependencies for Makefile.build2, not compiling lib.cmo 38depend.mk2: $(LINKS) 39 rm -f lib.ml 40 $(OCAMLDEP) -map lib.mli -open Lib \ 41 $(LINKS) > $@ 42 43# Others tests for ocamldep 44depend.mod: $(LINKS) 45 cp lib_impl.ml lib.ml 46 $(OCAMLDEP) -as-map -modules lib.ml lib.mli > $@ 47 $(OCAMLDEP) -modules -map lib.ml -open Lib $(LINKS) >> $@ 48 49depend.mod2: $(LINKS) 50 rm -f lib.ml 51 $(OCAMLDEP) -modules -map lib.mli $(LINKS) > $@ 52 53depend.mod3: $(LINKS) 54 rm -f lib.ml 55 $(OCAMLDEP) -modules -as-map -map lib.mli -open Lib \ 56 $(LINKS) > $@ 57 58promote: 59 for i in $(DEPENDS); do cp $$i $$i.reference; done 60 61compare: $(DEPENDS) 62 @rm -f $(LINKS) lib.ml 63 @for i in $(DEPENDS); do \ 64 printf " ... testing '$$i':"; \ 65 $(DIFF) $$i.reference $$i > /dev/null \ 66 && echo " => passed" || echo " => failed"; \ 67 done 68 69clean: 70 @rm -f *.cm* *.$(O) *.$(A) $(DEPENDS) $(LINKS) lib.ml *~ *.byt* *.opt* 71 72BASEDIR=../.. 73include $(BASEDIR)/makefiles/Makefile.common 74