-
Notifications
You must be signed in to change notification settings - Fork 0
/
common.mk
56 lines (40 loc) · 1.79 KB
/
common.mk
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# This file is included by all module.mk files, and provides common functionality
# You normally should never have to edit it.
# Generate .rules files for each GUI application target
LRULES := $(patsubst %,$(LPATH)/$(DEPDIR)/%.rules,$(LGUIPRODUCTS))
$(LRULES): system/auto/genrules.pl
-$(MKDIR) $(dir $@)
$(top_srcdir)/system/auto/genrules.pl --gui $(notdir $(basename $@)) > $@
-include $(LRULES) $(EMPTY_FILE)
# Generate .rules files for each console application target
LRULES := $(patsubst %,$(LPATH)/$(DEPDIR)/%.rules,$(LCONPRODUCTS))
$(LRULES): system/auto/genrules.pl
-$(MKDIR) $(dir $@)
$(top_srcdir)/system/auto/genrules.pl --con $(notdir $(basename $@)) > $@
-include $(LRULES) $(EMPTY_FILE)
LPRODUCTS := $(LGUIPRODUCTS) $(LCONPRODUCTS)
# include generated dependencies (we append EMPTY_FILE to avoid warnings if
# the list happens to be empty)
-include $(wildcard $(LPATH)/$(DEPDIR)/*.d) $(EMPTY_FILE)
# Transform LSRC to LOBJ (change each .cpp into .o, in the builddir)
# (two steps to make sure no .cpp files will be left in LOBJ for make clean)
LOBJ := $(patsubst $(srcdir)/%,$(top_builddir)/%,$(patsubst %.cpp,%.o,$(filter %.cpp,$(LSRC))) $(patsubst %.m,%.o,$(filter %.m,$(LSRC))))
# Transform LPRODUCTS to have full path information
LPRODUCTS := $(patsubst %,$(LPATH)/%$(EXEEXT),$(LPRODUCTS))
# Local all target
all-$(LPATH): $(LPRODUCTS) $(LOBJ)
# We want that "make dirname" works just like "make all-dirname"
$(LPATH): all-$(LPATH)
# Local clean target
LOBJ-$(LPATH) := $(LOBJ)
LPRODUCTS-$(LPATH) := $(LPRODUCTS)
clean-$(LPATH): clean-% :
-$(RM) $(LOBJ-$*) $(LPRODUCTS-$*)
# The global all/clean targets should invoke all sub-targets, we do that here
all: all-$(LPATH)
clean: clean-$(LPATH)
# reset variables
LSRC :=
LGUIPRODUCTS :=
LCONPRODUCTS :=
.PHONY: $(LPATH) all-$(LPATH) clean-$(LPATH)