Browse code

Makefile: use variable for detecting emacs for ctags flag

Daniel-Constantin Mierla authored on 08/01/2020 09:15:26
Showing 1 changed files
... ...
@@ -25,7 +25,7 @@ endif
25 25
 
26 26
 MKTAGS?=ctags
27 27
 EMACS_COMPAT=
28
-ifneq (INSIDE_EMACS,)
28
+ifneq ($(INSIDE_EMACS),)
29 29
 EMACS_COMPAT=-e
30 30
 endif
31 31
 
Browse code

Makefile: include flag to generate Emacs-compatible TAGS file

Emacs exposes an environment variable `INSIDE_EMACS` which can be used
to toggle ctags to generate an Emacs-friendly TAGS file.

James Aimonetti authored on 07/01/2020 23:55:01
Showing 1 changed files
... ...
@@ -24,6 +24,10 @@ endif
24 24
 endif
25 25
 
26 26
 MKTAGS?=ctags
27
+EMACS_COMPAT=
28
+ifneq (INSIDE_EMACS,)
29
+EMACS_COMPAT=-e
30
+endif
27 31
 
28 32
 # forward all named targets
29 33
 %:
... ...
@@ -41,7 +45,7 @@ install:
41 45
 .PHONY: TAGS
42 46
 .PHONY: tags
43 47
 TAGS tags:
44
-	$(MKTAGS) --exclude="misc/*" --exclude="test/*" -R .
48
+	$(MKTAGS) $(EMACS_COMPAT) --exclude="misc/*" --exclude="test/*" -R .
45 49
 
46 50
 # clean everything generated - shortcut on maintainer-clean
47 51
 .PHONY: pure
Browse code

Makefile: give warning when old modules directory is found

Mikko Lehto authored on 13/03/2019 19:14:29
Showing 1 changed files
... ...
@@ -10,6 +10,9 @@ KSR_DIR ?= src/
10 10
 # default target for makefile
11 11
 .DEFAULT_GOAL := default
12 12
 
13
+ifneq ($(wildcard modules),)
14
+$(warning "old Kamailio modules directory found, you should clean that")
15
+endif
13 16
 
14 17
 # strip the src/ from the path to modules
15 18
 SMODPARAM=
Browse code

Makefile: clean and tags target for the root folder

Daniel-Constantin Mierla authored on 13/12/2016 11:48:07
Showing 1 changed files
... ...
@@ -20,6 +20,8 @@ SMODPARAM=modules=$(smodules)
20 20
 endif
21 21
 endif
22 22
 
23
+MKTAGS?=ctags
24
+
23 25
 # forward all named targets
24 26
 %:
25 27
 	$(MAKE) -C $(KSR_DIR) $@ $(SMODPARAM)
... ...
@@ -32,3 +34,16 @@ default:
32 34
 .PHONY: install
33 35
 install:
34 36
 	$(MAKE) -C $(KSR_DIR) $@ $(SMODPARAM)
37
+
38
+.PHONY: TAGS
39
+.PHONY: tags
40
+TAGS tags:
41
+	$(MKTAGS) --exclude="misc/*" --exclude="test/*" -R .
42
+
43
+# clean everything generated - shortcut on maintainer-clean
44
+.PHONY: pure
45
+clean pure distclean:
46
+	@rm -f .*.swp tags TAGS
47
+	$(MAKE) -C $(KSR_DIR) $@
48
+
49
+#
Browse code

Makefile: root - remove src/ if provided in the value of modules variable

Daniel-Constantin Mierla authored on 08/12/2016 17:34:38
Showing 1 changed files
... ...
@@ -3,20 +3,32 @@
3 3
 # - forward all commands to the Makefile in the src/ subfolder
4 4
 #
5 5
 
6
+
6 7
 # path to the source code folder
7 8
 KSR_DIR ?= src/
8 9
 
9 10
 # default target for makefile
10 11
 .DEFAULT_GOAL := default
11 12
 
13
+
14
+# strip the src/ from the path to modules
15
+SMODPARAM=
16
+ifneq ($(modules),)
17
+ifneq (,$(findstring src/,$(modules)))
18
+smodules=$(subst src/,,$(modules))
19
+SMODPARAM=modules=$(smodules)
20
+endif
21
+endif
22
+
12 23
 # forward all named targets
13 24
 %:
14
-	$(MAKE) -C $(KSR_DIR) $@
25
+	$(MAKE) -C $(KSR_DIR) $@ $(SMODPARAM)
15 26
 
16 27
 # forward the default target
17 28
 default:
18 29
 	$(MAKE) -C $(KSR_DIR)
19 30
 
31
+# forward the install target
20 32
 .PHONY: install
21 33
 install:
22
-	$(MAKE) -C $(KSR_DIR) $@
34
+	$(MAKE) -C $(KSR_DIR) $@ $(SMODPARAM)
Browse code

Makefile: root forwarding of target without enclosing in double quotes

Daniel-Constantin Mierla authored on 08/12/2016 15:01:54
Showing 1 changed files
... ...
@@ -11,7 +11,7 @@ KSR_DIR ?= src/
11 11
 
12 12
 # forward all named targets
13 13
 %:
14
-	$(MAKE) -C $(KSR_DIR) "$@"
14
+	$(MAKE) -C $(KSR_DIR) $@
15 15
 
16 16
 # forward the default target
17 17
 default:
... ...
@@ -19,4 +19,4 @@ default:
19 19
 
20 20
 .PHONY: install
21 21
 install:
