]> Git — Sourcephile - ocaml/libocaml_make.git/blob - libocaml.GNUmakefile
Correction : règle inutile et cause d’erreur.
[ocaml/libocaml_make.git] / libocaml.GNUmakefile
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'; }))
6
7 .PHONY: all all/%
8 .DEFAULT_GOAL: all
9 all: src/all
10 all/%: src/all/%
11
12
13 # ----------
14 # gitmodules
15 # ----------
16 .gitmodules= \
17 $(patsubst %,$(if $1,$1/)%,$(shell \
18 $(if $1,cd $1 &&) \
19 if test -e .gitmodules && which git >/dev/null; \
20 then git config -f .gitmodules --get-regexp submodule'\..*\.'path | \
21 cut -d ' ' -f 2; fi))
22 gitmodules:=$(.gitmodules)
23
24 define gitmodules/.git
25 $1/.git:
26 git submodule update --init --recursive -- $$(@:/.git=)
27 cd $$(@:/.git=) && git checkout -f HEAD && git clean -dfx
28 $1/%: $1/.git
29
30 endef
31 $(if $(wildcard .git), \
32 $(foreach m,$(gitmodules), \
33 $(eval $(call gitmodules/.git,$m))))
34
35 # ------
36 # debian
37 # ------
38 .PHONY: debian debian/%
39 .PRECIOUS: lib/tool/pkg/debian/GNUmakefile
40 debian: debian/build
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/%,%,$@)
45
46 # ---
47 # doc
48 # ---
49 .PHONY: doc doc/%
50 .PRECIOUS: lib/tool/asciidoc/GNUmakefile
51 doc: doc/all
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/%,%,$@)
58 c clean: doc/clean
59
60 # -------
61 # archive
62 # -------
63 .PHONY: archive/%
64 .PRECIOUS: lib/tool/pkg/archive/GNUmakefile
65 archive/%: lib/tool/pkg/archive/GNUmakefile
66 $(MAKE) -f $< $(patsubst archive/%,%,$@)
67 c clean: archive/clean
68
69 # ---
70 # src
71 # ---
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
76 $(MAKE) -f $< $@
77 src: src/all
78 c clean: src/clean
79 cc cleaner: src/cleaner
80 b byte: src/byte
81 n native: src/native
82 b/% byte/%: src/byte/%
83
84 n/% native/%: src/native/%
85
86
87 # ----
88 # test
89 # ----
90 .PHONY: test test/%
91 .PHONY: tc tcc tb tn txb txn t test
92 test/%: export SRCDIR:=test
93 test/%: lib/libocaml/make/GNUmakefile
94 $(MAKE) -f $< $@
95 c clean: test/clean
96 cc cleaner: test/cleaner
97 test/byte: src/byte
98 test/native: src/native
99 tc: test/clean
100 tcc: test/cleaner
101 tb: test/byte
102 tn: test/native
103 txb: test/exec-byte
104 txn: test/exec-native
105 t test: test/all
106
107 # -------
108 # install
109 # -------
110 .PHONY: u uninstall i install
111 install+=$(or $(filter i,$(MAKECMDGOALS)),$(filter install,$(MAKECMDGOALS)))
112 ifneq ($(install),)
113 include src/configure.make
114 endif
115 u uninstall:
116 ocamlfind remove \
117 $(if $(DESTDIR),-destdir $(DESTDIR)) \
118 $(OCAMLFIND_REMOVE_FLAGS) \
119 $(package)
120 i install: uninstall
121 $(if $(DESTDIR),mkdir -p $(DESTDIR))
122 ocamlfind install \
123 $(if $(DESTDIR),-destdir $(DESTDIR)) \
124 $(OCAMLFIND_INSTALL_FLAGS) \
125 $(package) \
126 src/META \
127 $(OCAMLFIND_INSTALL_FILES) \