]> matita.cs.unibo.it Git - helm.git/blobdiff - helm/ocaml/Makefile.common.in
added generation of KLOCs in dot diagrams
[helm.git] / helm / ocaml / Makefile.common.in
index af5ecab861fabb342cbdb6704871c0a76c7a1bf1..9dff7894208c365a65473fd681eab2bbebf6cd3c 100644 (file)
@@ -39,12 +39,14 @@ OBJECTS_TO_INSTALL = $(ARCHIVE) $(ARCHIVE_OPT) $(ARCHIVE_OPT:%.cmxa=%.a) \
 DEPEND_FILES = $(INTERFACE_FILES) $(IMPLEMENTATION_FILES)
 
 $(ARCHIVE): $(IMPLEMENTATION_FILES:%.ml=%.cmo) $(LIBRARIES)
+       if [ $(PACKAGE) != dummy ]; then \
        $(OCAMLC) $(OCAMLARCHIVEOPTIONS) -a -o $@ \
-               $(IMPLEMENTATION_FILES:%.ml=%.cmo)
+               $(IMPLEMENTATION_FILES:%.ml=%.cmo); fi
 
 $(ARCHIVE_OPT): $(IMPLEMENTATION_FILES:%.ml=%.cmx) $(LIBRARIES_OPT)
+       if [ $(PACKAGE) != dummy ]; then \
        $(OCAMLOPT) $(OCAMLARCHIVEOPTIONS) -a -o $@ \
-               $(IMPLEMENTATION_FILES:%.ml=%.cmx)
+               $(IMPLEMENTATION_FILES:%.ml=%.cmx); fi
 
 prereq: $(PREREQ)
 all: prereq $(IMPLEMENTATION_FILES:%.ml=%.cmo) $(ARCHIVE)
@@ -102,6 +104,16 @@ ocamlinit:
        for p in $(REQUIRES); do echo "#require \"$$p\";;" >> .ocamlinit; done
        echo "#load \"$(PACKAGE).cma\";;" >> .ocamlinit
 
+# $(STATS_EXCLUDE) may be defined in libraries' Makefile to exclude some file
+# from statistics collection
+STATS_FILES = \
+       $(shell find . -maxdepth 1 -type f -name \*.ml $(foreach f,$(STATS_EXCLUDE),-not -name $(f))) \
+       $(shell find . -maxdepth 1 -type f -name \*.mli $(foreach f,$(STATS_EXCLUDE),-not -name $(f)))
+.stats: $(STATS_FILES)
+       rm -f .stats
+       echo -n "LOC:" >> .stats
+       wc -l $(STATS_FILES) | tail -1 | awk '{ print $$1 }' >> .stats
+
 .PHONY: all opt world backup depend install uninstall clean ocamlinit
 
 ifneq ($(MAKECMDGOALS), depend)