22
-	$(MAKE) -C $(KSR_DIR) "$@"
22
+	$(MAKE) -C $(KSR_DIR) $@
Browse code

root/Makefile: forward install target to src/

- some OSes match the target with local file INSTALL

Daniel-Constantin Mierla authored on 07/12/2016 13:40:06
Showing 1 changed files
... ...
@@ -16,3 +16,7 @@ KSR_DIR ?= src/
16 16
 # forward the default target
17 17
 default:
18 18
 	$(MAKE) -C $(KSR_DIR)
19
+
20
+.PHONY: install
21
+install:
22
+	$(MAKE) -C $(KSR_DIR) "$@"
Browse code

core: added new root Makefile

- forward make commands to src/ subfolder

Daniel-Constantin Mierla authored on 07/12/2016 11:35:10
Showing 1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,18 @@
1
+#
2
+# Root Makefile for Kamailio project
3
+# - forward all commands to the Makefile in the src/ subfolder
4
+#
5
+
6
+# path to the source code folder
7
+KSR_DIR ?= src/
8
+
9
+# default target for makefile
10
+.DEFAULT_GOAL := default
11
+
12
+# forward all named targets
13
+%:
14
+	$(MAKE) -C $(KSR_DIR) "$@"
15
+
16
+# forward the default target
17
+default:
18
+	$(MAKE) -C $(KSR_DIR)
Browse code

core, lib, modules: restructured source code tree

- 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)

