forked from coccinelle/coccinelle
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile.common
39 lines (34 loc) · 1.41 KB
/
Makefile.common
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# This file is part of Coccinelle, licensed under the terms of the GPL v2.
# See copyright.txt in the Coccinelle source code for more information.
# The Coccinelle source code can be obtained at http://coccinelle.lip6.fr
# Some common definitions that factored out many reoccurring patterns
# in the Makefiles of the project. This file is included at the bottom
# so that its implicit rules take precedence over implicit rules in
# the file that includes this one.
# this is a "hack" so that we do not have to pass --native to ocamldep
# and rebuild .depend when building the native version. Since we have
# .ml files without .mli files, building the .cmo *and .cmx file could
# cause the .cmi file to be build twice, which could cause trouble when
# the .cmi file is read by other compilation steps (especially when
# building in parallel).
export BUILD_OPT
ifeq ($(BUILD_OPT),yes)
%.cmo: %.ml
%.cmo: %.cmx
@echo "skipped building $@ in optimizing mode: $< will be built instead."
endif
define without_mli
ifeq ($(wildcard $(SOURCE).mli),)
ifeq ($(BUILD_OPT),yes)
$(SOURCE).cmo: $(SOURCE).cmx
$(SOURCE).cmi: $(SOURCE).cmx
else
$(SOURCE).cmi: $(SOURCE).cmo
endif
endif
endef
$(foreach SOURCE,$(SOURCES),$(eval $(without_mli)))
$(foreach SOURCE,$(SRC),$(eval $(without_mli)))
# If this variable is set, then 'make distclean' should not remove certain
# generated files like the generated parsers, and documentation.
export KEEP_GENERATED