This repository has been archived by the owner on Oct 21, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
executable file
·138 lines (112 loc) · 3.3 KB
/
Makefile
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
#
# makefile - configuration
#
# c/cpp, suite-base/suite/library #
MAKE_NAME:=dalai-suite
MAKE_LANG:=c
MAKE_TYPE:=suite-base
MAKE_DBIN:=bin
MAKE_DDOC:=doc
MAKE_DLIB:=lib
MAKE_DSRC:=src
MAKE_DOBJ:=obj
MAKE_OSYS:=$(shell uname -s)
MAKE_CMKD:=mkdir -p
MAKE_CRMF:=rm -f
MAKE_CRMD:=rm -rf
MAKE_CFCP:=cp
MAKE_CCMP:=gcc
ifeq ($(MAKE_OSYS),Linux)
MAKE_CLNK:=gcc-ar rcs
else
ifeq ($(MAKE_OSYS),Darwin)
MAKE_CLNK:=ar -rv
endif
endif
MAKE_CDOC:=doxygen
MAKE_FCMP:=
MAKE_FLNK:=
#
# makefile - configuration
#
ifneq (,$(filter $(MAKE_TYPE),suite libcommon))
MAKE_SWAP:=../../
else
MAKE_SWAP:=
endif
ifeq ($(MAKE_TYPE),libcommon)
MAKE_SUBS:=$(filter-out $(MAKE_SWAP)$(MAKE_DLIB)/libcommon, $(wildcard $(MAKE_SWAP)$(MAKE_DLIB)/*))
else
MAKE_SUBS:=$(wildcard $(MAKE_SWAP)$(MAKE_DLIB)/*)
endif
MAKE_SEGS:=$(wildcard $(MAKE_DSRC)/*)
MAKE_FSRC:=$(wildcard $(MAKE_DSRC)/*.$(MAKE_LANG))
MAKE_FOBJ:=$(addprefix $(MAKE_DOBJ)/,$(addsuffix .o,$(notdir $(basename $(MAKE_FSRC)))))
ifeq ($(MAKE_TYPE),suite)
MAKE_FLNK:=$(addsuffix /bin/*.a,$(MAKE_SUBS)) $(MAKE_FLNK)
else
ifneq (,$(filter $(MAKE_TYPE),library libcommon))
MAKE_FLNK:=$(addsuffix /bin/*.a,$(MAKE_SUBS))
endif
endif
MAKE_FCMP:=$(MAKE_FCMP) $(addprefix -I$(MAKE_LIB),$(addsuffix /src,$(MAKE_SUBS)))
#
# makefile - target
#
all:module build
clean-all:clean clean-module
module:make-module
clean-module:make-clean-module
ifeq ($(MAKE_TYPE),suite-base)
build:make-directories make-base
clean:make-clean-base
doc:make-module-doc make-segment-doc
clean-doc:make-clean-module-doc make-clean-segment-doc
else
build:make-directories make-$(MAKE_NAME)
clean:make-clean-$(MAKE_NAME)
all-doc:doc module-doc
clean-all-doc:clean-doc clean-module-doc
doc:make-doc
clean-doc:make-clean-doc
module-doc:make-module-doc
clean-module-doc:make-clean-module-doc
endif
#
# makefile - directive
#
make-$(MAKE_NAME):$(MAKE_FOBJ)
ifeq ($(MAKE_TYPE),suite)
$(MAKE_CCMP) -o $(MAKE_DBIN)/$(MAKE_NAME) $^ $(MAKE_FLNK)
else
ifneq (,$(filter $(MAKE_TYPE),library libcommon))
$(MAKE_CLNK) $(MAKE_DBIN)/$(MAKE_NAME).a $^ $(MAKE_FLNK)
endif
endif
$(MAKE_DOBJ)/%.o:$(MAKE_DSRC)/%.$(MAKE_LANG)
$(MAKE_CCMP) -c -o $@ $< $(MAKE_FCMP)
make-clean-$(MAKE_NAME):
$(MAKE_CRMF) $(MAKE_DBIN)/* $(MAKE_DOBJ)/*
make-base:
@$(foreach SEG, $(MAKE_SEGS), $(MAKE) -C $(SEG) build && $(MAKE_CFCP) $(SEG)/$(MAKE_DBIN)/* $(MAKE_DBIN)/ && ) true
make-clean-base:
$(MAKE_CRMF) $(MAKE_DBIN)/*
@$(foreach SEG, $(MAKE_SEGS), $(MAKE) -C $(SEG) clean && ) true
make-module:
@$(foreach LIB, $(MAKE_SUBS), $(MAKE) -C $(LIB) all && ) true
make-clean-module:
@$(foreach LIB, $(MAKE_SUBS), $(MAKE) -C $(LIB) clean-all && ) true
make-doc:
$(MAKE_CDOC)
make-clean-doc:
$(MAKE_CRMD) $(MAKE_DDOC)/html
make-module-doc:
@$(foreach LIB, $(MAKE_SUBS), $(MAKE) -C $(LIB) all-doc && ) true
make-clean-module-doc:
@$(foreach LIB, $(MAKE_SUBS), $(MAKE) -C $(LIB) clean-all-doc && ) true
make-segment-doc:
@$(foreach SEG, $(MAKE_SEGS), $(MAKE) -C $(SEG) doc && ) true
make-clean-segment-doc:
@$(foreach SEG, $(MAKE_SEGS), $(MAKE) -C $(SEG) clean-doc && ) true
make-directories:
$(MAKE_CMKD) $(MAKE_DBIN) $(MAKE_DDOC) $(MAKE_DOBJ)