Daniel-Constantin Mierla authored on 07/12/2016 11:03:51
Showing 1 changed files
1 1
deleted file mode 100644
... ...
@@ -1,1067 +0,0 @@
1
-# Kamailio makefile
2
-#
3
-# WARNING: requires gmake (GNU Make)
4
-#  Arch supported: Linux, FreeBSD, SunOS (tested on Solaris 8), OpenBSD (3.2),
5
-#  NetBSD (1.6), OS/X
6
-#
7
-
8
-# check make version
9
-# everything works with 3.80, except evals inside ifeq/endif
10
-# (see https://savannah.gnu.org/bugs/index.php?func=detailitem&item_id=1516).
11
-# recommended 3.81
12
-req_ver=3.81
13
-# the check below works for version number of the type x.yy or x.yy.z*
14
-# (from the GNU Make Cookbook)
15
-ifeq (,$(filter $(req_ver),$(firstword $(sort $(MAKE_VERSION) $(req_ver)))))
16
-$(error make version $(MAKE_VERSION) not supported, use at least $(req_ver))
17
-endif
18
-
19
-
20
-auto_gen=lex.yy.c cfg.tab.c #lexx, yacc etc
21
-auto_gen_others=cfg.tab.h # auto generated, non-c
22
-auto_gen_keep=autover.h # auto generated, should be included in archives
23
-
24
-COREPATH=.
25
-#include  source related defs
26
-include Makefile.sources
27
-#include special targets lists
28
-include Makefile.targets
29
-
30
-# whether or not the entire build process should fail if building a module or
31
-#  an utility fails
32
-err_fail?=1
33
-
34
-# whether or not to install $(MAIN_NAME).cfg or just $(MAIN_NAME).cfg.default
35
-# ($(MAIN_NAME).cfg will never be overwritten by make install, this is usefull
36
-#  when creating packages)
37
-skip_cfg_install?=
38
-
39
-#extra modules to exclude
40
-skip_modules?=
41
-
42
-# see Makefile.dirs for the directories used for the modules
43
-include Makefile.dirs
44
-
45
-# Set document format
46
-# Alternatives are txt, html, xhtml, and pdf (see Makefile.doc)
47
-doc_format?=html
48
-
49
-# don't force modules.lst generation if the makefile goals do not
50
-# require it (but if present use it)
51
-ifeq (,$(strip $(filter-out $(clean_targets) $(aux_targets),$(MAKECMDGOALS))))
52
-ifneq (,$(strip $(wildcard modules.lst)))
53
--include modules.lst
54
-endif
55
-else
56
-include modules.lst
57
-endif # ifneq (,$(strip $(filter-out ...,$(MAKECMDGOALS))))
58
-
59
-#if called with group_include, ignore the modules from modules.lst
60
-ifneq ($(group_include),)
61
-	include_modules=
62
-	exclude_modules=
63
-	modules_configured:=0
64
-endif
65
-
66
-# get the groups of modules to compile
67
-include Makefile.groups
68
-
69
-# - automatically build the list of excluded modules
70
-# if not set on the cmd. line, env or in the modules.lst (cfg_group_include)
71
-# exclude the below modules.
72
-ifneq ($(group_include)$(cfg_group_include),)
73
-	# For group_include, default all modules are excluded except those in
74
-	# include_modules
75
-	exclude_modules?=
76
-else
77
-	# Old defaults for backwards compatibility
78
-	# excluded because they depend on external libraries
79
-ifeq ($(origin exclude_modules), undefined)
80
-	exclude_modules:= $(sort \
81
-				$(filter-out $(module_group_default), $(mod_list_all)))
82
-endif
83
-endif
84
-
85
-# always add skip_modules list - it is done now in modules.lst (dcm)
86
-# override exclude_modules+= $(skip_modules)
87
-
88
-# Test for the groups and add to include_modules
89
-ifneq (,$(group_include))
90
-$(eval override include_modules+= $(foreach grp, $(group_include), \
91
-										$(module_group_$(grp)) ))
92
-endif
93
-
94
-ALLDEP=config.mak Makefile Makefile.dirs Makefile.sources Makefile.rules
95
-
96
-#include general defs (like CC, CFLAGS  a.s.o)
97
-# hack to force makefile.defs re-inclusion (needed when make calls itself with
98
-# other options -- e.g. make bin)
99
-#makefile_defs=0
100
-#C_DEFS:=
101
-
102
-
103
-# try saved cfg, unless we are in the process of building it or if we're doing
104
-# a clean
105
-ifeq (,$(strip \
106
-	$(filter config.mak config cfg cfg-defs $(clean_targets),$(MAKECMDGOALS))))
107
-include config.mak
108
-ifeq ($(makefile_defs),1)
109
-ifeq ($(quiet),verbose)
110
-$(info config.mak loaded)
111
-endif # verbose
112
-export makefile_defs
113
-# config_make valid & used
114
-config_mak=1
115
-ifeq ($(MAIN_NAME),)
116
-$(error "bad config.mak, try re-running make cfg")
117
-endif
118
-endif
119
-else # config.mak doesn't need to be used
120
-ifneq (,$(filter cfg config cfg-defs,$(word 1,$(MAKECMDGOALS))))
121
-# needed here to avoid starting a config submake 
122
-# (e.g. rm -f config.mak; make config.mak), which would either require 
123
-# double Makefile.defs defines execution (suboptimal), would loose
124
-# $(value ...) expansion or would cause some warning (if Makefile.defs exec. 
125
-# is skipped in the "main" makefile invocation).
126
-$(shell rm -rf config.mak)
127
-config_mak=0
128
-makefile_defs=0
129
-exported_vars=0
130
-else
131
-# config.mak not strictly needed, but try to load it if exists for $(Q)
132
-config_mak=skip
133
--include config.mak
134
-export makefile_defs
135
-endif
136
-endif
137
-
138
-
139
-main_makefile=1
140
-include Makefile.defs
141
-
142
-static_modules_path=$(addprefix modules/, $(static_modules))
143
-extra_sources=$(wildcard $(addsuffix /*.c, $(static_modules_path)))
144
-extra_objs=$(extra_sources:.c=.o)
145
-
146
-static_defs:= $(foreach  mod, $(static_modules), \
147
-		-DSTATIC_$(shell echo $(mod) | tr [:lower:] [:upper:]) )
148
-
149
-override extra_defs+=$(static_defs) $(EXTRA_DEFS)
150
-export extra_defs
151
-
152
-# Historically, the resultant set of modules is: modules/* - exclude_modules +
153
-# include_modules
154
-# When group_include is used, we want: include_modules (based on group_include)
155
-# - exclude_modules
156
-
157
-ifneq ($(modules_configured),1) 
158
-#modules_all=$(filter-out modules/CVS,$(wildcard modules/*))
159
-
160
-# create modules*_all vars
161
-$(foreach mods,$(modules_dirs),$(eval \
162
-	$(mods)_all=$$(filter-out $(mods)/CVS,$$(wildcard $(mods)/*))))
163
-#debugging
164
-#$(foreach mods,$(modules_dirs),$(info "$(mods)_all=$($(mods)_all)"))
165
-
166
-ifneq ($(group_include),)
167
-$(foreach mods,$(modules_dirs),$(eval \
168
-	$(mods)=$$(filter-out $$(addprefix $(mods)/, \
169
-			$$(exclude_modules) $$(static_modules)), \
170
-			$$(addprefix $(mods)/, $$(include_modules) )) ))
171
-else	
172
-	# Standard, old resultant set
173
-$(foreach mods,$(modules_dirs),$(eval \
174
-	$(mods)_noinc=$$(filter-out $$(addprefix $(mods)/, \
175
-			$$(exclude_modules) $$(static_modules)), $$($(mods)_all)) \
176
-))
177
-$(foreach mods,$(modules_dirs),$(eval \
178
-	$(mods)=$$(filter-out $$(modules_noinc), \
179
-			$$(addprefix $(mods)/, $$(include_modules) )) $$($(mods)_noinc) \
180
-))
181
-endif # ifneq($(group_include),)
182
-endif # ifneq($(modules_configured),1)
183
-
184
-$(foreach mods,$(modules_dirs),$(eval \
185
-	$(mods)_names=$$(shell echo $$($(mods))| \
186
-				sed -e "s/$(mods)"'\/\([^/ ]*\)\/*/\1.so/g' ) \
187
-))
188
-$(foreach mods,$(modules_dirs),$(eval \
189
-	$(mods)_basenames:=$$(shell echo $$($(mods))| \
190
-				sed -e "s/$(mods)"'\/\([^/ ]*\)\/*/\1/g' ) \
191
-))
192
-
193
-# all modules from all the $(modules_dirs)
194
-all_modules_lst=$(foreach mods,$(modules_dirs), $($(mods)_all))
195
-
196
-# compile modules list (all the compiled mods from  $(modules_dirs))
197
-cmodules=$(foreach mods,$(modules_dirs), $($(mods)))
198
-
199
-#modules_names=$(patsubst modules/%, %.so, $(modules))
200
-#modules_full_path=$(join  $(modules), $(addprefix /, $(modules_names)))
201
-
202
-
203
-
204
-# list of utils directories that should be compiled by make utils
205
-C_COMPILE_UTILS=	utils/kamcmd
206
-# list of binaries that should be installed alongside
207
-# (they should be created after make utils, see C_COMPILE_UTILS)
208
-C_INSTALL_BIN=	# kamcmd is now installed by ctl
209
-
210
-# which utils know to install themselves and should be installed
211
-# along the core (list of utils directories)
212
-ifeq ($(FLAVOUR),kamailio)
213
-C_INSTALL_UTILS= utils/kamctl
214
-else
215
-C_INSTALL_UTILS=
216
-endif
217
-# list of scripts that should be installed along the core 
218
-# (here a script is something that doesn't have a Makefile)
219
-C_INSTALL_SCRIPTS=
220
-# list of extra configs that should be installed along the core
221
-# Note: all the paths of the form /usr/*lib/$(CFG_NAME)/<module_dir>
222
-# will be updated to the directory where the modules will be installed.
223
-C_INSTALL_CFGS=
224
-# list of files that should be installed in the arch-independent 
225
-# directory (by default /usr/local/share/$(MAIN_NAME)))
226
-C_INSTALL_SHARE=
227
-
228
-
229
-
230
-
231
-NAME=$(MAIN_NAME)
232
-
233
-tar_name=$(NAME)-$(RELEASE)_src
234
-
235
-tar_extra_args+=$(addprefix --exclude=$(notdir $(CURDIR))/, \
236
-					$(auto_gen) $(auto_gen_others))
237
-ifeq ($(CORE_TLS), 1)
238
-	tar_extra_args+=
239
-else
240
-	tar_extra_args+=--exclude=$(notdir $(CURDIR))/tls/* 
241
-endif
242
-
243
-ifneq ($(nodeb),)
244
-	tar_extra_args+=--exclude=$(notdir $(CURDIR))/debian 
245
-	tar_name:=$(tar_name)_nodeb
246
-endif
247
-
248
-# sanity checks
249
-ifneq ($(TLS),)
250
-        $(warning "make TLS option is obsoleted, try TLS_HOOKS or CORE_TLS")
251
-endif
252
-
253
-# include the common rules
254
-include Makefile.rules
255
-
256
-#extra targets 
257
-
258
-$(NAME): $(extra_objs) # static_modules
259
-
260
-lex.yy.c: cfg.lex cfg.tab.h $(ALLDEP)
261
-	$(LEX) $<
262
-
263
-cfg.tab.c cfg.tab.h: cfg.y  $(ALLDEP)
264
-	$(YACC) $(YACC_FLAGS) $<
265
-
266
-nullstring=
267
-space=$(nullstring) $(nullstring)
268
-
269
-modules_search_path=$(subst $(space),:,$(strip\
270
-						$(foreach m,$(modules_dirs),$($(m)_target))))
271
-		#				$(addprefix $(modules_target),$(modules_dirs))))
272
-
273
-# special depends for main.o
274
-main.o: DEFS+=-DMODS_DIR='"$(modules_search_path)"'
275
-
276
-
277
-#special depends for ver.c
278
-ver.d ver.o: autover.h
279
-
280
-include Makefile.shared
281
-
282
-ifeq ($(config_mak),1)
283
-
284
-include Makefile.cfg
285
-
286
-# fix basedir path (relative -> absolute)
287
-ifneq (,$(basedir))
288
-ifeq (,$(filter /%, $(basedir)))
289
-override basedir:=$(CURDIR)/$(basedir)
290
-# remove basedir from command line overrides
291
-MAKEOVERRIDES:=$(filter-out basedir=%,$ $(MAKEOVERRIDES))
292
-endif # (,$(filter /%, $(basedir)))
293
-endif # (,$(basedir))
294
-
295
-else ifneq ($(config_mak),skip)
296
-
297
-config.mak: Makefile.defs Makefile.groups
298
-	@echo making config...
299
-	@echo "# this file is autogenerated by make cfg" >$@
300
-	@$(call mapf2,cfg_save_var,saved_fixed_vars,$(@))
301
-	@$(call mapf2,cfg_save_var2,saved_chg_vars,$(@))
302
-	@echo "override makefile_defs:=1" >>$@
303
-	@echo "C_DEFS:=\$$(filter-out \$$(DEFS_RM) \$$(extra_defs),\$$(C_DEFS))" \
304
-					"\$$(extra_defs)"  >>$@
305
-	@echo "CFLAGS:=\$$(filter-out \$$(CFLAGS_RM) \$$(CC_EXTRA_OPTS)," \
306
-						"\$$(CFLAGS)) \$$(CC_EXTRA_OPTS)" >>$@
307
-
308
-endif # ifeq ($(config_mak),1)
309
-
310
-modules.lst: Makefile.groups
311
-	@echo  saving modules list...
312
-	@echo "# this file is autogenerated by make modules-cfg" >$@
313
-	@echo >>$@
314
-	@echo "# the list of sub-directories with modules" >>$@
315
-	@echo "modules_dirs:=$(modules_dirs)" >>$@
316
-	@echo >>$@
317
-	@echo "# the list of module groups to compile" >>$@
318
-	@echo "cfg_group_include=$(group_include)" >>$@
319
-	@echo >>$@
320
-	@echo "# the list of extra modules to compile" >>$@
321
-	@$(call cfg_save_var2,include_modules,$@)
322
-	@echo >>$@
323
-	@echo "# the list of static modules" >>$@
324
-	@$(call cfg_save_var2,static_modules,$@)
325
-	@echo >>$@
326
-	@echo "# the list of modules to skip from compile list" >>$@
327
-	@$(call cfg_save_var2,skip_modules,$@)
328
-	@echo >>$@
329
-	@echo "# the list of modules to exclude from compile list" >>$@
330
-	@$(call cfg_save_var3,exclude_modules,skip_modules,$@)
331
-	@echo >>$@
332
-	@$(foreach mods,$(modules_dirs), \
333
-		$(call cfg_save_var2,$(mods)_all,$@))
334
-	@$(foreach mods,$(modules_dirs), \
335
-		$(call cfg_save_var2,$(mods)_noinc,$@))
336
-	@$(foreach mods,$(modules_dirs), \
337
-		$(call cfg_save_var2,$(mods),$@))
338
-	@echo "modules_configured:=1" >>$@
339
-
340
-
341
-.PHONY: cfg config cfg-defs
342
-cfg-defs: config.mak
343
-
344
-cfg config: cfg-defs modules-cfg
345
-
346
-.PHONY: modules-cfg modules-list modules-lst
347
-modules-cfg modules-list modules-lst:
348
-	rm -f modules.lst
349
-	$(MAKE) modules.lst
350
-
351
-ifneq ($(wildcard .git),)
352
-# if .git/ exists
353
-repo_ver=$(shell  RV=`git rev-parse --verify --short=6 HEAD 2>/dev/null`;\
354
-					[ -n "$$RV" ] && \
355
-					test -n "`git update-index --refresh --unmerged >/dev/null\
356
-							; git diff-index --name-only HEAD 2>/dev/null | \
357
-								grep -v Makefile`" &&\
358
-						RV="$$RV"-dirty; echo "$$RV")
359
-repo_hash=$(subst -dirty,,$(repo_ver))
360
-repo_state=$(subst %-dirty,dirty,$(findstring -dirty,$(repo_ver)))
361
-autover_h_dep=.git $(filter-out $(auto_gen), $(sources)) cfg.y cfg.lex Makefile
362
-else
363
-# else if .git/ does not exist
364
-repo_ver=
365
-repo_hash="unknown"
366
-repo_state=
367
-autover_h_dep=
368
-endif
369
-
370
-
371
-autover.h: $(autover_h_dep)
372
-	@echo  "generating autover.h ..."
373
-	@echo "/* this file is autogenerated by make autover.h" >$@
374
-	@echo " * DO NOT EDIT IT" >>$@
375
-	@echo " */" >>$@
376
-	@echo "" >>$@
377
-	@echo "#define REPO_VER \"$(repo_ver)\"" >>$@
378
-	@echo "#define REPO_HASH \"$(repo_hash)\"" >>$@
379
-	@echo "#define REPO_STATE \"$(repo_state)\"" >>$@
380
-
381
-.PHONY: all
382
-all: $(NAME) every-module
383
-
384
-.PHONY: print-modules
385
-print-modules:
386
-	@echo The following modules were chosen to be included: \
387
-		$(include_modules) ; \
388
-	echo ---------------------------------------------------------- ; \
389
-	echo The following modules will be excluded: $(exclude_modules) ; \
390
-	echo ---------------------------------------------------------- ; \
391
-	echo The following modules will be made; \
392
-	$(foreach mods,$(modules_dirs), \
393
-		echo $(mods)/: $($(mods)_basenames) ; ) \
394
-	#echo DBG: The following modules will be made: $(modules_basenames) ; \
395
-
396
-
397
-# modules templates (instantiated based on modules_dirs contents)
398
-define MODULES_RULES_template
399
-
400
-$(1)_dst=$(modules_prefix)/$(modules_dir)$(1)
401
-$(1)_target=$(prefix)/$(modules_dir)$(1)
402
-
403
-.PHONY: $(1)
404
-$(1): modules.lst
405
-	@$(foreach r,$($(1)),$(call module_make,$(r),$(mk_params)))
406
-
407
-.PHONY: $(1)-doc
408
-$(1)-doc: modules.lst
409
-	+@for r in $($(1)) "" ; do \
410
-		if [ -n "$$$$r" -a -r "$$$$r/Makefile" ]; then \
411
-			$(call oecho, "" ;) \
412
-			$(call oecho, "" ;) \
413
-			$(MAKE) -C $$$$r/doc $(doc_format) $$(mk_params); \
414
-		fi ; \
415
-	done
416
-
417
-.PHONY: $(1)-readme
418
-
419
-$(1)-readme: modules.lst
420
-	-+@for r in $($(1)) "" ; do \
421
-		if [ -n "$$$$r" -a -r "$$$$r/Makefile" ]; then \
422
-			$(call oecho, "" ;) \
423
-			$(call oecho, "" ;) \
424
-			if  $(MAKE) -C $$$$r $$(mk_params) README || [ ${err_fail} != 1 ];\
425
-			then \
426
-				:; \
427
-			else \
428
-				exit 1; \
429
-			fi ; \
430
-		fi ; \
431
-	done; true
432
-
433
-.PHONY: $(1)-man
434
-$(1)-man: modules.lst
435
-	-+@for r in $($(1)_basenames) "" ; do \
436
-		if [ -n "$$$$r" -a -r $(1)/"$$$$r/Makefile" -a \
437
-			 -r $(1)/"$$$$r/$$$$r.xml" ]; then \
438
-			$(call oecho, "" ;) \
439
-			$(call oecho, "" ;) \
440
-			if  $(MAKE) -C $(1)/"$$$$r" $$(mk_params) man || \
441
-				[ ${err_fail} != 1 ] ;\
442
-			then \
443
-				:; \
444
-			else \
445
-				exit 1; \
446
-			fi ; \
447
-		fi ; \
448
-	done; true
449
-
450
-.PHONY: install-$(1)
451
-
452
-install-$(1): modules.lst $$($(1)_dst)
453
-	+@for r in $($(1)) "" ; do \
454
-		if [ -n "$$$$r" -a -r "$$$$r/Makefile" ]; then \
455
-			$(call oecho, "" ;) \
456
-			$(call oecho, "" ;) \
457
-			if  $(MAKE) -C $$$$r install mods_dst=$$($(1)_dst) $$(mk_params) \
458
-				|| [ ${err_fail} != 1 ] ; then \
459
-				:; \
460
-			else \
461
-				exit 1; \
462
-			fi ; \
463
-		fi ; \
464
-	done; true
465
-
466
-
467
-.PHONY: install-$(1)-doc
468
-
469
-install-$(1)-doc: modules.lst $(doc_prefix)/$(doc_dir)$(1)
470
-	@for r in $($(1)_basenames) "" ; do \
471
-		if [ -n "$$$$r" -a -r $(1)/"$$$$r/Makefile" ]; then \
472
-			if [ -f $(1)/"$$$$r"/README ]; then \
473
-				$$(call try_err,\
474
-					$(INSTALL_TOUCH) $(doc_prefix)/$(doc_dir)$(1)/README ); \
475
-				$$(call try_err,\
476
-					$(INSTALL_DOC)  $(1)/"$$$$r"/README  \
477
-									$(doc_prefix)/$(doc_dir)$(1)/README ); \
478
-				$$(call try_err,\
479
-					mv -f $(doc_prefix)/$(doc_dir)$(1)/README \
480
-							$(doc_prefix)/$(doc_dir)$(1)/README."$$$$r" ); \
481
-			fi ; \
482
-		fi ; \
483
-	done; true
484
-
485
-.PHONY: install-$(1)-man
486
-
487
-install-$(1)-man: $(1)-man $(man_prefix)/$(man_dir)/man7
488
-	@for r in $($(1)_basenames) "" ; do \
489
-		if [ -n "$$$$r" -a -r $(1)/"$$$$r/Makefile" ]; then \
490
-			if [ -f $(1)/"$$$$r"/"$$$$r".7 ]; then \
491
-				$$(call try_err,\
492
-				  $(INSTALL_TOUCH) $(man_prefix)/$(man_dir)/man7/"$$$$r".7 );\
493
-				$$(call try_err,\
494
-					$(INSTALL_MAN)  $(1)/"$$$$r"/"$$$$r".7  \
495
-									$(man_prefix)/$(man_dir)/man7 ); \
496
-			fi ; \
497
-		fi ; \
498
-	done; true
499
-
500
-
501
-$(modules_prefix)/$(modules_dir)$(1):
502
-		mkdir -p $$(@)
503
-
504
-$(doc_prefix)/$(doc_dir)$(1):
505
-		mkdir -p $$(@)
506
-
507
-
508
-endef
509
-
510
-# instantiate the template
511
-$(foreach mods,$(modules_dirs),$(eval $(call MODULES_RULES_template,$(mods))))
512
-
513
-#$(foreach mods,$(modules_dirs),$(eval  $(info DUMP: $(call MODULES_RULES_template,$(mods)))))
514
-
515
-# build all the modules
516
-modules-all every-module: $(modules_dirs)
517
-
518
-$(extra_objs):
519
-	@echo "Extra objs: $(extra_objs)" 
520
-	@for r in $(static_modules_path) "" ; do \
521
-		if [ -n "$$r" -a -r "$$r/Makefile"  ]; then \
522
-			$(call oecho, "" ;) \
523
-			$(call oecho, "Making static module $r" ;) \
524
-			if $(MAKE) -C $$r static $(mk_params) ; then  \
525
-				:; \
526
-			else \
527
-				exit 1; \
528
-			fi ;  \
529
-		fi ; \
530
-	done
531
-
532
-.PHONY: utils
533
-utils:
534
-	@for r in $(C_COMPILE_UTILS) "" ; do \
535
-		if [ -n "$$r" ]; then \
536
-			$(call oecho, "" ;) \
537
-			$(call oecho, "" ;) \
538
-			if  $(MAKE) -C $$r $(mk_params) || [ ${err_fail} != 1 ] ; \
539
-			then \
540
-				:; \
541
-			else \
542
-				exit 1; \
543
-			fi ; \
544
-		fi ; \
545
-	done; true
546
-
547
-
548
-dbg: sip-router
549
-	gdb -command debug.gdb
550
-
551
-.PHONY: makefile_vars makefile-vars
552
-makefile_vars makefile-vars:
553
-	echo "FLAVOUR?=$(FLAVOUR)" > Makefile.vars
554
-
555
-.PHONY: tar
556
-.PHONY: dist
557
-
558
-dist: tar
559
-
560
-tar: makefile_vars $(auto_gen_keep)
561
-	$(TAR) -C .. \
562
-		--exclude=$(notdir $(CURDIR))/test* \
563
-		--exclude=$(notdir $(CURDIR))/tmp* \
564
-		--exclude=$(notdir $(CURDIR))/debian \
565
-		--exclude=$(notdir $(CURDIR))/debian/$(MAIN_NAME) \
566
-		--exclude=$(notdir $(CURDIR))/debian/$(MAIN_NAME)-* \
567
-		--exclude=$(notdir $(CURDIR))/$(MAIN_NAME)_tls* \
568
-		--exclude=.git* \
569
-		--exclude=CVS* \
570
-		--exclude=.svn* \
571
-		--exclude=.cvsignore \
572
-		--exclude=librpath.lst \
573
-		--exclude=libiname.lst \
574
-		--exclude=makecfg.lst \
575
-		--exclude=config.mak \
576
-		--exclude=modules.lst \
577
-		--exclude=*.[do] \
578
-		--exclude=*.so \
579
-		--exclude=*.il \
580
-		--exclude=$(notdir $(CURDIR))/$(MAIN_NAME) \
581
-		--exclude=*.gz \
582
-		--exclude=*.bz2 \
583
-		--exclude=*.tar \
584
-		--exclude=*.patch \
585
-		--exclude=.\#* \
586
-		--exclude=*.swp \
587
-		--exclude=*.swo \
588
-		${tar_extra_args} \
589
-		-cf - $(notdir $(CURDIR)) | \
590
-			(mkdir -p tmp/_tar1; mkdir -p tmp/_tar2 ; \
591
-			    cd tmp/_tar1; $(TAR) -xf - ) && \
592
-			    mv tmp/_tar1/$(notdir $(CURDIR)) \
593
-			       tmp/_tar2/"$(NAME)-$(RELEASE)" && \
594
-			    (cd tmp/_tar2 && $(TAR) \
595
-			                    -zcf ../../"$(tar_name)".tar.gz \
596
-			                               "$(NAME)-$(RELEASE)" ) ; \
597
-			    rm -rf tmp/_tar1; rm -rf tmp/_tar2
598
-
599
-# binary dist. tar.gz
600
-.PHONY: bin
601
-bin:
602
-	mkdir -p tmp/$(MAIN_NAME)/usr/local
603
-	$(MAKE) install basedir=$(CURDIR)/tmp/$(MAIN_NAME) $(mk_params)
604
-	$(TAR) -C tmp/$(MAIN_NAME)/ -zcf ../$(NAME)-$(RELEASE)_$(OS)_$(ARCH).tar.gz .
605
-	rm -rf tmp/$(MAIN_NAME)
606
-
607
-.PHONY: deb
608
-deb:
609
-	-@if [ -d debian ]; then \
610
-		dpkg-buildpackage -rfakeroot -tc; \
611
-		rm debian; \
612
-	else \
613
-		ln -s pkg/$(MAIN_NAME)/deb/debian debian; \
614
-		dpkg-buildpackage -rfakeroot -tc; \
615
-		rm debian; \
616
-	fi
617
-
618
-.PHONY: deb-stable
619
-deb-stable:
620
-	-@if [ -d debian ]; then \
621
-		dpkg-buildpackage -rfakeroot -tc; \
622
-		rm debian; \
623
-	else \
624
-		ln -s pkg/$(MAIN_NAME)/deb/wheezy debian; \
625
-		dpkg-buildpackage -rfakeroot -tc; \
626
-		rm debian; \
627
-	fi
628
-
629
-.PHONY: sunpkg
630
-sunpkg:
631
-	mkdir -p tmp/$(MAIN_NAME)
632
-	mkdir -p tmp/$(MAIN_NAME)_sun_pkg
633
-	$(MAKE) install basedir=$(CURDIR)/tmp/$(MAIN_NAME) \
634
-			prefix=/usr/local $(mk_params)
635
-	(cd pkg/$(MAIN_NAME)/solaris; \
636
-	pkgmk -r ../../tmp/$(MAIN_NAME)/usr/local -o -d ../../tmp/$(MAIN_NAME)_sun_pkg/ -v "$(RELEASE)" ;\
637
-	cd ../..)
638
-	cat /dev/null > ../$(NAME)-$(RELEASE)-$(OS)-$(ARCH)-local
639
-	pkgtrans -s tmp/$(MAIN_NAME)_sun_pkg/ ../$(NAME)-$(RELEASE)-$(OS)-$(ARCH)-local \
640
-		IPTEL$(MAIN_NAME)
641
-	gzip -9 ../$(NAME)-$(RELEASE)-$(OS)-$(ARCH)-local
642
-	rm -rf tmp/$(MAIN_NAME)
643
-	rm -rf tmp/$(MAIN_NAME)_sun_pkg
644
-
645
-
646
-.PHONY: install
647
-install: mk_params="compile_for_install=yes"
648
-install: install-bin install-every-module install-cfg \
649
-	install-doc install-man install-utils install-share
650
-
651
-.PHONY: dbinstall
652
-dbinstall:
653
-	-@echo "Initializing $(MAIN_NAME) database"
654
-	scripts/mysql/$(SCR_NAME)_mysql.sh create
655
-	-@echo "Done"
656
-
657
-.PHONY: README
658
-README: $(foreach mods,$(modules_dirs),$(mods)-readme)
659
-
660
-.PHONY: man
661
-man: $(foreach mods,$(modules_dirs),$(mods)-man)
662
-
663
-mk-install_dirs: $(cfg_prefix)/$(cfg_dir) $(bin_prefix)/$(bin_dir) \
664
-			$(modules_prefix)/$(modules_dir) $(doc_prefix)/$(doc_dir) \
665
-			$(man_prefix)/$(man_dir)/man8 $(man_prefix)/$(man_dir)/man5 \
666
-			$(share_prefix)/$(share_dir) \
667
-			$(foreach mods,$(modules_dirs),\
668
-				$(modules_prefix)/$(modules_dir)$(mods) \
669
-				$(doc_prefix)/$(doc_dir)$(mods) )
670
-
671
-$(cfg_prefix)/$(cfg_dir): 
672
-		mkdir -p $(cfg_prefix)/$(cfg_dir)
673
-
674
-$(run_prefix)/$(run_dir): 
675
-		mkdir -p $(run_prefix)/$(run_dir)
676
-
677
-$(bin_prefix)/$(bin_dir):
678
-		mkdir -p $(bin_prefix)/$(bin_dir)
679
-
680
-$(share_prefix)/$(share_dir):
681
-		mkdir -p $(share_prefix)/$(share_dir)
682
-
683
-$(modules_prefix)/$(modules_dir):
684
-		mkdir -p $(modules_prefix)/$(modules_dir)
685
-
686
-$(doc_prefix)/$(doc_dir):
687
-		mkdir -p $(doc_prefix)/$(doc_dir)
688
-
689
-$(man_prefix)/$(man_dir)/man8:
690
-		mkdir -p $(man_prefix)/$(man_dir)/man8
691
-
692
-$(man_prefix)/$(man_dir)/man7:
693
-		mkdir -p $(man_prefix)/$(man_dir)/man7
694
-
695
-$(man_prefix)/$(man_dir)/man5:
696
-		mkdir -p $(man_prefix)/$(man_dir)/man5
697
-
698
-# note: sed with POSIX.1 regex doesn't support |, + or ? (darwin, solaris ...) 
699
-install-cfg: $(cfg_prefix)/$(cfg_dir)
700
-	@if [ -f etc/$(CFG_NAME).cfg ]; then \
701
-			sed $(foreach m,$(modules_dirs),\
702
-					-e "s#/usr/[^:]*lib/$(CFG_NAME)/$(m)\([:/\"]\)#$($(m)_target)\1#g") \
703
-					-e "s#/usr/local/etc/$(CFG_NAME)/#$(cfg_target)#g" \
704
-				< etc/$(CFG_NAME).cfg \
705
-				> $(cfg_prefix)/$(cfg_dir)$(MAIN_NAME).cfg.sample; \
706
-			chmod 644 $(cfg_prefix)/$(cfg_dir)$(MAIN_NAME).cfg.sample; \
707
-			if [ -z "${skip_cfg_install}" -a \
708
-					! -f $(cfg_prefix)/$(cfg_dir)$(MAIN_NAME).cfg ]; then \
709
-				mv -f $(cfg_prefix)/$(cfg_dir)$(MAIN_NAME).cfg.sample \
710
-					$(cfg_prefix)/$(cfg_dir)$(MAIN_NAME).cfg; \
711
-			fi; \
712
-		fi
713
-	@if [ -f etc/$(CFG_NAME)-basic.cfg ]; then \
714
-			sed $(foreach m,$(modules_dirs),\
715
-					-e "s#/usr/[^:]*lib/$(CFG_NAME)/$(m)\([:/\"]\)#$($(m)_target)\1#g") \
716
-					-e "s#/usr/local/etc/$(CFG_NAME)/#$(cfg_target)#g" \
717
-				< etc/$(CFG_NAME)-basic.cfg \
718
-				> $(cfg_prefix)/$(cfg_dir)$(MAIN_NAME)-basic.cfg.sample; \
719
-			chmod 644 $(cfg_prefix)/$(cfg_dir)$(MAIN_NAME)-basic.cfg.sample; \
720
-			if [ -z "${skip_cfg_install}" -a \
721
-					! -f $(cfg_prefix)/$(cfg_dir)$(MAIN_NAME)-basic.cfg ]; then \
722
-				mv -f $(cfg_prefix)/$(cfg_dir)$(MAIN_NAME)-basic.cfg.sample \
723
-					$(cfg_prefix)/$(cfg_dir)$(MAIN_NAME)-basic.cfg; \
724
-			fi; \
725
-		fi
726
-	@if [ -f etc/$(CFG_NAME)-oob.cfg ]; then \
727
-			sed $(foreach m,$(modules_dirs),\
728
-					-e "s#/usr/[^:]*lib/$(CFG_NAME)/$(m)\([:/\"]\)#$($(m)_target)\1#g") \
729
-					-e "s#/usr/local/etc/$(CFG_NAME)/#$(cfg_target)#g" \
730
-				< etc/$(CFG_NAME)-oob.cfg \
731
-				> $(cfg_prefix)/$(cfg_dir)$(MAIN_NAME)-advanced.cfg.sample; \
732
-			chmod 644 $(cfg_prefix)/$(cfg_dir)$(MAIN_NAME)-advanced.cfg.sample; \
733
-			if [ -z "${skip_cfg_install}" -a \
734
-					! -f $(cfg_prefix)/$(cfg_dir)$(MAIN_NAME)-advanced.cfg ]; \
735
-			then \
736
-				mv -f $(cfg_prefix)/$(cfg_dir)$(MAIN_NAME)-advanced.cfg.sample \
737
-					$(cfg_prefix)/$(cfg_dir)$(MAIN_NAME)-advanced.cfg; \
738
-			fi; \
739
-		fi
740
-	@# other configs
741
-	@for r in $(C_INSTALL_CFGS) ""; do \
742
-			if [ -n "$$r" ]; then \
743
-				if [ -f "$$r" ]; then \
744
-					n=`basename "$$r"` ; \
745
-					sed $(foreach m,$(modules_dirs),\
746
-							-e "s#/usr/[^:]*lib/$(CFG_NAME)/$(m)\([:/\"]\)#$($(m)_target)\1#g") \
747
-						< "$$r" \
748
-						> "$(cfg_prefix)/$(cfg_dir)$$n.sample" ; \
749
-					chmod 644 "$(cfg_prefix)/$(cfg_dir)$$n.sample" ; \
750
-					if [ -z "${skip_cfg_install}" -a \
751
-							! -f "$(cfg_prefix)/$(cfg_dir)$$n" ]; \
752
-					then \
753
-						mv -f "$(cfg_prefix)/$(cfg_dir)$$n.sample" \
754
-								"$(cfg_prefix)/$(cfg_dir)$$n"; \