- new folder src/ to hold the source code for main project applications
- main.c is in src/
- all core files are subfolder are in src/core/
- modules are in src/modules/
- libs are in src/lib/
- application Makefiles are in src/
- application binary is built in src/ (src/kamailio)
1 | 1 |
deleted file mode 100644 |
... | ... |
@@ -1,293 +0,0 @@ |
1 |
-# Kamailio build system |
|
2 |
-# |
|
3 |
-# common Makefile rules, included by main Makefile & the modules |
|
4 |
-# |
|
5 |
- |
|
6 |
-# |
|
7 |
-# Uses: NAME, ALLDEP, CC, CFLAGS, C_DEFS, DEFS, C_INCLUDES, INCLUDES, LIBS, |
|
8 |
-# MKDEP, auto_gen, auto_gen_others, auto_gen_keep, |
|
9 |
-# depends, objs, extra_objs, static_modules, static_modules_path, |
|
10 |
-# LD_RPATH |
|
11 |
-# (all this must be defined previously!, see Makefile.defs & Makefile) |
|
12 |
-# Optional: SER_LIBS - list of ser libraries that will be automatically |
|
13 |
-# built if necessary. Format: path/shortname, where shortname is the |
|
14 |
-# name passed to -l (e.g. for libprint.so the shortname is print) |
|
15 |
-# |
|
16 |
- |
|
17 |
- |
|
18 |
-# check if the saved cfg corresponds with the current one |
|
19 |
-# (if not rebuild everything) |
|
20 |
-ifeq (,$(filter $(nodep_targets),$(MAKECMDGOALS))) |
|
21 |
--include makecfg.lst |
|
22 |
-# if trying to build a lib automatically and the lib is already compiled, |
|
23 |
-# don't rebuild it if the only differences in DEFS or INCLUDES are covered |
|
24 |
-# by LIB_NOREBUILD_DEFS/LIB_NOREBUILD_INCLUDES |
|
25 |
-LIB_NOREBUILD_DEFS= |
|
26 |
- |
|
27 |
-# don't rebuild if the differences are covered by NOREBUILD_DEFS or |
|
28 |
-# NOREBUILD_INCLUDES |
|
29 |
-ifneq ($(strip $(filter-out $(NOREBUILD_DEFS),\ |
|
30 |
- $(C_DEFS) $(DEFS))),$(strip $(CFG_DEFS))) |
|
31 |
-#$(warning different defs: <$(strip $(C_DEFS) $(DEFS))> != ) |
|
32 |
-#$(warning : <$(strip $(CFG_DEFS))>) |
|
33 |
-$(shell rm -f makecfg.lst) |
|
34 |
-endif |
|
35 |
-ifneq ($(strip $(filter-out $(NOREBUILD_INCLUDES),\ |
|
36 |
- $(C_INCLUDES) $(INCLUDES))),$(strip $(CFG_INCLUDES))) |
|
37 |
-$(shell rm -f makecfg.lst) |
|
38 |
-endif |
|
39 |
-endif |
|
40 |
- |
|
41 |
-ALLDEP+=makecfg.lst |
|
42 |
- |
|
43 |
-# returns current type: "" core/unknown, "M" module, "L" libray, "U" util |
|
44 |
-crt_type=$(if $(MOD_NAME),M,$(if $(LIB_NAME),L,$(if $(UTIL_NAME),U))) |
|
45 |
- |
|
46 |
-cmd_CC=$(CC) $(CFLAGS) $(C_INCLUDES) $(INCLUDES) $(C_DEFS) $(DEFS) -c $< -o $@ |
|
47 |
-cmd_LD=$(LD) $(LDFLAGS) $(objs) $(extra_objs) $(ALL_LIBS) $(SER_RPATH) \ |
|
48 |
- -o $(NAME) |
|
49 |
- |
|
50 |
-ifeq (,$(CC_MKDEP_OPTS)) |
|
51 |
-# if CCC_MKDEP_OPTS is empty => CC cannot generate dependencies on the fly |
|
52 |
-cmd_MKDEP=$(MKDEP) $(filter -D% -I%,$(CFLAGS)) $(C_INCLUDES) $(INCLUDES) \ |
|
53 |
- $(C_DEFS) $(DEFS) $< \ |
|
54 |
- | sed -e 's/\#.*//' -e '/:[ ]*$$/d' -e '/^[ ]*$$/d' \ |
|
55 |
- -e 's|.*:|$@: $$(wildcard |' -e 's/\([^\\]\)$$/\1)/'> $*.d |
|
56 |
-else |
|
57 |
-# deps can be generated on the fly by cmd_CC |
|
58 |
-cmd_CC+=$(CC_MKDEP_OPTS) |
|
59 |
-# no MKDEP command any more |
|
60 |
-cmd_MKDEP= |
|
61 |
-endif # CC_MKDEP_OPTS |
|
62 |
- |
|
63 |
-# what will be displayed if quiet==silent |
|
64 |
-silent_cmd_CC=CC ($(CC)) [$(strip $(crt_type) $(NAME))] $@ |
|
65 |
-silent_cmd_LD=LD ($(LD)) [$(strip $(crt_type) $(NAME))] $@ |
|
66 |
- |
|
67 |
-ifneq (,$(filter 0 no off verbose noisy, $(Q) $(QUIET))) |
|
68 |
-override Q:= |
|
69 |
-quiet=verbose |
|
70 |
-#shell optional print |
|
71 |
-oecho=echo $(1) |
|
72 |
-else |
|
73 |
-quiet=silent |
|
74 |
-Q=1 |
|
75 |
-MAKE+= --no-print-directory |
|
76 |
-#shell optional print |
|
77 |
-oecho= |
|
78 |
-endif |
|
79 |
- |
|
80 |
-module_make= if [ -n "$(1)" -a -r "$(1)/Makefile" ]; then \ |
|
81 |
- $(call oecho, "" ;) \ |
|
82 |
- $(call oecho, "" ;) \ |
|
83 |
- if $$(MAKE) -C $(1) $(2) || [ ${err_fail} != 1 ] ; then \ |
|
84 |
- :; \ |
|
85 |
- else \ |
|
86 |
- exit 1; \ |
|
87 |
- fi ; \ |
|
88 |
- fi ; |
|
89 |
- |
|
90 |
-quote:= " |
|
91 |
-escall= $(subst $$,\$$,$(subst $(quote),\$(quote),$1)) |
|
92 |
-exec_cmd= $(if $($(quiet)_cmd_$(1)),\ |
|
93 |
- @echo "$(call escall,$($(quiet)_cmd_$(1)))" ;) $(cmd_$(1)) |
|
94 |
- |
|
95 |
-#implicit rules |
|
96 |
-%.o:%.c $(ALLDEP) |
|
97 |
- $(call exec_cmd,CC) |
|
98 |
- @$(call cmd_MKDEP) |
|
99 |
- |
|
100 |
-# use RPATH and SER_LIBS if needed (make install and the module depends |
|
101 |
-# on some ser libs) |
|
102 |
- |
|
103 |
-ifneq ($(SER_LIBS),) |
|
104 |
-# abspath & realpath don't work on make <= 3.80 |
|
105 |
-SER_LIBS_DIRS:=$(dir $(SER_LIBS)) |
|
106 |
-ifneq (,$(filter install install% %install, $(MAKECMDGOALS))) |
|
107 |
-lib_compile_for_install=yes |
|
108 |
-expected_lib_ipath=$(lib_target) |
|
109 |
-else |
|
110 |
-lib_compile_for_install=$(compile_for_install) |
|
111 |
-# function: expected_lib_ipath ser_lib_dir |
|
112 |
-expected_lib_ipath=$(1) |
|
113 |
-endif |
|
114 |
-ifneq ($(LD_RPATH),) |
|
115 |
-ifneq (,$(filter install install% %install, $(MAKECMDGOALS))) |
|
116 |
-SER_RPATH_LST:=$(lib_target) |
|
117 |
-else |
|
118 |
-# realpath is not supported in make 3.80 or older |
|
119 |
-ifeq (,$(filter-out 3.80 3.80.%,$(MAKE_VERSION))) |
|
120 |
-fullpath=$(shell cd $(1); pwd) |
|
121 |
-else |
|
122 |
-fullpath=$(realpath $(1)) |
|
123 |
-endif |
|
124 |
- |
|
125 |
-SER_RPATH_LST:=$(call fullpath,$(dir $(SER_LIBS))) |
|
126 |
-endif |
|
127 |
-ifneq ($(strip $(SER_RPATH_LST)),) |
|
128 |
-SER_RPATH:=$(addprefix $(LD_RPATH),$(SER_RPATH_LST)) |
|
129 |
-endif |
|
130 |
-endif |
|
131 |
-ifeq ($(OS), darwin) |
|
132 |
-SER_IPATH_LST:=$(addsuffix /libiname.lst,$(SER_LIBS_DIRS)) |
|
133 |
-#$(warning $(NAME) DARWIN, SER_LIBS=$(SER_LIBS), $(SER_LIBS_DIRS), ipath_lst=$(SER_IPATH_LST)) |
|
134 |
-endif |
|
135 |
-endif |
|
136 |
- |
|
137 |
-ALL_LIBS=$(LIBS) |
|
138 |
- |
|
139 |
-ifeq (,$(filter clean %clean clean% proper %proper proper%, $(MAKECMDGOALS))) |
|
140 |
-ifneq ($(SER_LIBS),) |
|
141 |
--include librpath.lst |
|
142 |
-ifneq ($(SER_RPATH_LST), $(LIB_RPATH_LST)) |
|
143 |
-$(shell rm -f librpath.lst) |
|
144 |
-endif |
|
145 |
-endif |
|
146 |
- |
|
147 |
-SER_LIBS_DEPS:= \ |
|
148 |
- $(foreach l, $(SER_LIBS), $(dir $l)$(LIB_PREFIX)$(notdir $l)$(LIB_SUFFIX)) |
|
149 |
-ALL_LIBS+=$(foreach l, $(SER_LIBS), -L$(dir $l) -l$(notdir $l)) |
|
150 |
- |
|
151 |
-$(NAME): librpath.lst $(SER_LIBS_DEPS) |
|
152 |
- |
|
153 |
-$(SER_LIBS_DEPS): FORCE |
|
154 |
- @$(MAKE) -wC $(dir $@) compile_for_install=$(lib_compile_for_install) \ |
|
155 |
- NOREBUILD_DEFS="$(NOREBUILD_DEFS) $(LIB_NOREBUILD_DEFS)" \ |
|
156 |
- NOREBUILD_INCLUDES="$(NOREBUILD_INCLUDES) $(LIB_NOREBUILD_INCLUDES)" |
|
157 |
- |
|
158 |
-.PHONY: FORCE |
|
159 |
-FORCE: |
|
160 |
- |
|
161 |
-ifneq ($(SER_IPATH_LST),) |
|
162 |
- |
|
163 |
-$(NAME): $(SER_IPATH_LST) |
|
164 |
- |
|
165 |
-$(SER_IPATH_LST): FORCE |
|
166 |
- @if grep \ |
|
167 |
- "COMPILED_INAME:=$(call expected_lib_ipath,$(shell cd $(@D); pwd))" \ |
|
168 |
- $(@) 1>/dev/null 2>/dev/null ; \ |
|
169 |
- then :; \ |
|
170 |
- else \ |
|
171 |
- $(call oecho,"re-building $(@D)" ;) \ |
|
172 |
- $(MAKE) -wC $(@D) compile_for_install=$(lib_compile_for_install) ; \ |
|
173 |
- fi |
|
174 |
- |
|
175 |
-.PHONY: FORCE-BUILD-LIBS |
|
176 |
-FORCE-BUILD-LIBS: |
|
177 |
- @for r in $(SER_LIBS_DIRS) ; do \ |
|
178 |
- $(call oecho,building lib $$r ;) \ |
|
179 |
- $(MAKE) -wC $$r compile_for_install=$(lib_compile_for_install) ; \ |
|
180 |
- done |
|
181 |
- |
|
182 |
-endif |
|
183 |
- |
|
184 |
-endif |
|
185 |
- |
|
186 |
-# normal rules |
|
187 |
-$(NAME): $(objs) $(ALLDEP) |
|
188 |
- $(call exec_cmd,LD) |
|
189 |
- |
|
190 |
- |
|
191 |
-librpath.lst: $(ALLDEP) |
|
192 |
- @echo LIB_RPATH_LST:=$(SER_RPATH_LST) >librpath.lst |
|
193 |
- |
|
194 |
-makecfg.lst: |
|
195 |
- @echo "CFG_DEFS:=$(call escall,$(strip \ |
|
196 |
- $(filter-out $(NOREBUILD_DEFS), $(C_DEFS) $(DEFS))))" >>$@ |
|
197 |
- @echo "CFG_INCLUDES:=$(call escall,$(strip \ |
|
198 |
- $(filter-out $(NOREBUILD_INCLUDES),\ |
|
199 |
- $(C_INCLUDES) $(INCLUDES))))" >>$@ |
|
200 |
-.PHONY: all |
|
201 |
-all: $(NAME) every-module |
|
202 |
- |
|
203 |
-.PHONY: static |
|
204 |
-static: $(objs) |
|
205 |
- |
|
206 |
-# clean only the current directory (no modules or utils) |
|
207 |
-# (it's usefull to have it separated from clean for speeding up make proper) |
|
208 |
-.PHONY: local-clean |
|
209 |
-local-clean: |
|
210 |
- -@rm -f $(objs) $(NAME) $(objs:.o=.il) librpath.lst 2>/dev/null |
|
211 |
- |
|
212 |
-.PHONY: clean |
|
213 |
-clean: local-clean |
|
214 |
- |
|
215 |
-.PHONY: clean-modules |
|
216 |
-clean-modules: |
|
217 |
- -@for r in $(cmodules) $(static_modules_path) "" ; do \ |
|
218 |
- if [ -d "$$r" ]; then \ |
|
219 |
- $(call oecho,"module $$r" ;) \ |
|
220 |
- $(MAKE) -C "$$r" clean ; \ |
|
221 |
- [ -r "$$r"/doc/Makefile ] && $(MAKE) -C "$$r"/doc clean ; \ |
|
222 |
- fi ; \ |
|
223 |
- done |
|
224 |
- |
|
225 |
-# make proper for the local directory |
|
226 |
-.PHONY: proper |
|
227 |
-.PHONY: distclean |
|
228 |
-.PHONY: realclean |
|
229 |
-.PHONY: maintainer-clean |
|
230 |
-proper distclean realclean maintainer-clean: local-clean |
|
231 |
- -@rm -f $(depends) $(auto_gen) $(auto_gen_others) $(auto_gen_keep) \ |
|
232 |
- makecfg.lst 2>/dev/null |
|
233 |
- |
|
234 |
-maintainer-clean: clean-tmp |
|
235 |
- |
|
236 |
-.PHONY: proper-modules |
|
237 |
-.PHONY: distclean-modules |
|
238 |
-.PHONY: realclean-modules |
|
239 |
-.PHONY: maintainer-clean-modules |
|
240 |
-proper-modules realclean-modules distclean-modules maintainer-clean-modules: \ |
|
241 |
- clean_target=$(patsubst %-modules,%,$@) |
|
242 |
-proper-modules realclean-modules distclean-modules maintainer-clean-modules: |
|
243 |
- -@for r in $(cmodules) "" ; do \ |
|
244 |
- if [ -d "$$r" ]; then \ |
|
245 |
- $(MAKE) -C "$$r" $(clean_target); \ |
|
246 |
- [ -r "$$r"/doc/Makefile ] && $(MAKE) -C "$$r"/doc $(clean_target);\ |
|
247 |
- fi ; \ |
|
248 |
- done |
|
249 |
- |
|
250 |
-.PHONY: clean-tmp |
|
251 |
-clean-tmp: |
|
252 |
- -@rm -f TAGS tags *.dbg .*.swp |
|
253 |
- |
|
254 |
- |
|
255 |
-.PHONY: doxygen |
|
256 |
-doxygen: |
|
257 |
- -@mkdir -p $(doxygen_dir) |
|
258 |
- -@echo "Create Doxygen documentation" |
|
259 |
- # disable call graphes, because of the DOT dependencies |
|
260 |
- (cat ./$(COREPATH)/doc/doxygen/ser.doxygen; \ |
|
261 |
- echo "HAVE_DOT=no" ;\ |
|
262 |
- echo "PROJECT_NAME=SIP-ROUTER" ;\ |
|
263 |
- echo "PROJECT_NUMBER=$(NAME)-$(RELEASE)" )| doxygen - |
|
264 |
- -@echo "Doxygen documentation created" |
|
265 |
- |
|
266 |
-.PHONY: clean_doxygen |
|
267 |
-clean_doxygen: |
|
268 |
- -@rm -rf $(doxygen_dir)/{xml,man,rtf,latex,html} |
|
269 |
- -@rmdir --ignore-fail-on-non-empty -p $(doxygen_dir) || true |
|
270 |
- |
|
271 |
- |
|
272 |
-.PHONY: TAGS |
|
273 |
-.PHONY: tags |
|
274 |
-TAGS tags: |
|
275 |
- $(MKTAGS) --exclude="obsolete/*" --exclude="test/*" -R . |
|
276 |
- |
|
277 |
-.PHONY: TAGS-ALL |
|
278 |
-.PHONY: tags-all |
|
279 |
-TAGS-ALL tags-all: |
|
280 |
- $(MKTAGS) -R . |
|
281 |
- |
|
282 |
- |
|
283 |
- |
|
284 |
-ifeq (,$(MAKECMDGOALS)) |
|
285 |
--include $(depends) |
|
286 |
-else |
|
287 |
-ifeq (,$(strip $(nodep_targets))) |
|
288 |
-include $(COREPATH)/Makefile.targets |
|
289 |
-endif |
|
290 |
-ifneq (,$(filter-out $(nodep_targets),$(MAKECMDGOALS))) |
|
291 |
--include $(depends) |
|
292 |
-endif |
|
293 |
-endif # ifeq (,$(MAKECMDGOALS)) |
... | ... |
@@ -270,11 +270,13 @@ clean_doxygen: |
270 | 270 |
|
271 | 271 |
|
272 | 272 |
.PHONY: TAGS |
273 |
-TAGS: |
|
273 |
+.PHONY: tags |
|
274 |
+TAGS tags: |
|
274 | 275 |
$(MKTAGS) --exclude="obsolete/*" -R . |
275 | 276 |
|
276 | 277 |
.PHONY: TAGS-ALL |
277 |
-TAGS-ALL: |
|
278 |
+.PHONY: tags-all |
|
279 |
+TAGS-ALL tags-all: |
|
278 | 280 |
$(MKTAGS) -R . |
279 | 281 |
|
280 | 282 |
|
... | ... |
@@ -1,6 +1,4 @@ |
1 |
-# |
|
2 |
-# $Id$ |
|
3 |
-# |
|
1 |
+# Kamailio build system |
|
4 | 2 |
# |
5 | 3 |
# common Makefile rules, included by main Makefile & the modules |
6 | 4 |
# |
... | ... |
@@ -15,21 +13,6 @@ |
15 | 13 |
# built if necessary. Format: path/shortname, where shortname is the |
16 | 14 |
# name passed to -l (e.g. for libprint.so the shortname is print) |
17 | 15 |
# |
18 |
-# History: |
|
19 |
-# -------- |
|
20 |
-# 2007-03-29 set rpath differently for make install |
|
21 |
-# automatically build listed SER_LIBS if needed (andrei) |
|
22 |
-# 2008-06-23 automatically rebuild if make time defines or includes |
|
23 |
-# changed (via makecfg.lst) |
|
24 |
-# 2009-03-10 support for C_DEFS and C_INCLUDES (DEFS and INCLUDES are now |
|
25 |
-# used only for "temporary" defines/includes inside modules or |
|
26 |
-# libs, C_DEFS and C_INCLUDES are used for the common stuff) |
|
27 |
-# (andrei) |
|
28 |
-# 2010-03-09 generate dependencies when compiling .o instead of on |
|
29 |
-# include .d and fix build errors when a .h is moved |
|
30 |
-# support for using MKDEP="makedepend-f-" (andrei) |
|
31 |
-# 2010-03-10 support for on the-fly dependency generation (while compiling, |
|
32 |
-# see CC_MKDEP_OPTS) (andrei) |
|
33 | 16 |
|
34 | 17 |
|
35 | 18 |
# check if the saved cfg corresponds with the current one |
- use make TAGS-ALL to include all the folders
... | ... |
@@ -288,10 +288,14 @@ clean_doxygen: |
288 | 288 |
|
289 | 289 |
.PHONY: TAGS |
290 | 290 |
TAGS: |
291 |
- $(MKTAGS) |
|
292 |
- |
|
293 |
- |
|
294 |
- |
|
291 |
+ $(MKTAGS) --exclude="obsolete/*" -R . |
|
292 |
+ |
|
293 |
+.PHONY: TAGS-ALL |
|
294 |
+TAGS-ALL: |
|
295 |
+ $(MKTAGS) -R . |
|
296 |
+ |
|
297 |
+ |
|
298 |
+ |
|
295 | 299 |
ifeq (,$(MAKECMDGOALS)) |
296 | 300 |
-include $(depends) |
297 | 301 |
else |
Quiet output is used now by default. For verbose output one can
either add Q=0 /Q=no/ Q=verbose to the make command line
(e.g. make Q=verbose all) or for a more permanent solution one can
run make config with Q set (e.g. make config Q=0).
... | ... |
@@ -81,17 +81,17 @@ endif # CC_MKDEP_OPTS |
81 | 81 |
silent_cmd_CC=CC ($(CC)) [$(strip $(crt_type) $(NAME))] $@ |
82 | 82 |
silent_cmd_LD=LD ($(LD)) [$(strip $(crt_type) $(NAME))] $@ |
83 | 83 |
|
84 |
-ifneq (,$(filter 1 yes on, $(Q) $(QUIET))) |
|
84 |
+ifneq (,$(filter 0 no off verbose noisy, $(Q) $(QUIET))) |
|
85 |
+override Q:= |
|
86 |
+quiet=verbose |
|
87 |
+#shell optional print |
|
88 |
+oecho=echo $(1) |
|
89 |
+else |
|
85 | 90 |
quiet=silent |
86 | 91 |
Q=1 |
87 | 92 |
MAKE+= --no-print-directory |
88 | 93 |
#shell optional print |
89 | 94 |
oecho= |
90 |
-else |
|
91 |
-override Q:= |
|
92 |
-quiet=verbose |
|
93 |
-#shell optional print |
|
94 |
-oecho=echo $(1) |
|
95 | 95 |
endif |
96 | 96 |
|
97 | 97 |
module_make= if [ -n "$(1)" -a -r "$(1)/Makefile" ]; then \ |
- support on-the-fly dependency file generation with gcc >=3.0
(the dependency files are generated while compiling the object
file, eliminating another gcc+sed invocation)
- support for using makedepend -f- for generating dependencies
E.g.: make cfg MKDEP="makedepend -f-". In general gcc should be
preferred if available (use this if you don't have gcc and your
compiler doesn't generate good deps).
... | ... |
@@ -25,6 +25,11 @@ |
25 | 25 |
# used only for "temporary" defines/includes inside modules or |
26 | 26 |
# libs, C_DEFS and C_INCLUDES are used for the common stuff) |
27 | 27 |
# (andrei) |
28 |
+# 2010-03-09 generate dependencies when compiling .o instead of on |
|
29 |
+# include .d and fix build errors when a .h is moved |
|
30 |
+# support for using MKDEP="makedepend-f-" (andrei) |
|
31 |
+# 2010-03-10 support for on the-fly dependency generation (while compiling, |
|
32 |
+# see CC_MKDEP_OPTS) (andrei) |
|
28 | 33 |
|
29 | 34 |
|
30 | 35 |
# check if the saved cfg corresponds with the current one |
... | ... |
@@ -59,6 +64,19 @@ cmd_CC=$(CC) $(CFLAGS) $(C_INCLUDES) $(INCLUDES) $(C_DEFS) $(DEFS) -c $< -o $@ |
59 | 64 |
cmd_LD=$(LD) $(LDFLAGS) $(objs) $(extra_objs) $(ALL_LIBS) $(SER_RPATH) \ |
60 | 65 |
-o $(NAME) |
61 | 66 |
|
67 |
+ifeq (,$(CC_MKDEP_OPTS)) |
|
68 |
+# if CCC_MKDEP_OPTS is empty => CC cannot generate dependencies on the fly |
|
69 |
+cmd_MKDEP=$(MKDEP) $(filter -D% -I%,$(CFLAGS)) $(C_INCLUDES) $(INCLUDES) \ |
|
70 |
+ $(C_DEFS) $(DEFS) $< \ |
|
71 |
+ | sed -e 's/\#.*//' -e '/:[ ]*$$/d' -e '/^[ ]*$$/d' \ |
|
72 |
+ -e 's|.*:|$@: $$(wildcard |' -e 's/\([^\\]\)$$/\1)/'> $*.d |
|
73 |
+else |
|
74 |
+# deps can be generated on the fly by cmd_CC |
|
75 |
+cmd_CC+=$(CC_MKDEP_OPTS) |
|
76 |
+# no MKDEP command any more |
|
77 |
+cmd_MKDEP= |
|
78 |
+endif # CC_MKDEP_OPTS |
|
79 |
+ |
|
62 | 80 |
# what will be displayed if quiet==silent |
63 | 81 |
silent_cmd_CC=CC ($(CC)) [$(strip $(crt_type) $(NAME))] $@ |
64 | 82 |
silent_cmd_LD=LD ($(LD)) [$(strip $(crt_type) $(NAME))] $@ |
... | ... |
@@ -94,9 +112,7 @@ exec_cmd= $(if $($(quiet)_cmd_$(1)),\ |
94 | 112 |
#implicit rules |
95 | 113 |
%.o:%.c $(ALLDEP) |
96 | 114 |
$(call exec_cmd,CC) |
97 |
- @$(MKDEP) $(CFLAGS) $(C_INCLUDES) $(INCLUDES) $(C_DEFS) $(DEFS) $< \ |
|
98 |
- | sed -e 's/#.*//' -e '/:[ ]*$$/d' -e '/^[ ]*$$/d' \ |
|
99 |
- -e 's#.*:#$@: $$(wildcard #g' -e 's/\([^\\]\)$$/\1)/'> $*.d |
|
115 |
+ @$(call cmd_MKDEP) |
|
100 | 116 |
|
101 | 117 |
# use RPATH and SER_LIBS if needed (make install and the module depends |
102 | 118 |
# on some ser libs) |
- fix for make failing if the depends were made and a *.h is moved
or deleted
- avoid restarting make when depends change (make the depends at
the same moment when the .o are generated)
... | ... |
@@ -94,11 +94,9 @@ exec_cmd= $(if $($(quiet)_cmd_$(1)),\ |
94 | 94 |
#implicit rules |
95 | 95 |
%.o:%.c $(ALLDEP) |
96 | 96 |
$(call exec_cmd,CC) |
97 |
- |
|
98 |
-%.d: %.c $(ALLDEP) |
|
99 |
- @set -e; $(MKDEP) $(CFLAGS) $(C_INCLUDES) $(INCLUDES) $(C_DEFS) $(DEFS) $<\ |
|
100 |
- | sed 's#\(\($(*D)/\)\{0,1\}$(*F)\)\.o[ :]*#$*.o $@ : #g' > $@; \ |
|
101 |
- test -s $@ || ( rm -f $@; false ) |
|
97 |
+ @$(MKDEP) $(CFLAGS) $(C_INCLUDES) $(INCLUDES) $(C_DEFS) $(DEFS) $< \ |
|
98 |
+ | sed -e 's/#.*//' -e '/:[ ]*$$/d' -e '/^[ ]*$$/d' \ |
|
99 |
+ -e 's#.*:#$@: $$(wildcard #g' -e 's/\([^\\]\)$$/\1)/'> $*.d |
|
102 | 100 |
|
103 | 101 |
# use RPATH and SER_LIBS if needed (make install and the module depends |
104 | 102 |
# on some ser libs) |
... | ... |
@@ -203,9 +201,6 @@ makecfg.lst: |
203 | 201 |
.PHONY: all |
204 | 202 |
all: $(NAME) every-module |
205 | 203 |
|
206 |
-.PHONY: dep |
|
207 |
-dep: $(depends) |
|
208 |
- |
|
209 | 204 |
.PHONY: static |
210 | 205 |
static: $(objs) |
211 | 206 |
|
- fixed wrong test for the existence of $(module)/doc/Makefile
... | ... |
@@ -224,7 +224,7 @@ clean-modules: |
224 | 224 |
if [ -d "$$r" ]; then \ |
225 | 225 |
$(call oecho,"module $$r" ;) \ |
226 | 226 |
$(MAKE) -C "$$r" clean ; \ |
227 |
- [ -d "$$r"/doc/Makefile ] && $(MAKE) -C "$$r"/doc clean ; \ |
|
227 |
+ [ -r "$$r"/doc/Makefile ] && $(MAKE) -C "$$r"/doc clean ; \ |
|
228 | 228 |
fi ; \ |
229 | 229 |
done |
230 | 230 |
|
Removed the @for construct (launched a new shell) with a @foreach construct which does a textual expansion
of the block in question (loop unrolling)
... | ... |
@@ -76,6 +76,16 @@ quiet=verbose |
76 | 76 |
oecho=echo $(1) |
77 | 77 |
endif |
78 | 78 |
|
79 |
+module_make= if [ -n "$(1)" -a -r "$(1)/Makefile" ]; then \ |
|
80 |
+ $(call oecho, "" ;) \ |
|
81 |
+ $(call oecho, "" ;) \ |
|
82 |
+ if $$(MAKE) -C $(1) $(2) || [ ${err_fail} != 1 ] ; then \ |
|
83 |
+ :; \ |
|
84 |
+ else \ |
|
85 |
+ exit 1; \ |
|
86 |
+ fi ; \ |
|
87 |
+ fi ; |
|
88 |
+ |
|
79 | 89 |
quote:= " |
80 | 90 |
escall= $(subst $$,\$$,$(subst $(quote),\$(quote),$1)) |
81 | 91 |
exec_cmd= $(if $($(quiet)_cmd_$(1)),\ |
latest sr_3.0 fixes, after kamailio 3.0 release.
* origin/sr_3.0: (58 commits)
Backport of the changes (see previous commits).
kex: documented missing functions
kex: aliased avp_printf to pv_printf
auth_diameter(k): remove redundant declaration of find_credentials, now in core
- fix bug in encode_contact()
- fix bug when RURI was changed before and newuri will be used
- remove unused code
modules_k/nathelper: removed garbage from documentation (credits to Klaus)
modules_k/nathelper: improved handle_ruri_alias() documentation
modules/lcr and modules_k/nathelper: fixed compiler warnings
modules_k/nathelper: handle_uri_alias() alias handling fix
modules_k/usrloc: changed 'Kamailio' to 'SIP Router' in user agent string.
tm: safer handling for local transactions and drop_replies!=0
sctp: stats: don't increment ASSOC_SHUTDOWN on COMM_LOST
sctp: SCTP_STATS_ASSOC_SHUTDOWN
tm doc: local_ack_mode documentation
tm: new param: local_ack_mode
makefile: fix make bin & basedir
core: fix parsing for avps with the same name as a pv class
tls: name the certificates based on $MAIN_NAME
...
Conflicts:
modules/tm/README
modules_k/nathelper/rtpproxy_stream.c
pkg/debian/rules
- clean-utils and proper-utils now work both from the main
directory (for utils compiled by make utils or installed by make
install-utils) and from the modules directories (for utils
installed by a module)
- make utils now works in module directories (compiles utils that
would be installed by the module)
... | ... |
@@ -218,16 +218,6 @@ clean-modules: |
218 | 218 |
fi ; \ |
219 | 219 |
done |
220 | 220 |
|
221 |
-.PHONY: clean-utils |
|
222 |
-clean-utils: |
|
223 |
- @if [ -n "$(cmodules)" ]; then \ |
|
224 |
- for r in $(utils_compile) "" ; do \ |
|
225 |
- if [ -d "$$r" ]; then \ |
|
226 |
- $(MAKE) -C "$$r" clean ; \ |
|
227 |
- fi ; \ |
|
228 |
- done \ |
|
229 |
- fi |
|
230 |
- |
|
231 | 221 |
# make proper for the local directory |
232 | 222 |
.PHONY: proper |
233 | 223 |
.PHONY: distclean |
... | ... |
@@ -253,21 +243,6 @@ proper-modules realclean-modules distclean-modules maintainer-clean-modules: |
253 | 243 |
fi ; \ |
254 | 244 |
done |
255 | 245 |
|
256 |
-.PHONY: proper-utils |
|
257 |
-.PHONY: distclean-utils |
|
258 |
-.PHONY: realclean-utils |
|
259 |
-.PHONY: maintainer-clean-utils |
|
260 |
-proper-utils realclean-utils distclean-utils maintainer-clean-utils: \ |
|
261 |
- clean_target=$(patsubst %-utils,%,$@) |
|
262 |
-proper-utils realclean-utils distclean-utils maintainer-clean-utils: |
|
263 |
- @if [ -n "$(cmodules)" ]; then \ |
|
264 |
- for r in $(utils_compile) "" ; do \ |
|
265 |
- if [ -d "$$r" ]; then \ |
|
266 |
- $(MAKE) -C "$$r" $(clean_target); \ |
|
267 |
- fi ; \ |
|
268 |
- done \ |
|
269 |
- fi |
|
270 |
- |
|
271 | 246 |
.PHONY: clean-tmp |
272 | 247 |
clean-tmp: |
273 | 248 |
-@rm -f TAGS tags *.dbg .*.swp |
... | ... |
@@ -280,6 +280,7 @@ doxygen: |
280 | 280 |
# disable call graphes, because of the DOT dependencies |
281 | 281 |
(cat ./$(COREPATH)/doc/doxygen/ser.doxygen; \ |
282 | 282 |
echo "HAVE_DOT=no" ;\ |
283 |
+ echo "PROJECT_NAME=SIP-ROUTER" ;\ |
|
283 | 284 |
echo "PROJECT_NUMBER=$(NAME)-$(RELEASE)" )| doxygen - |
284 | 285 |
-@echo "Doxygen documentation created" |
285 | 286 |
|
... | ... |
@@ -276,8 +276,12 @@ clean-tmp: |
276 | 276 |
.PHONY: doxygen |
277 | 277 |
doxygen: |
278 | 278 |
-@mkdir -p $(doxygen_dir) |
279 |
- doxygen ./$(COREPATH)/doc/doxygen/ser.doxygen |
|
280 |
- |
|
279 |
+ -@echo "Create Doxygen documentation" |
|
280 |
+ # disable call graphes, because of the DOT dependencies |
|
281 |
+ (cat ./$(COREPATH)/doc/doxygen/ser.doxygen; \ |
|
282 |
+ echo "HAVE_DOT=no" ;\ |
|
283 |
+ echo "PROJECT_NUMBER=$(NAME)-$(RELEASE)" )| doxygen - |
|
284 |
+ -@echo "Doxygen documentation created" |
|
281 | 285 |
|
282 | 286 |
.PHONY: clean_doxygen |
283 | 287 |
clean_doxygen: |
- better escaping when saving the current DEFS and INCLUDES
... | ... |
@@ -40,7 +40,7 @@ LIB_NOREBUILD_DEFS= |
40 | 40 |
# NOREBUILD_INCLUDES |
41 | 41 |
ifneq ($(strip $(filter-out $(NOREBUILD_DEFS),\ |
42 | 42 |
$(C_DEFS) $(DEFS))),$(strip $(CFG_DEFS))) |
43 |
-#$(warning different defs: <$(strip $(DEFS))> != ) |
|
43 |
+#$(warning different defs: <$(strip $(C_DEFS) $(DEFS))> != ) |
|
44 | 44 |
#$(warning : <$(strip $(CFG_DEFS))>) |
45 | 45 |
$(shell rm -f makecfg.lst) |
46 | 46 |
endif |
... | ... |
@@ -77,7 +77,7 @@ oecho=echo $(1) |
77 | 77 |
endif |
78 | 78 |
|
79 | 79 |
quote:= " |
80 |
-escall= $(subst $$,$$$$,$(subst $(quote),\$(quote),$1)) |
|
80 |
+escall= $(subst $$,\$$,$(subst $(quote),\$(quote),$1)) |
|
81 | 81 |
exec_cmd= $(if $($(quiet)_cmd_$(1)),\ |
82 | 82 |
@echo "$(call escall,$($(quiet)_cmd_$(1)))" ;) $(cmd_$(1)) |
83 | 83 |
|
... | ... |
@@ -185,11 +185,11 @@ librpath.lst: $(ALLDEP) |
185 | 185 |
@echo LIB_RPATH_LST:=$(SER_RPATH_LST) >librpath.lst |
186 | 186 |
|
187 | 187 |
makecfg.lst: |
188 |
- @echo CFG_DEFS:=$(subst ',\', $(subst ",\",$(strip \ |
|
189 |
- $(filter-out $(NOREBUILD_DEFS), $(C_DEFS) $(DEFS))))) >>$@ |
|
190 |
- @echo CFG_INCLUDES:=$(subst ',\', $(subst ",\",$(strip \ |
|
188 |
+ @echo "CFG_DEFS:=$(call escall,$(strip \ |
|
189 |
+ $(filter-out $(NOREBUILD_DEFS), $(C_DEFS) $(DEFS))))" >>$@ |
|
190 |
+ @echo "CFG_INCLUDES:=$(call escall,$(strip \ |
|
191 | 191 |
$(filter-out $(NOREBUILD_INCLUDES),\ |
192 |
- $(C_INCLUDES) $(INCLUDES))))) >>$@ |
|
192 |
+ $(C_INCLUDES) $(INCLUDES))))" >>$@ |
|
193 | 193 |
.PHONY: all |
194 | 194 |
all: $(NAME) every-module |
195 | 195 |
|
... | ... |
@@ -66,9 +66,14 @@ silent_cmd_LD=LD ($(LD)) [$(strip $(crt_type) $(NAME))] $@ |
66 | 66 |
ifneq (,$(filter 1 yes on, $(Q) $(QUIET))) |
67 | 67 |
quiet=silent |
68 | 68 |
Q=1 |
69 |
+MAKE+= --no-print-directory |
|
70 |
+#shell optional print |
|
71 |
+oecho= |
|
69 | 72 |
else |
70 |
-Q=0 |
|
73 |
+override Q:= |
|
71 | 74 |
quiet=verbose |
75 |
+#shell optional print |
|
76 |
+oecho=echo $(1) |
|
72 | 77 |
endif |
73 | 78 |
|
74 | 79 |
quote:= " |
... | ... |
@@ -156,14 +161,14 @@ $(SER_IPATH_LST): FORCE |
156 | 161 |
$(@) 1>/dev/null 2>/dev/null ; \ |
157 | 162 |
then :; \ |
158 | 163 |
else \ |
159 |
- echo "re-building $(@D)" ; \ |
|
164 |
+ $(call oecho,"re-building $(@D)" ;) \ |
|
160 | 165 |
$(MAKE) -wC $(@D) compile_for_install=$(lib_compile_for_install) ; \ |
161 | 166 |
fi |
162 | 167 |
|
163 | 168 |
.PHONY: FORCE-BUILD-LIBS |
164 | 169 |
FORCE-BUILD-LIBS: |
165 | 170 |
@for r in $(SER_LIBS_DIRS) ; do \ |
166 |
- echo building lib $$r; \ |
|
171 |
+ $(call oecho,building lib $$r ;) \ |
|
167 | 172 |
$(MAKE) -wC $$r compile_for_install=$(lib_compile_for_install) ; \ |
168 | 173 |
done |
169 | 174 |
|
... | ... |
@@ -207,7 +212,7 @@ clean: local-clean |
207 | 212 |
clean-modules: |
208 | 213 |
-@for r in $(cmodules) $(static_modules_path) "" ; do \ |
209 | 214 |
if [ -d "$$r" ]; then \ |
210 |
- echo "module $$r" ; \ |
|
215 |
+ $(call oecho,"module $$r" ;) \ |
|
211 | 216 |
$(MAKE) -C "$$r" clean ; \ |
212 | 217 |
[ -d "$$r"/doc/Makefile ] && $(MAKE) -C "$$r"/doc clean ; \ |
213 | 218 |
fi ; \ |
Support for quiet output (without all the flags and compile
options): make Q=1 or make QUIET=1.
It can be saved in the config (e.g. make config Q=1) and it can be
overridden any time (e.g. make utils Q=0).
Compilation is a little faster in quiet mode and the same speed as
before in normal mode.
Example module output:
CC (gcc) [M tm.so] uac.o
LD (gcc) [M tm.so] tm.so
Lib example:
LD (gcc) [L libbinrpc.so.0.1] libbinrpc.so.0.1
... | ... |
@@ -52,9 +52,33 @@ endif |
52 | 52 |
|
53 | 53 |
ALLDEP+=makecfg.lst |
54 | 54 |
|
55 |
+# returns current type: "" core/unknown, "M" module, "L" libray, "U" util |
|
56 |
+crt_type=$(if $(MOD_NAME),M,$(if $(LIB_NAME),L,$(if $(UTIL_NAME),U))) |
|
57 |
+ |
|
58 |
+cmd_CC=$(CC) $(CFLAGS) $(C_INCLUDES) $(INCLUDES) $(C_DEFS) $(DEFS) -c $< -o $@ |
|
59 |
+cmd_LD=$(LD) $(LDFLAGS) $(objs) $(extra_objs) $(ALL_LIBS) $(SER_RPATH) \ |
|
60 |
+ -o $(NAME) |
|
61 |
+ |
|
62 |
+# what will be displayed if quiet==silent |
|
63 |
+silent_cmd_CC=CC ($(CC)) [$(strip $(crt_type) $(NAME))] $@ |
|
64 |
+silent_cmd_LD=LD ($(LD)) [$(strip $(crt_type) $(NAME))] $@ |
|
65 |
+ |
|
66 |
+ifneq (,$(filter 1 yes on, $(Q) $(QUIET))) |
|
67 |
+quiet=silent |
|
68 |
+Q=1 |
|
69 |
+else |
|
70 |
+Q=0 |
|
71 |
+quiet=verbose |
|
72 |
+endif |
|
73 |
+ |
|
74 |
+quote:= " |
|
75 |
+escall= $(subst $$,$$$$,$(subst $(quote),\$(quote),$1)) |
|
76 |
+exec_cmd= $(if $($(quiet)_cmd_$(1)),\ |
|
77 |
+ @echo "$(call escall,$($(quiet)_cmd_$(1)))" ;) $(cmd_$(1)) |
|
78 |
+ |
|
55 | 79 |
#implicit rules |
56 | 80 |
%.o:%.c $(ALLDEP) |
57 |
- $(CC) $(CFLAGS) $(C_INCLUDES) $(INCLUDES) $(C_DEFS) $(DEFS) -c $< -o $@ |
|
81 |
+ $(call exec_cmd,CC) |
|
58 | 82 |
|
59 | 83 |
%.d: %.c $(ALLDEP) |
60 | 84 |
@set -e; $(MKDEP) $(CFLAGS) $(C_INCLUDES) $(INCLUDES) $(C_DEFS) $(DEFS) $<\ |
... | ... |
@@ -149,7 +173,7 @@ endif |
149 | 173 |
|
150 | 174 |
# normal rules |
151 | 175 |
$(NAME): $(objs) $(ALLDEP) |
152 |
- $(LD) $(LDFLAGS) $(objs) $(extra_objs) $(ALL_LIBS) $(SER_RPATH) -o $(NAME) |
|
176 |
+ $(call exec_cmd,LD) |
|
153 | 177 |
|
154 | 178 |
|
155 | 179 |
librpath.lst: $(ALLDEP) |
- main.d and core_cmd.d generation failed on clean sources,
because of missing autover.h
- make tar excludes now .git*, *.swo and includes autover.h
... | ... |
@@ -7,9 +7,9 @@ |
7 | 7 |
|
8 | 8 |
# |
9 | 9 |
# Uses: NAME, ALLDEP, CC, CFLAGS, C_DEFS, DEFS, C_INCLUDES, INCLUDES, LIBS, |
10 |
-# MKDEP, auto_gen, |
|
11 |
-# auto_gen_others, depends, objs, extra_objs, static_modules, |
|
12 |
-# static_modules_path, LD_RPATH |
|
10 |
+# MKDEP, auto_gen, auto_gen_others, auto_gen_keep, |
|
11 |
+# depends, objs, extra_objs, static_modules, static_modules_path, |
|
12 |
+# LD_RPATH |
|
13 | 13 |
# (all this must be defined previously!, see Makefile.defs & Makefile) |
14 | 14 |
# Optional: SER_LIBS - list of ser libraries that will be automatically |
15 | 15 |
# built if necessary. Format: path/shortname, where shortname is the |
... | ... |
@@ -205,7 +205,7 @@ clean-utils: |
205 | 205 |
.PHONY: realclean |
206 | 206 |
.PHONY: maintainer-clean |
207 | 207 |
proper distclean realclean maintainer-clean: local-clean |
208 |
- -@rm -f $(depends) $(auto_gen) $(auto_gen_others) \ |
|
208 |
+ -@rm -f $(depends) $(auto_gen) $(auto_gen_others) $(auto_gen_keep) \ |
|
209 | 209 |
makecfg.lst 2>/dev/null |
210 | 210 |
|
211 | 211 |
maintainer-clean: clean-tmp |
* commit 'origin/ser_core_cvs':
tcp: added missing blacklist on write pollerr
makefiles: minor fix (use COREPATH in Makefile.targets)
makefile: config and modules.lst minor fixes
makefile.doc: support all targets and dep. fixes
doc (INSTALL): minor make update
makefiles: fixes and speed-ups
makefiles: typo fixed
Conflicts:
Makefile.doc
Makefile.rules
Makefile.targets
... | ... |
@@ -254,7 +254,7 @@ ifeq (,$(MAKECMDGOALS)) |
254 | 254 |
-include $(depends) |
255 | 255 |
else |
256 | 256 |
ifeq (,$(strip $(nodep_targets))) |
257 |
-include Makefile.targets |
|
257 |
+include $(COREPATH)/Makefile.targets |
|
258 | 258 |
endif |
259 | 259 |
ifneq (,$(filter-out $(nodep_targets),$(MAKECMDGOALS))) |
260 | 260 |
-include $(depends) |
- make clean, proper, realclean, distclean and maintainer-clean
will work on all the libs in the lib/ directory.
- clean, proper, realclean, distclean and maintainer-clean targets
split into more specific targets: local-clean, clean-modules,
clean-libs, clean-utils (and the same for the others) => make
proper & friends depend now only on the really needed parts =>
much faster.
- doc directories are entered only if a Makefile is present.
- make maintainer-clean properly deletes the config and the
modules list at the end (it doesn't recreate it).
... | ... |
@@ -158,54 +158,78 @@ dep: $(depends) |
158 | 158 |
.PHONY: static |
159 | 159 |
static: $(objs) |
160 | 160 |
|
161 |
-.PHONY: clean |
|
162 |
-clean: |
|
161 |
+# clean only the current directory (no modules or utils) |
|
162 |
+# (it's usefull to have it separated from clean for speeding up make proper) |
|
163 |
+.PHONY: local-clean |
|
164 |
+local-clean: |
|
163 | 165 |
-@rm -f $(objs) $(NAME) $(objs:.o=.il) librpath.lst 2>/dev/null |
166 |
+ |
|
167 |
+.PHONY: clean |
|
168 |
+clean: local-clean |
|
169 |
+ |
|
170 |
+.PHONY: clean-modules |
|
171 |
+clean-modules: |
|
164 | 172 |
-@for r in $(modules) $(static_modules_path) "" ; do \ |
165 | 173 |
if [ -d "$$r" ]; then \ |
166 | 174 |
echo "module $$r" ; \ |
167 |
- $(MAKE) -C $$r clean ; \ |
|
168 |
- $(MAKE) -C $$r/doc clean ; \ |
|
175 |
+ $(MAKE) -C "$$r" clean ; \ |
|
176 |
+ [ -d "$$r"/doc/Makefile ] && $(MAKE) -C "$$r"/doc clean ; \ |
|
169 | 177 |
fi ; \ |
170 |
- done |
|
178 |
+ done |
|
179 |
+ |
|
180 |
+.PHONY: clean-utils |
|
181 |
+clean-utils: |
|
171 | 182 |
@if [ -n "$(modules)" ]; then \ |
172 | 183 |
for r in $(utils_compile) "" ; do \ |
173 | 184 |
if [ -d "$$r" ]; then \ |
174 |
- $(MAKE) -C $$r clean ; \ |
|
185 |
+ $(MAKE) -C "$$r" clean ; \ |
|
175 | 186 |
fi ; \ |
176 | 187 |
done \ |
177 | 188 |
fi |
178 | 189 |
|
190 |
+# make proper for the local directory |
|
179 | 191 |
.PHONY: proper |
180 | 192 |
.PHONY: distclean |
181 | 193 |
.PHONY: realclean |
182 |
-proper realclean distclean: mrproper |
|
183 |
- |
|
184 |
-mrproper: clean |
|
194 |
+.PHONY: maintainer-clean |
|
195 |
+proper distclean realclean maintainer-clean: local-clean |
|
185 | 196 |
-@rm -f $(depends) $(auto_gen) $(auto_gen_others) \ |
186 | 197 |
makecfg.lst 2>/dev/null |
198 |
+ |
|
199 |
+maintainer-clean: clean-tmp |
|
200 |
+ |
|
201 |
+.PHONY: proper-modules |
|
202 |
+.PHONY: distclean-modules |
|
203 |
+.PHONY: realclean-modules |
|
204 |
+.PHONY: maintainer-clean-modules |
|
205 |
+proper-modules realclean-modules distclean-modules maintainer-clean-modules: \ |
|
206 |
+ clean_target=$(patsubst %-modules,%,$@) |
|
207 |
+proper-modules realclean-modules distclean-modules maintainer-clean-modules: |
|
187 | 208 |
-@for r in $(modules) "" ; do \ |
188 | 209 |
if [ -d "$$r" ]; then \ |
189 |
- $(MAKE) -C $$r proper ; \ |
|
190 |
- $(MAKE) -C $$r/doc proper ; \ |
|
210 |
+ $(MAKE) -C "$$r" $(clean_target); \ |
|
211 |
+ [ -r "$$r"/doc/Makefile ] && $(MAKE) -C "$$r"/doc $(clean_target);\ |
|
191 | 212 |
fi ; \ |
192 |
- done |
|
213 |
+ done |
|
214 |
+ |
|
215 |
+.PHONY: proper-utils |
|
216 |
+.PHONY: distclean-utils |
|
217 |
+.PHONY: realclean-utils |
|
218 |
+.PHONY: maintainer-clean-utils |
|
219 |
+proper-utils realclean-utils distclean-utils maintainer-clean-utils: \ |
|
220 |
+ clean_target=$(patsubst %-utils,%,$@) |
|
221 |
+proper-utils realclean-utils distclean-utils maintainer-clean-utils: |
|
193 | 222 |
@if [ -n "$(modules)" ]; then \ |
194 | 223 |
for r in $(utils_compile) "" ; do \ |
195 | 224 |
if [ -d "$$r" ]; then \ |
196 |
- $(MAKE) -C $$r proper ; \ |
|
225 |
+ $(MAKE) -C "$$r" $(clean_target); \ |
|
197 | 226 |
fi ; \ |
198 | 227 |
done \ |
199 | 228 |
fi |
200 | 229 |
|
201 |
-.PHONY: maintainer-clean |
|
202 |
-maintainer-clean: distclean |
|
203 |
- -rm -f TAGS tags *.dbg .*.swp |
|
204 |
- -@for r in $(modules) "" ; do \ |
|
205 |
- if [ -d "$$r" ]; then \ |
|
206 |
- $(MAKE) -C $$r maintainer-clean; \ |
|
207 |
- fi ; \ |
|
208 |
- done |
|
230 |
+.PHONY: clean-tmp |
|
231 |
+clean-tmp: |
|
232 |
+ -@rm -f TAGS tags *.dbg .*.swp |
|
209 | 233 |
|
210 | 234 |
|
211 | 235 |
.PHONY: doxygen |
s/mantainer/maintainer/
... | ... |
@@ -198,12 +198,12 @@ mrproper: clean |
198 | 198 |
done \ |
199 | 199 |
fi |
200 | 200 |
|
201 |
-.PHONY: mantainer-cleaan |
|
202 |
-mantainer-clean: distclean |
|
201 |
+.PHONY: maintainer-clean |
|
202 |
+maintainer-clean: distclean |
|
203 | 203 |
-rm -f TAGS tags *.dbg .*.swp |
204 | 204 |
-@for r in $(modules) "" ; do \ |
205 | 205 |
if [ -d "$$r" ]; then \ |
206 |
- $(MAKE) -C $$r mantainer-clean; \ |
|
206 |
+ $(MAKE) -C $$r maintainer-clean; \ |
|
207 | 207 |
fi ; \ |
208 | 208 |
done |
209 | 209 |
|
Multiple modules directories are now supported.
The list of the modules directories is in Makefile.dirs in
$(modules_dirs).
Name restrictions: the names must not match any makefile variable name
and they shouldn't contain any '-' char.
The modules and modules doc/READMEs will be installed in separate dirs
(e.g. for modules_dirs="modules modules_s modules_k" , the modules
will be installed in .../lib/ser/modules , ...lib/ser/modules_s
and ...lib/ser/modules_k).
The module man pages will all be installed in the same man dir
(but so far only some ser modules have man pages so we should be
safe).
New make targets:
every-module - make all the modules in all the module dirs
install-every-module - like above, but install
install-every-module-doc
install-every-module-man
Targets dependent on $(modules_dirs) content:
$(m), $(m)-doc, $(m)-readme, $(m)-man, install-$(m),
install-$(m)-doc, install-$(m)-man.
E.g.: for modules_dirs=modules modules_k modules_s
make modules - make all modules in the directory "modules".
make modules_k - make all the modules in the directory modules_k.
make every-module - make all the modules in the directories
modules, modules_k and modules_s.
make install-modules_s - install all the modules in the directory
modules_s.
... | ... |
@@ -162,7 +162,7 @@ makecfg.lst: |
162 | 162 |
$(filter-out $(NOREBUILD_INCLUDES),\ |
163 | 163 |
$(C_INCLUDES) $(INCLUDES))))) >>$@ |
164 | 164 |
.PHONY: all |
165 |
-all: $(NAME) modules |
|
165 |
+all: $(NAME) every-module |
|
166 | 166 |
|
167 | 167 |
.PHONY: dep |
168 | 168 |
dep: $(depends) |
... | ... |
@@ -173,14 +173,14 @@ static: $(objs) |
173 | 173 |
.PHONY: clean |
174 | 174 |
clean: |
175 | 175 |
-@rm -f $(objs) $(NAME) $(objs:.o=.il) librpath.lst 2>/dev/null |
176 |
- -@for r in $(modules) $(static_modules_path) "" ; do \ |
|
176 |
+ -@for r in $(cmodules) $(static_modules_path) "" ; do \ |
|
177 | 177 |
if [ -d "$$r" ]; then \ |
178 | 178 |
echo "module $$r" ; \ |
179 | 179 |
$(MAKE) -C $$r clean ; \ |
180 | 180 |
$(MAKE) -C $$r/doc clean ; \ |
181 | 181 |
fi ; \ |
182 | 182 |
done |
183 |
- @if [ -n "$(modules)" ]; then \ |
|
183 |
+ @if [ -n "$(cmodules)" ]; then \ |
|
184 | 184 |
for r in $(utils_compile) "" ; do \ |
185 | 185 |
if [ -d "$$r" ]; then \ |
186 | 186 |
$(MAKE) -C $$r clean ; \ |
... | ... |
@@ -196,13 +196,13 @@ proper realclean distclean: mrproper |
196 | 196 |
mrproper: clean |
197 | 197 |
-@rm -f $(depends) $(auto_gen) $(auto_gen_others) \ |
198 | 198 |
makecfg.lst 2>/dev/null |
199 |
- -@for r in $(modules) "" ; do \ |
|
199 |
+ -@for r in $(cmodules) "" ; do \ |
|
200 | 200 |
if [ -d "$$r" ]; then \ |
201 | 201 |
$(MAKE) -C $$r proper ; \ |
202 | 202 |
$(MAKE) -C $$r/doc proper ; \ |
203 | 203 |
fi ; \ |
204 | 204 |
done |
205 |
- @if [ -n "$(modules)" ]; then \ |
|
205 |
+ @if [ -n "$(cmodules)" ]; then \ |
|
206 | 206 |
for r in $(utils_compile) "" ; do \ |
207 | 207 |
if [ -d "$$r" ]; then \ |
208 | 208 |
$(MAKE) -C $$r proper ; \ |
... | ... |
@@ -213,7 +213,7 @@ mrproper: clean |
213 | 213 |
.PHONY: mantainer-cleaan |
214 | 214 |
mantainer-clean: distclean |
215 | 215 |
-rm -f TAGS tags *.dbg .*.swp |
216 |
- -@for r in $(modules) "" ; do \ |
|
216 |
+ -@for r in $(cmodules) "" ; do \ |
|
217 | 217 |
if [ -d "$$r" ]; then \ |
218 | 218 |
$(MAKE) -C $$r mantainer-clean; \ |
219 | 219 |
fi ; \ |
* commit 'origin/ser_core_cvs':
Wrapper functions for regcomp, regexec, regfree, and regerror using shared
make: minor optimizations
make: fail if make version < 3.80
make: workaround for make 3.80
make: workaround for backwards compat. with make 3.80
dns: fix selecting neg. cname entry
- if make version is 3.80* replace $(realpath ...) with our own
function (realpath is not supported in 3.80)
... | ... |
@@ -56,7 +56,7 @@ ALLDEP+=makecfg.lst |
56 | 56 |
# on some ser libs) |
57 | 57 |
|
58 | 58 |
ifneq ($(SER_LIBS),) |
59 |
-# abspath & realpath don't seem to work on darwin |
|
59 |
+# abspath & realpath don't work on make <= 3.80 |
|
60 | 60 |
SER_LIBS_DIRS:=$(dir $(SER_LIBS)) |
61 | 61 |
ifneq (,$(filter install install% %install, $(MAKECMDGOALS))) |
62 | 62 |
lib_compile_for_install=yes |
... | ... |
@@ -70,7 +70,14 @@ ifneq ($(LD_RPATH),) |
70 | 70 |
ifneq (,$(filter install install% %install, $(MAKECMDGOALS))) |
71 | 71 |
SER_RPATH_LST:=$(lib_target) |
72 | 72 |
else |
73 |
-SER_RPATH_LST:=$(realpath $(dir $(SER_LIBS))) |
|
73 |
+# realpath is not supported in make 3.80 or older |
|
74 |
+ifeq (,$(filter-out 3.80 3.80.%,$(MAKE_VERSION))) |
|