3 DIRECTORIES = $(shell cat Make)
5 INCLUDES = $(DIRECTORIES:%=-I %)
7 OCAMLDEP = ocamlfind ocamldep -native $(INCLUDES)
8 OCAMLOPT = ocamlfind opt -linkpkg -package "$(REQUIRES)" $(INCLUDES)
9 OCAMLLEX = ocamllex.opt
10 OCAMLYACC = ocamlyacc -v
11 TAR = tar -czf $(MAIN:%=%.tgz)
15 MODULES += $$(addprefix $(1)/,$$(shell cat $(1)/Make))
19 SOURCES += $$(if $$(wildcard $(1).ml[yi]),$(1).mli $(1).ml,$(1).ml)
21 CLEAN += $(1).cmi $(1).cmx $(1).o
22 CLEAN += $$(if $$(wildcard $(1).ml[ly]),$(1).ml,)
23 CLEAN += $$(if $$(wildcard $(1).mly),$(1).mli $(1).output,)
24 KEEP += $$(if $$(wildcard $(1).mly),$(1).mly,\
25 $$(if $$(wildcard $(1).mll),$(1).mll,\
26 $$(if $$(wildcard $(1).mli),$(1).mli $(1).ml,$(1).ml)\
31 $(foreach DIR,$(DIRECTORIES),$(eval $(call DIR_TEMPLATE, $(DIR))))
32 $(foreach MOD,$(MODULES),$(eval $(call MOD_TEMPLATE, $(MOD))))
34 OBJECTS = $(patsubst %.ml,%.cmx,$(SOURCES:%.mli=%.cmi))
38 @$(MAKE) --no-print-directory $(MAIN).opt
40 $(MAIN).opt: $(OBJECTS)
41 @echo " OCAMLOPT -o $(MAIN).opt"
42 $(H)$(OCAMLOPT) -o $(MAIN).opt $(CMXS)
44 .depend.opt: $(SOURCES)
45 @echo " OCAMLDEP -native"
46 $(H)$(OCAMLDEP) $^ > .depend.opt
49 @echo " CLEAN . $(DIRECTORIES)"
50 $(H)find -name "*~" | xargs $(RM) $(CLEAN)
53 @echo " TAR -czf $(MAIN:%=%.tgz) . $(DIRECTORIES)"
54 $(H)find -name "Make*" | xargs $(TAR) $(KEEP)
69 ifeq ($(MAKECMDGOALS), $(MAIN).opt)