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/%,%,$@)
64 .PRECIOUS: lib/tool/pkg/archive/GNUmakefile
65 archive/%: lib/tool/pkg/archive/GNUmakefile
66 $(MAKE) -f $< $(patsubst archive/%,%,$@)
67 c clean: archive/clean
72 .PHONY: c clean cc cleaner b byte n native src
73 .PRECIOUS: lib/libocaml/make/GNUmakefile
74 src/%: export SRCDIR:=src
75 src/%: lib/libocaml/make/GNUmakefile
79 cc cleaner: src/cleaner
82 b/% byte/%: src/byte/%
84 n/% native/%: src/native/%
91 .PHONY: tc tcc tb tn txb txn t test
92 test/%: export SRCDIR:=test
93 test/%: lib/libocaml/make/GNUmakefile
96 cc cleaner: test/cleaner
98 test/native: src/native
104 txn: test/exec-native
110 .PHONY: u uninstall i install
111 install+=$(or $(filter i,$(MAKECMDGOALS)),$(filter install,$(MAKECMDGOALS)))
113 include src/configure.make
117 $(if $(DESTDIR),-destdir $(DESTDIR)) \
118 $(OCAMLFIND_REMOVE_FLAGS) \
121 $(if $(DESTDIR),mkdir -p $(DESTDIR))
123 $(if $(DESTDIR),-destdir $(DESTDIR)) \
124 $(OCAMLFIND_INSTALL_FLAGS) \
127 $(OCAMLFIND_INSTALL_FILES) \