1 export VERSION:=$(patsubst v%,%,$(shell \
2 test -e VERSION && cat VERSION || { \
3 test -e .git && which git >/dev/null && \
4 git describe --tags --match 'v[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]' --always || \
5 TZ=UTC date +'v%Y-%m-%d'; }))
17 $(patsubst %,$(if $1,$1/)%,$(shell \
19 if test -e .gitmodules && which git >/dev/null; \
20 then git config -f .gitmodules --get-regexp submodule'\..*\.'path | \
22 gitmodules:=$(.gitmodules)
24 define gitmodules/.git
26 git submodule update --init --recursive -- $$(@:/.git=)
27 cd $$(@:/.git=) && git checkout -f HEAD && git clean -dfx
31 $(if $(wildcard .git), \
32 $(foreach m,$(gitmodules), \
33 $(eval $(call gitmodules/.git,$m))))
38 .PHONY: debian debian/%
39 .PRECIOUS: lib/tool/pkg/debian/GNUmakefile
41 debian/%: export GIT_DCH_FLAGS+=--new-version \
42 $(shell printf %s '$(VERSION)' | sed -e s/-/./ -e s/-/./)
43 debian/%: lib/tool/pkg/debian/GNUmakefile
44 $(MAKE) -f $< $(patsubst debian/%,%,$@)
50 .PRECIOUS: lib/tool/asciidoc/GNUmakefile
52 doc/%: export A2X_FLAGS+=-aname="$(package)"
53 doc/%: export A2X_FLAGS+=-aversion="$(VERSION)"
54 doc/%: export MANLEVELS+=$(package) 3cm
55 doc/%: export SRCDIR:=doc
56 doc/%: lib/tool/asciidoc/GNUmakefile
57 $(MAKE) -f $< $(patsubst doc/%,%,$@)
63 .PHONY: archive archive/%
64 .PRECIOUS: lib/tool/pkg/archive/GNUmakefile
65 archive %.archive: lib/tool/pkg/archive/GNUmakefile
67 archive/%: lib/tool/pkg/archive/GNUmakefile
68 $(MAKE) -f $< $(patsubst archive/%,%,$@)
69 c clean: archive/clean
74 .PHONY: c clean cc cleaner b byte n native src
75 .PRECIOUS: lib/libocaml/make/GNUmakefile
76 src/%: export SRCDIR:=src
77 src/%: lib/libocaml/make/GNUmakefile
81 cc cleaner: src/cleaner
84 b/% byte/%: src/byte/%
86 n/% native/%: src/native/%
93 .PHONY: tc tcc tb tn txb txn t test
94 test/%: export SRCDIR:=test
95 test/%: lib/libocaml/make/GNUmakefile
98 cc cleaner: test/cleaner
100 test/native: src/native
106 txn: test/exec-native
112 .PHONY: u uninstall i install
113 install+=$(or $(filter i,$(MAKECMDGOALS)),$(filter install,$(MAKECMDGOALS)))
115 include src/configure.make
119 $(if $(DESTDIR),-destdir $(DESTDIR)) \
120 $(OCAMLFIND_REMOVE_FLAGS) \
123 $(if $(DESTDIR),mkdir -p $(DESTDIR))
125 $(if $(DESTDIR),-destdir $(DESTDIR)) \
126 $(OCAMLFIND_INSTALL_FLAGS) \
129 $(OCAMLFIND_INSTALL_FILES) \