1
# make a link to this file if you are working hard in one directory of Coq
2
# ln -s ../dev/tools/Makefile.dir Makefile
3
# if you are working in a sub/dir/ make a link to dev/tools/Makefile.subdir instead
4
# this Makefile provides many useful facilities to develop Coq
5
# it is not completely compatible with .ml4 files unfortunately
11
# this complicated thing should work for subsubdirs as well
12
BASEDIR=$(shell (dir=`pwd`; cd $(TOPDIR); top=`pwd`; echo $$dir | sed -e "s|$$top/||"))
17
@echo TOPDIR=$(TOPDIR)
18
@echo BASEDIR=$(BASEDIR)
20
include $(TOPDIR)/dev/tools/Makefile.common
24
$(MAKE) -C $(TOPDIR) $(notdir $(BASEDIR))
26
# make all cmo's in this directory. Useful in case the main Makefile is not
29
@( ( for i in *.ml; do \
30
echo -n $(BASEDIR)/`basename $$i .ml`.cmo "" ; \
33
echo -n $(BASEDIR)/`basename $$i .ml4`.cmo "" ; \
35
| xargs $(MAKE) -C $(TOPDIR) )
37
# lists all files that should be compiled in this directory
39
@(for i in *.mli; do \
40
ls -l `basename $$i .mli`.cmi; \
43
ls -l `basename $$i .ml`.cmo; \
45
@(for i in *.ml4; do \
46
ls -l `basename $$i .ml4`.cmo; \
51
rm -f *.cmi *.cmo *.cmx *.o
54
# if grammar.cmo files cannot be compiled and main .depend cannot be
55
# rebuilt, this is quite useful
57
(cd $(TOPDIR); ocamldep -I $(BASEDIR) $(BASEDIR)/*.ml $(BASEDIR)/*.mli > .depend.devel)
60
# displays the dependency graph of the current directory (vertically,
63
(ocamldep *.ml *.mli | ocamldot | dot -Tps | gv -) &
66
# the pretty entry draws a dependency graph marking red those nodes
67
# which do not have their .cmo files
69
.INTERMEDIATE: depend.dot depend.2.dot
73
ocamldep *.ml *.mli | ocamldot > $@
75
depend.2.dot: depend.dot
76
(i=`cat $< | wc -l`; i=`expr $$i - 1`; head -n $$i $<) > $@
78
base=`basename $$ml .ml`; \
79
fst=`echo $$base | cut -c1 | tr [:lower:] [:upper:]`; \
80
rest=`echo $$base | cut -c2-`; \
81
name=`echo $$fst $$rest | tr -d " "`; \
83
if [ ! -e $$cmo ]; then \
84
echo \"$$name\" [color=red]\; >> $@;\
89
depend.ps: depend.2.dot
96
(gv -spartan $<; rm $<) &
101
# generating file.ml.mli by tricking make to pass -i to ocamlc
104
@(cmo=`basename $@ .ml.mli`.cmo ; \
105
mv -f $$cmo $$cmo.tmp ; \
106
$(MAKE) -s -C $(TOPDIR) $(BASEDIR)/$$cmo CAMLDEBUG=-i > $@ ; \
107
echo Generated interface file $@ ; \
108
mv -f $$cmo.tmp $$cmo)
111
@(cmo=`basename $@ .annot`.cmo ; \
112
mv -f $$cmo $$cmo.tmp ; \
113
$(MAKE) -s -C $(TOPDIR) $(BASEDIR)/$$cmo CAMLDEBUG=-dtypes ; \
114
echo Generated annotation file $@ ; \
115
mv -f $$cmo.tmp $$cmo)
122
# this is not perfect but mostly WORKS! It just calls the main makefile
125
$(MAKE) -C $(TOPDIR) $(BASEDIR)/$@
128
$(MAKE) -C $(TOPDIR) $(BASEDIR)/$@
131
$(MAKE) -C $(TOPDIR) bin/coqtop.byte