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,299 +0,0 @@
1
-# Kamailio build system
2
-#
3
-# module Makefile
4
-#(to be included from each module)
5
-#
6
-#
7
-
8
-#
9
-# Variables that should be defined in the modules, prior to including
10
-# this makefile:
11
-#
12
-# NAME - module binary name, complete with .so and no path (MUST).
13
-#
14
-# COREPATH - path to the main/core directory (OPTIONAL, default ../..)
15
-#
16
-# DEFS - per module extra defines (OPTIONAL)
17
-#
18
-# LIBS - per module extra libs (OPTIONAL)
19
-#
20
-# SER_LIBS - ser/sr libs that should be compiled, linked against and installed
21
-#           along the module. The format is: <path>/<shortname>, e.g.
22
-#           SER_LIBS=../../lib/srdb2/srdb2 for libsrdb2 with the sources
23
-#            in ../../lib/srdb2. (OPTIONAL)
24
-#
25
-# MOD_INSTALL_UTILS - list of utils directories that should be compiled and
26
-#                     installed along the module. The utils must know how to
27
-#                     install themselves (make install).
28
-#                     E.g.: MOD_INSTALL_UTILS=../../utils/sercmd
29
-#                     (OPTIONAL)
30
-#
31
-# MOD_INSTALL_SCRIPTS - list of scripts (complete path including the file name)
32
-#                       that should be installed along the module.
33
-#                       E.g.: MOD_INSTALL_SCRIPTS=../../scripts/foo/foo.sh
34
-#                       (OPTIONAL)
35
-#
36
-# MOD_INSTALL_CFGS - list of extra config files that should be installed in
37
-#                    the main config directory, along the module (OPTIONAL).
38
-#
39
-# MOD_INSTALL_SHARE - list of files to install into the arch-independent
40
-#                     shared directory (by default
41
-#                     /usr/local/share/$(MAIN_NAME))
42
-#
43
-
44
-MOD_NAME=$(NAME:.so=)
45
-
46
-# allow placing modules in separate directory apart from ser core
47
-COREPATH ?=../..
48
-
49
-ALLDEP=Makefile $(COREPATH)/Makefile.sources $(COREPATH)/Makefile.rules \
50
- $(COREPATH)/Makefile.modules $(COREPATH)/Makefile.dirs $(COREPATH)/config.mak
51
-
52
-#override modules value, a module cannot have submodules
53
-override modules=
54
-override static_modules=
55
-override static_modules_path=
56
-
57
-# should be set in the Makefile of each module
58
-# INCLUDES += -I$(COREPATH)
59
-
60
-# temporary def (visible only in the module, not exported)
61
-DEFS += -DMOD_NAME='"$(MOD_NAME)"'
62
-
63
-
64
-ifeq (,$(findstring -DSER_MOD_INTERFACE, $(DEFS)))
65
-	MODIFACE=-DKAMAILIO_MOD_INTERFACE
66
-else
67
-	MODIFACE=-DSER_MOD_INTERFACE
68
-endif
69
-
70
-
71
-ifneq ($(makefile_defs_included),1)
72
-$(error "the local makefile does not include Makefile.defs!")
73
-endif
74
-
75
-ifeq ($(MAKELEVEL), 0)
76
-# make called directly in the module dir!
77
-
78
-#$(warning "you should run make from the main ser directory")
79
-
80
-else
81
-# called by the main Makefile
82
-
83
-ALLDEP+=$(COREPATH)/Makefile
84
-
85
-endif
86
-
87
-include $(COREPATH)/Makefile.sources
88
-
89
-
90
-# if config was not loaded (makefile_defs!=1) ignore
91
-# the rest of makefile and try only to remake the config
92
-ifeq ($(makefile_defs),1)
93
-
94
-ifeq (,$(filter $(MOD_NAME), $(static_modules)))
95
-CFLAGS:=$(MOD_CFLAGS)
96
-LDFLAGS:=$(MOD_LDFLAGS)
97
-endif
98
-
99
-
100
-err_fail?=1
101
-
102
-include $(COREPATH)/Makefile.dirs
103
-include $(COREPATH)/Makefile.targets
104
-include $(COREPATH)/Makefile.rules
105
-include $(COREPATH)/Makefile.shared
106
-
107
-# default: if not overwritten by the main Makefile, install in modules
108
-mods_dst=$(modules_prefix)/$(modules_dir)/modules
109
-
110
-$(mods_dst):
111
-		mkdir -p $(mods_dst)
112
-
113
-LIBS:=$(filter-out -ldl -lresolv, $(LIBS))
114
-
115
-
116
-.PHONY: install
117
-.PHONY: install-libs
118
-.PHONY: install-utils
119
-.PHONY: install-scripts
120
-.PHONY: install-cfgs
121
-install: $(NAME) $(mods_dst) install-libs install-utils install-scripts \
122
-		install-cfg install-share
123
-	$(INSTALL_TOUCH) $(mods_dst)/$(NAME)
124
-	$(INSTALL_MODULES)  $(NAME)  $(mods_dst)
125
-
126
-ifneq (,$(SER_LIBS))
127
-install-libs:
128
-	@for lib in $(dir $(SER_LIBS)) ; do \
129
-		$(call try_err, $(MAKE) -C "$${lib}" install-if-newer ) ;\
130
-	done; true
131
-
132
-else
133
-install-libs:
134
-
135
-endif # $(SER_LIBS)
136
-
137
-.PHONY: utils
138
-.PHONY: clean-utils
139
-.PHONY: proper-utils
140
-.PHONY: distclean-utils
141
-.PHONY: realclean-utils
142
-.PHONY: maintainer-clean-utils
143
-ifneq (,$(MOD_INSTALL_UTILS))
144
-install-utils:
145
-	@for ut in $(MOD_INSTALL_UTILS) ; do \
146
-		$(call try_err, $(MAKE) -C "$${ut}" install-if-newer ) ;\
147
-	done; true
148
-
149
-utils:
150
-	@for r in $(MOD_INSTALL_UTILS) ; do \
151
-		$(call try_err, $(MAKE) -C "$$r" ) ;\
152
-	done; true
153
-
154
-clean-utils:
155
-	@for r in $(MOD_INSTALL_UTILS) ; do \
156
-		if [ -d "$$r" ]; then \
157
-			 $(MAKE) -C "$$r" clean ; \
158
-		fi ; \
159
-	done
160
-
161
-proper-utils realclean-utils distclean-utils maintainer-clean-utils: \
162
- clean_target=$(patsubst %-utils,%,$@)
163
-proper-utils realclean-utils distclean-utils maintainer-clean-utils:
164
-	@for r in $(MOD_INSTALL_UTILS) ; do \
165
-		if [ -d "$$r" ]; then \
166
-			 $(MAKE) -C "$$r" $(clean_target); \
167
-		fi ; \
168
-	done
169
-
170
-else
171
-# ! MOD_INSTALL_UTILS
172
-install-utils:
173
-utils:
174
-clean-utils:
175
-proper-utils realclean-utils distclean-utils maintainer-clean-utils:
176
-
177
-endif # $(MOD_INSTALL_UTILS)
178
-
179
-ifneq (,$(MOD_INSTALL_SCRIPTS))
180
-install-scripts: $(bin_prefix)/$(bin_dir)
181
-	@for r in $(MOD_INSTALL_SCRIPTS) ; do \
182
-		if [ -n "$$r" ]; then \
183
-			if [ -f "$$r" ]; then \
184
-				$(call try_err, $(INSTALL_TOUCH) \
185
-					$(bin_prefix)/$(bin_dir)/`basename "$$r"` ); \
186
-				$(call try_err,\
187
-					$(INSTALL_SCRIPT)  "$$r"  $(bin_prefix)/$(bin_dir) ); \
188
-			else \
189
-				echo "ERROR: $$r not found" ; \
190
-				if [ ${err_fail} = 1 ] ; then \
191
-					exit 1; \
192
-				fi ; \
193
-			fi ; \
194
-		fi ; \
195
-	done; true
196
-
197
-else
198
-install-scripts:
199
-
200
-endif # $(MOD_INSTALL_SCRIPTS)
201
-
202
-ifneq (,$(MOD_INSTALL_CFGS))
203
-install-cfg: $(cfg_prefix)/$(cfg_dir)
204
-	@for r in $(MOD_INSTALL_CFGS) ; do \
205
-		if [ -n "$$r" ]; then \
206
-			if [ -f "$$r" ]; then \
207
-				n=`basename "$$r"` ; \
208
-				$(call try_err, $(INSTALL_TOUCH) \
209
-					"$(cfg_prefix)/$(cfg_dir)/$$n.sample" ); \
210
-				$(call try_err,\
211
-					$(INSTALL_CFG)  "$$r"  \
212
-						"$(cfg_prefix)/$(cfg_dir)/$$n.sample"); \
213
-				if [ -z "${skip_cfg_install}" -a \
214
-						! -f "$(cfg_prefix)/$(cfg_dir)$$n" ]; then \
215
-					mv -f $(cfg_prefix)/$(cfg_dir)$$n.sample \
216
-						$(cfg_prefix)/$(cfg_dir)$$n; \
217
-				fi ; \
218
-			else \
219
-				echo "ERROR: $$r not found" ; \
220
-				if [ ${err_fail} = 1 ] ; then \
221
-					exit 1; \
222
-				fi ; \
223
-			fi ; \
224
-		fi ; \
225
-	done; true
226
-
227
-else
228
-install-cfg:
229
-
230
-endif # $(MOD_INSTALL_CFGS)
231
-
232
-ifneq (,$(MOD_INSTALL_SHARE))
233
-install-share: $(share_prefix)/$(share_dir)
234
-	@for r in $(MOD_INSTALL_SHARE) ; do \
235
-		if [ -n "$$r" ]; then \
236
-			if [ -f "$$r" ]; then \
237
-				$(call try_err, $(INSTALL_TOUCH) \
238
-					$(share_prefix)/$(share_dir)/`basename "$$r"` ); \
239
-				$(call try_err,\
240
-					$(INSTALL_SHARE)  "$$r"  $(share_prefix)/$(share_dir) ); \
241
-			else \
242
-				echo "ERROR: $$r not found" ; \
243
-				if [ ${err_fail} = 1 ] ; then \
244
-					exit 1; \
245
-				fi ; \
246
-			fi ; \
247
-		fi ; \
248
-	done; true
249
-
250
-else
251
-install-share:
252
-
253
-endif # $(MOD_INSTALL_SHARE)
254
-
255
-
256
-$(bin_prefix)/$(bin_dir):
257
-	mkdir -p $@
258
-
259
-$(cfg_prefix)/$(cfg_dir):
260
-	mkdir -p $@
261
-
262
-$(share_prefix)/$(share_dir):
263
-	mkdir -p $@
264
-
265
-# README build rules
266
-ifneq (,$(wildcard doc/Makefile))
267
-#doc/Makefile present => we can generate README
268
-
269
-README: doc/*.xml ../../docbook/entities.xml
270
-	$(MAKE) -C doc $(MOD_NAME).txt
271
-	mv doc/$(MOD_NAME).txt $@
272
-
273
-else
274
-# do nothing
275
-
276
-README:
277
-endif
278
-
279
-#man page build rules
280
-ifneq (,$(wildcard $(MOD_NAME).xml))
281
-
282
-$(MOD_NAME).7: $(MOD_NAME).xml
283
-	$(DOCBOOK) -s ../../doc/stylesheets/serdoc2man.xsl $<
284
-
285
-man: $(MOD_NAME).7
286
-
287
-else
288
-
289
-man:
290
-
291
-endif
292
-
293
-
294
-printmiface:
295
-	@echo -n $(MODIFACE)
296
-
297
-endif # ifeq($(makefile_defs),1)
298
-
299
-include $(COREPATH)/Makefile.cfg
Browse code

build system: Remove SVN ID and history

Olle E. Johansson authored on 10/01/2015 07:57:18
Showing 1 changed files
... ...
@@ -1,23 +1,8 @@
1
-#
2
-# $Id$
1
+# Kamailio build system
3 2
 #
4 3
 # module Makefile
5 4
 #(to be included from each module)
6 5
 #
7
-# History:
8
-# --------
9
-#  2007-03-29  if a module depends on SER_LIBS, it will be rebuilt on install
10
-#               with the proper rpath; libraries will be automatically
11
-#               installed if needed (andrei)
12
-#  2008-06-23  added the README & man targets (andrei)
13
-#  2008-06-27  make cfg / config.mak support (andrei)
14
-#  2009-03-10  replaced DEFS with C_DEFS and INCLUDES with C_INCLUDES (DEFS
15
-#              and INCLUDES are now used only for "temporary" defines/includes
16
-#              inside modules or libs) (andrei)
17
-#  2009-10-01  added support for automatically installing extra utils,
18
-#               scripts and cfg files (andrei)
19
-#  2010-03-04  don't overwrite already installed .cfgs, save the .cfg as
20
-#              .sample in this case (andrei)
21 6
 #
22 7
 
23 8
 #
Browse code

Makefiles: Updated Makefiles to use db2x_docbook2man when docbook2x-man is not installed

- db2x_docbook2man is what Fedora contains

Peter Dunkley authored on 20/10/2012 00:23:51
Showing 1 changed files
... ...
@@ -295,7 +295,7 @@ endif
295 295
 ifneq (,$(wildcard $(MOD_NAME).xml))
296 296
 
297 297
 $(MOD_NAME).7: $(MOD_NAME).xml
298
-	docbook2x-man -s ../../doc/stylesheets/serdoc2man.xsl $<
298
+	$(DOCBOOK) -s ../../doc/stylesheets/serdoc2man.xsl $<
299 299
 
300 300
 man: $(MOD_NAME).7
301 301
 
Browse code

all: OPENSER_MOD_INTERFACE replaced with KAMAILIO_MOD_INTERFACE

- OPENSER_MOD_INTERFACE still works if used in module Makefile

Daniel-Constantin Mierla authored on 18/10/2012 13:46:13
Showing 1 changed files
... ...
@@ -77,7 +77,7 @@ DEFS += -DMOD_NAME='"$(MOD_NAME)"'
77 77
 
78 78
 
79 79
 ifeq (,$(findstring -DSER_MOD_INTERFACE, $(DEFS)))
80
-	MODIFACE=-DOPENSER_MOD_INTERFACE
80
+	MODIFACE=-DKAMAILIO_MOD_INTERFACE
81 81
 else
82 82
 	MODIFACE=-DSER_MOD_INTERFACE
83 83
 endif
Browse code

Makefile: option to print C compile flags

- print with no EOL the module interface flag in Makefile.modules

Daniel-Constantin Mierla authored on 25/11/2011 22:46:31
Showing 1 changed files
... ...
@@ -307,7 +307,7 @@ endif
307 307
 
308 308
 
309 309
 printmiface:
310
-	@echo $(MODIFACE)
310
+	@echo -n $(MODIFACE)
311 311
 
312 312
 endif # ifeq($(makefile_defs),1)
313 313
 
Browse code

Makefile.modules: printmiface - new target to print module interface define

Daniel-Constantin Mierla authored on 25/11/2011 17:38:24
Showing 1 changed files
... ...
@@ -75,6 +75,14 @@ override static_modules_path=
75 75
 # temporary def (visible only in the module, not exported)
76 76
 DEFS += -DMOD_NAME='"$(MOD_NAME)"'
77 77
 
78
+
79
+ifeq (,$(findstring -DSER_MOD_INTERFACE, $(DEFS)))
80
+	MODIFACE=-DOPENSER_MOD_INTERFACE
81
+else
82
+	MODIFACE=-DSER_MOD_INTERFACE
83
+endif
84
+
85
+
78 86
 ifneq ($(makefile_defs_included),1)
79 87
 $(error "the local makefile does not include Makefile.defs!")
80 88
 endif
... ...
@@ -297,6 +305,10 @@ man:
297 305
 
298 306
 endif
299 307
 
308
+
309
+printmiface:
310
+	@echo $(MODIFACE)
311
+
300 312
 endif # ifeq($(makefile_defs),1)
301 313
 
302 314
 include $(COREPATH)/Makefile.cfg
Browse code

docs: cleanup in xml files

- useless revision history removed
- docs depend on entities.xml
- updated global entities
- fixed the links to users and devel mailing lists
- fixed the link to tracker

Daniel-Constantin Mierla authored on 18/06/2011 21:21:41
Showing 1 changed files
... ...
@@ -273,7 +273,7 @@ $(share_prefix)/$(share_dir):
273 273
 ifneq (,$(wildcard doc/Makefile))
274 274
 #doc/Makefile present => we can generate README
275 275
 
276
-README: doc/*.xml
276
+README: doc/*.xml ../../docbook/entities.xml
277 277
 	$(MAKE) -C doc $(MOD_NAME).txt
278 278
 	mv doc/$(MOD_NAME).txt $@
279 279
 
Browse code

makefile: fix modules config overwrite

A config file provided by a module was installed even if a
previous version was already installed, overwriting the old
version. Now if a file with the same name already exists, the
module config file will be installed with a .sample extension
added (so only .sample will be overwritten, never an active .cfg).

Reported-by: Klaus Darilion klaus.mailinglists pernau at
Closes FlySpray#38 .

Andrei Pelinescu-Onciul authored on 04/03/2010 12:16:06
Showing 1 changed files
... ...
@@ -16,6 +16,8 @@
16 16
 #              inside modules or libs) (andrei)
17 17
 #  2009-10-01  added support for automatically installing extra utils,
18 18
 #               scripts and cfg files (andrei)
19
+#  2010-03-04  don't overwrite already installed .cfgs, save the .cfg as
20
+#              .sample in this case (andrei)
19 21
 #
20 22
 
21 23
 #
... ...
@@ -209,10 +211,17 @@ install-cfg: $(cfg_prefix)/$(cfg_dir)
209 211
 	@for r in $(MOD_INSTALL_CFGS) ; do \
210 212
 		if [ -n "$$r" ]; then \
211 213
 			if [ -f "$$r" ]; then \
214
+				n=`basename "$$r"` ; \
212 215
 				$(call try_err, $(INSTALL_TOUCH) \
213
-					$(cfg_prefix)/$(cfg_dir)/`basename "$$r"` ); \
216
+					"$(cfg_prefix)/$(cfg_dir)/$$n.sample" ); \
214 217
 				$(call try_err,\
215
-					$(INSTALL_CFG)  "$$r"  $(cfg_prefix)/$(cfg_dir) ); \
218
+					$(INSTALL_CFG)  "$$r"  \
219
+						"$(cfg_prefix)/$(cfg_dir)/$$n.sample"); \
220
+				if [ -z "${skip_cfg_install}" -a \
221
+						! -f "$(cfg_prefix)/$(cfg_dir)$$n" ]; then \
222
+					mv -f $(cfg_prefix)/$(cfg_dir)$$n.sample \
223
+						$(cfg_prefix)/$(cfg_dir)$$n; \
224
+				fi ; \
216 225
 			else \
217 226
 				echo "ERROR: $$r not found" ; \
218 227
 				if [ ${err_fail} = 1 ] ; then \
Browse code

makefiles: clean-utils and proper-utils fix

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

Andrei Pelinescu-Onciul authored on 04/12/2009 17:16:25
Showing 1 changed files
... ...
@@ -139,14 +139,45 @@ install-libs:
139 139
 
140 140
 endif # $(SER_LIBS)
141 141
 
142
+.PHONY: utils
143
+.PHONY: clean-utils
144
+.PHONY: proper-utils
145
+.PHONY: distclean-utils
146
+.PHONY: realclean-utils
147
+.PHONY: maintainer-clean-utils
142 148
 ifneq (,$(MOD_INSTALL_UTILS))
143 149
 install-utils:
144 150
 	@for ut in $(MOD_INSTALL_UTILS) ; do \
145 151
 		$(call try_err, $(MAKE) -C "$${ut}" install-if-newer ) ;\
146 152
 	done; true
147 153
 
154
+utils:
155
+	@for r in $(MOD_INSTALL_UTILS) ; do \
156
+		$(call try_err, $(MAKE) -C "$$r" ) ;\
157
+	done; true
158
+
159
+clean-utils:
160
+	@for r in $(MOD_INSTALL_UTILS) ; do \
161
+		if [ -d "$$r" ]; then \
162
+			 $(MAKE) -C "$$r" clean ; \
163
+		fi ; \
164
+	done
165
+
166
+proper-utils realclean-utils distclean-utils maintainer-clean-utils: \
167
+ clean_target=$(patsubst %-utils,%,$@)
168
+proper-utils realclean-utils distclean-utils maintainer-clean-utils:
169
+	@for r in $(MOD_INSTALL_UTILS) ; do \
170
+		if [ -d "$$r" ]; then \
171
+			 $(MAKE) -C "$$r" $(clean_target); \
172
+		fi ; \
173
+	done
174
+
148 175
 else
176
+# ! MOD_INSTALL_UTILS
149 177
 install-utils:
178
+utils:
179
+clean-utils:
180
+proper-utils realclean-utils distclean-utils maintainer-clean-utils:
150 181
 
151 182
 endif # $(MOD_INSTALL_UTILS)
152 183
 
Browse code

makefile: per modules arch. indep. files install support

Support for easily adding arch. independent files that should be
installed along a module.
The following new module makefile variable is supported:

MOD_INSTALL_SHARE - list of files to install into the
arch-independent shared directory (by default
/usr/local/share/$(MAIN_NAME)).

Andrei Pelinescu-Onciul authored on 01/10/2009 14:48:30
Showing 1 changed files
... ...
@@ -48,6 +48,11 @@
48 48
 #
49 49
 # MOD_INSTALL_CFGS - list of extra config files that should be installed in
50 50
 #                    the main config directory, along the module (OPTIONAL).
51
+#
52
+# MOD_INSTALL_SHARE - list of files to install into the arch-independent
53
+#                     shared directory (by default
54
+#                     /usr/local/share/$(MAIN_NAME))
55
+#
51 56
 
52 57
 MOD_NAME=$(NAME:.so=)
53 58
 
... ...
@@ -119,7 +124,7 @@ LIBS:=$(filter-out -ldl -lresolv, $(LIBS))
119 124
 .PHONY: install-scripts
120 125
 .PHONY: install-cfgs
121 126
 install: $(NAME) $(mods_dst) install-libs install-utils install-scripts \
122
-		install-cfg
127
+		install-cfg install-share
123 128
 	$(INSTALL_TOUCH) $(mods_dst)/$(NAME)
124 129
 	$(INSTALL_MODULES)  $(NAME)  $(mods_dst)
125 130
 
... ...
@@ -191,6 +196,29 @@ install-cfg:
191 196
 
192 197
 endif # $(MOD_INSTALL_CFGS)
193 198
 
199
+ifneq (,$(MOD_INSTALL_SHARE))
200
+install-share: $(share_prefix)/$(share_dir)
201
+	@for r in $(MOD_INSTALL_SHARE) ; do \
202
+		if [ -n "$$r" ]; then \
203
+			if [ -f "$$r" ]; then \
204
+				$(call try_err, $(INSTALL_TOUCH) \
205
+					$(share_prefix)/$(share_dir)/`basename "$$r"` ); \
206
+				$(call try_err,\
207
+					$(INSTALL_SHARE)  "$$r"  $(share_prefix)/$(share_dir) ); \
208
+			else \
209
+				echo "ERROR: $$r not found" ; \
210
+				if [ ${err_fail} = 1 ] ; then \
211
+					exit 1; \
212
+				fi ; \
213
+			fi ; \
214
+		fi ; \
215
+	done; true
216
+
217
+else
218
+install-share:
219
+
220
+endif # $(MOD_INSTALL_SHARE)
221
+
194 222
 
195 223
 $(bin_prefix)/$(bin_dir):
196 224
 	mkdir -p $@
... ...
@@ -198,6 +226,9 @@ $(bin_prefix)/$(bin_dir):
198 226
 $(cfg_prefix)/$(cfg_dir):
199 227
 	mkdir -p $@
200 228
 
229
+$(share_prefix)/$(share_dir):
230
+	mkdir -p $@
231
+
201 232
 # README build rules
202 233
 ifneq (,$(wildcard doc/Makefile))
203 234
 #doc/Makefile present => we can generate README
Browse code

makefile: per module extra utils and cfgs install

Support for easy adding per module extra scripts, utils (require
compile) or configs.
The following new module makefile variables are supported:

MOD_INSTALL_UTILS - list of utils directories that should be
compiled and installed along the module. The utils must know how
to install themselves (make install).
E.g.: MOD_INSTALL_UTILS=../../utils/sercmd

MOD_INSTALL_SCRIPTS - list of scripts (complete path including
the file name) that should be installed along the module.
E.g.: MOD_INSTALL_SCRIPTS=../../scripts/foo/foo.sh

MOD_INSTALL_CFGS - list of extra config files that should be
installed in the main config directory.

They should be set before including Makefile.modules.

Andrei Pelinescu-Onciul authored on 01/10/2009 13:51:47
Showing 1 changed files
... ...
@@ -14,8 +14,41 @@
14 14
 #  2009-03-10  replaced DEFS with C_DEFS and INCLUDES with C_INCLUDES (DEFS
15 15
 #              and INCLUDES are now used only for "temporary" defines/includes
16 16
 #              inside modules or libs) (andrei)
17
+#  2009-10-01  added support for automatically installing extra utils,
18
+#               scripts and cfg files (andrei)
17 19
 #
18 20
 
21
+#
22
+# Variables that should be defined in the modules, prior to including
23
+# this makefile:
24
+#
25
+# NAME - module binary name, complete with .so and no path (MUST).
26
+#
27
+# COREPATH - path to the main/core directory (OPTIONAL, default ../..)
28
+#
29
+# DEFS - per module extra defines (OPTIONAL)
30
+#
31
+# LIBS - per module extra libs (OPTIONAL)
32
+#
33
+# SER_LIBS - ser/sr libs that should be compiled, linked against and installed
34
+#           along the module. The format is: <path>/<shortname>, e.g.
35
+#           SER_LIBS=../../lib/srdb2/srdb2 for libsrdb2 with the sources
36
+#            in ../../lib/srdb2. (OPTIONAL)
37
+#
38
+# MOD_INSTALL_UTILS - list of utils directories that should be compiled and
39
+#                     installed along the module. The utils must know how to
40
+#                     install themselves (make install).
41
+#                     E.g.: MOD_INSTALL_UTILS=../../utils/sercmd
42
+#                     (OPTIONAL)
43
+#
44
+# MOD_INSTALL_SCRIPTS - list of scripts (complete path including the file name)
45
+#                       that should be installed along the module.
46
+#                       E.g.: MOD_INSTALL_SCRIPTS=../../scripts/foo/foo.sh
47
+#                       (OPTIONAL)
48
+#
49
+# MOD_INSTALL_CFGS - list of extra config files that should be installed in
50
+#                    the main config directory, along the module (OPTIONAL).
51
+
19 52
 MOD_NAME=$(NAME:.so=)
20 53
 
21 54
 # allow placing modules in separate directory apart from ser core
... ...
@@ -82,14 +115,88 @@ LIBS:=$(filter-out -ldl -lresolv, $(LIBS))
82 115
 
83 116
 .PHONY: install
84 117
 .PHONY: install-libs
85
-install: $(NAME) $(mods_dst) install-libs
118
+.PHONY: install-utils
119
+.PHONY: install-scripts
120
+.PHONY: install-cfgs
121
+install: $(NAME) $(mods_dst) install-libs install-utils install-scripts \
122
+		install-cfg
86 123
 	$(INSTALL_TOUCH) $(mods_dst)/$(NAME)
87 124
 	$(INSTALL_MODULES)  $(NAME)  $(mods_dst)
88 125
 
126
+ifneq (,$(SER_LIBS))
89 127
 install-libs:
90
-	@for lib in $(dir $(SER_LIBS)); do \
128
+	@for lib in $(dir $(SER_LIBS)) ; do \
91 129
 		$(call try_err, $(MAKE) -C "$${lib}" install-if-newer ) ;\
92
-	done
130
+	done; true
131
+
132
+else
133
+install-libs:
134
+
135
+endif # $(SER_LIBS)
136
+
137
+ifneq (,$(MOD_INSTALL_UTILS))
138
+install-utils:
139
+	@for ut in $(MOD_INSTALL_UTILS) ; do \
140
+		$(call try_err, $(MAKE) -C "$${ut}" install-if-newer ) ;\
141
+	done; true
142
+
143
+else
144
+install-utils:
145
+
146
+endif # $(MOD_INSTALL_UTILS)
147
+
148
+ifneq (,$(MOD_INSTALL_SCRIPTS))
149
+install-scripts: $(bin_prefix)/$(bin_dir)
150
+	@for r in $(MOD_INSTALL_SCRIPTS) ; do \
151
+		if [ -n "$$r" ]; then \
152
+			if [ -f "$$r" ]; then \
153
+				$(call try_err, $(INSTALL_TOUCH) \
154
+					$(bin_prefix)/$(bin_dir)/`basename "$$r"` ); \
155
+				$(call try_err,\
156
+					$(INSTALL_SCRIPT)  "$$r"  $(bin_prefix)/$(bin_dir) ); \
157
+			else \
158
+				echo "ERROR: $$r not found" ; \
159
+				if [ ${err_fail} = 1 ] ; then \
160
+					exit 1; \
161
+				fi ; \
162
+			fi ; \
163
+		fi ; \
164
+	done; true
165
+
166
+else
167
+install-scripts:
168
+
169
+endif # $(MOD_INSTALL_SCRIPTS)
170
+
171
+ifneq (,$(MOD_INSTALL_CFGS))
172
+install-cfg: $(cfg_prefix)/$(cfg_dir)
173
+	@for r in $(MOD_INSTALL_CFGS) ; do \
174
+		if [ -n "$$r" ]; then \
175
+			if [ -f "$$r" ]; then \
176
+				$(call try_err, $(INSTALL_TOUCH) \
177
+					$(cfg_prefix)/$(cfg_dir)/`basename "$$r"` ); \
178
+				$(call try_err,\
179
+					$(INSTALL_CFG)  "$$r"  $(cfg_prefix)/$(cfg_dir) ); \
180
+			else \
181
+				echo "ERROR: $$r not found" ; \
182
+				if [ ${err_fail} = 1 ] ; then \
183
+					exit 1; \
184
+				fi ; \
185
+			fi ; \
186
+		fi ; \
187
+	done; true
188
+
189
+else
190
+install-cfg:
191
+
192
+endif # $(MOD_INSTALL_CFGS)
193
+
194
+
195
+$(bin_prefix)/$(bin_dir):
196
+	mkdir -p $@
197
+
198
+$(cfg_prefix)/$(cfg_dir):
199
+	mkdir -p $@
93 200
 
94 201
 # README build rules
95 202
 ifneq (,$(wildcard doc/Makefile))
Browse code

makefile: modules install obeys $(err_fail)

- if err_fail is 1 and a library fails to install the whole make
install will fail

Andrei Pelinescu-Onciul authored on 01/10/2009 11:45:15
Showing 1 changed files
... ...
@@ -64,10 +64,12 @@ LDFLAGS:=$(MOD_LDFLAGS)
64 64
 endif
65 65
 
66 66
 
67
+err_fail?=1
67 68
 
68 69
 include $(COREPATH)/Makefile.dirs
69 70
 include $(COREPATH)/Makefile.targets
70 71
 include $(COREPATH)/Makefile.rules
72
+include $(COREPATH)/Makefile.shared
71 73
 
72 74
 # default: if not overwritten by the main Makefile, install in modules
73 75
 mods_dst=$(modules_prefix)/$(modules_dir)/modules
... ...
@@ -86,7 +88,7 @@ install: $(NAME) $(mods_dst) install-libs
86 88
 
87 89
 install-libs:
88 90
 	@for lib in $(dir $(SER_LIBS)); do \
89
-		$(MAKE) -C "$${lib}" install-if-newer ;\
91
+		$(call try_err, $(MAKE) -C "$${lib}" install-if-newer ) ;\
90 92
 	done
91 93
 
92 94
 # README build rules
Browse code

makefile: make README removes the txt from doc/

- generation of README file for modules removes the txt file from doc/
directory

Daniel-Constantin Mierla authored on 21/04/2009 19:45:49
Showing 1 changed files
... ...
@@ -95,7 +95,7 @@ ifneq (,$(wildcard doc/Makefile))
95 95
 
96 96
 README: doc/*.xml
97 97
 	$(MAKE) -C doc $(MOD_NAME).txt
98
-	cp doc/$(MOD_NAME).txt $@
98
+	mv doc/$(MOD_NAME).txt $@
99 99
 
100 100
 else
101 101
 # do nothing
Browse code

build system: support for multiple modules dirs

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.

Andrei Pelinescu-Onciul authored on 27/03/2009 19:44:36
Showing 1 changed files
... ...
@@ -22,7 +22,7 @@ MOD_NAME=$(NAME:.so=)
22 22
 COREPATH ?=../..
23 23
 
24 24
 ALLDEP=Makefile $(COREPATH)/Makefile.sources $(COREPATH)/Makefile.rules \
25
- $(COREPATH)/Makefile.modules $(COREPATH)/config.mak
25
+ $(COREPATH)/Makefile.modules $(COREPATH)/Makefile.dirs $(COREPATH)/config.mak
26 26
 
27 27
 #override modules value, a module cannot have submodules
28 28
 override modules=
... ...
@@ -65,22 +65,24 @@ endif
65 65
 
66 66
 
67 67
 
68
+include $(COREPATH)/Makefile.dirs
68 69
 include $(COREPATH)/Makefile.targets
69 70
 include $(COREPATH)/Makefile.rules
70 71
 
72
+# default: if not overwritten by the main Makefile, install in modules
73
+mods_dst=$(modules_prefix)/$(modules_dir)/modules
71 74
 
72
-
73
-$(modules_prefix)/$(modules_dir):
74
-		mkdir -p $(modules_prefix)/$(modules_dir)
75
+$(mods_dst):
76
+		mkdir -p $(mods_dst)
75 77
 
76 78
 LIBS:=$(filter-out -ldl -lresolv, $(LIBS))
77 79
 
78 80
 
79 81
 .PHONY: install
80 82
 .PHONY: install-libs
81
-install: $(NAME) $(modules_prefix)/$(modules_dir) install-libs
82
-	$(INSTALL_TOUCH) $(modules_prefix)/$(modules_dir)/$(NAME)
83
-	$(INSTALL_MODULES)  $(NAME)  $(modules_prefix)/$(modules_dir)
83
+install: $(NAME) $(mods_dst) install-libs
84
+	$(INSTALL_TOUCH) $(mods_dst)/$(NAME)
85
+	$(INSTALL_MODULES)  $(NAME)  $(mods_dst)
84 86
 
85 87
 install-libs:
86 88
 	@for lib in $(dir $(SER_LIBS)); do \
Browse code

build system: avoid libraries re-compiling

- ignore module DEFS when deciding whether or not to recompile a
library: DEFS split into C_DEFS (for common DEFS which are taken
into account when deciding whether or not to recompile a lib)
and DEFS, which are now visible only inside the module or lib
that uses them. Same for INCLUDES and C_INCLUDES.

Andrei Pelinescu-Onciul authored on 19/03/2009 13:42:09
Showing 1 changed files
... ...
@@ -11,6 +11,9 @@
11 11
 #               installed if needed (andrei)
12 12
 #  2008-06-23  added the README & man targets (andrei)
13 13
 #  2008-06-27  make cfg / config.mak support (andrei)
14
+#  2009-03-10  replaced DEFS with C_DEFS and INCLUDES with C_INCLUDES (DEFS
15
+#              and INCLUDES are now used only for "temporary" defines/includes
16
+#              inside modules or libs) (andrei)
14 17
 #
15 18
 
16 19
 MOD_NAME=$(NAME:.so=)
... ...
@@ -26,9 +29,10 @@ override modules=
26 29
 override static_modules=
27 30
 override static_modules_path=
28 31
 
29
-# should be set in Makefile of apart module
32
+# should be set in the Makefile of each module
30 33
 # INCLUDES += -I$(COREPATH)
31 34
 
35
+# temporary def (visible only in the module, not exported)
32 36
 DEFS += -DMOD_NAME='"$(MOD_NAME)"'
33 37
 
34 38
 ifneq ($(makefile_defs_included),1)
Browse code

* logging API updated (see doc/logging-api.txt for details)

- LOG(LEVEL, FMT, ARGS...) and the short macro corresponding to
LEVEL level made eqvivalent (eg. LOG(L_DBG, FMT, ARGS...) and
DBG(FMT, ARGS...) prints always the same message)

- changed the format of log messages produced by the macros
to include the log level, module name, filename, line (if applicable)

- added new, internal LOG_(LEVEL, PREFIX, FORMAT, ARGS...) macro

- removed DPrint() and DEBUG() macros, L_DEFAULT log level and dprint()
function

!!!
!!! IMPORTANT! READ ME!
!!!

These changes (mainly the first two) require reformating of the most log
messages in SER core and module source files. This step can be done
automatically by running "scripts/logging/fix-logs-all" script BUT it
was NOT originally performed because it would have generated too many
changes in CVS which was discouraged by Andrei. Instead, the developers
are expected to run it when ready.

Ondrej Martinek authored on 06/01/2009 17:14:12
Showing 1 changed files
... ...
@@ -29,6 +29,8 @@ override static_modules_path=
29 29
 # should be set in Makefile of apart module
30 30
 # INCLUDES += -I$(COREPATH)
31 31
 
32
+DEFS += -DMOD_NAME='"$(MOD_NAME)"'
33
+
32 34
 ifneq ($(makefile_defs_included),1)
33 35
 $(error "the local makefile does not include Makefile.defs!")
34 36
 endif
Browse code

- experimental make cfg /config support: make cfg fore regeneration of the "build" config, saved in config.mak. This config is used instead of including Makefile.defs each time. The config is also automatically generated if missing. The speed improvements are dramatic in most cases: make proper 15 times faster, make clean 8 times, make with generated config 2.6 times faster then before, make rebuilding only one file 9 times faster. E.g.: make cfg include_modules=mysql CPU=pentium-m BASEDIR=/tmp/ser make install # builds default ser + mysql, optimized for pentium-m # and installs in /tmp/ser/usr/local/* make clean # cleans default modules + mysql

Andrei Pelinescu-Onciul authored on 28/06/2008 00:35:25
Showing 1 changed files
... ...
@@ -10,6 +10,7 @@
10 10
 #               with the proper rpath; libraries will be automatically
11 11
 #               installed if needed (andrei)
12 12
 #  2008-06-23  added the README & man targets (andrei)
13
+#  2008-06-27  make cfg / config.mak support (andrei)
13 14
 #
14 15
 
15 16
 MOD_NAME=$(NAME:.so=)
... ...
@@ -18,7 +19,7 @@ MOD_NAME=$(NAME:.so=)
18 19
 COREPATH ?=../..
19 20
 
20 21
 ALLDEP=Makefile $(COREPATH)/Makefile.sources $(COREPATH)/Makefile.rules \
21
- $(COREPATH)/Makefile.modules $(COREPATH)/Makefile.defs
22
+ $(COREPATH)/Makefile.modules $(COREPATH)/config.mak
22 23
 
23 24
 #override modules value, a module cannot have submodules
24 25
 override modules=
... ...
@@ -28,13 +29,14 @@ override static_modules_path=
28 29
 # should be set in Makefile of apart module
29 30
 # INCLUDES += -I$(COREPATH)
30 31
 
32
+ifneq ($(makefile_defs_included),1)
33
+$(error "the local makefile does not include Makefile.defs!")
34
+endif
35
+
31 36
 ifeq ($(MAKELEVEL), 0)
32 37
 # make called directly in the module dir!
33 38
 
34 39
 #$(warning "you should run make from the main ser directory")
35
-ifneq ($(makefile_defs), 1)
36
-$(error "the local makefile does not include Makefile.defs!")
37
-endif
38 40
 
39 41
 else
40 42
 # called by the main Makefile
... ...
@@ -45,16 +47,23 @@ endif
45 47
 
46 48
 include $(COREPATH)/Makefile.sources
47 49
 
50
+
51
+# if config was not loaded (makefile_defs!=1) ignore
52
+# the rest of makefile and try only to remake the config
53
+ifeq ($(makefile_defs),1)
54
+
48 55
 ifeq (,$(filter $(MOD_NAME), $(static_modules)))
49 56
 CFLAGS:=$(MOD_CFLAGS)
50 57
 LDFLAGS:=$(MOD_LDFLAGS)
51 58
 endif
52 59
 
53 60
 
61
+
54 62
 include $(COREPATH)/Makefile.targets
55 63
 include $(COREPATH)/Makefile.rules
56 64
 
57 65
 
66
+
58 67
 $(modules_prefix)/$(modules_dir):
59 68
 		mkdir -p $(modules_prefix)/$(modules_dir)
60 69
 
... ...
@@ -63,7 +72,7 @@ LIBS:=$(filter-out -ldl -lresolv, $(LIBS))
63 72
 
64 73
 .PHONY: install
65 74
 .PHONY: install-libs
66
-install: install-libs $(NAME) $(modules_prefix)/$(modules_dir)
75
+install: $(NAME) $(modules_prefix)/$(modules_dir) install-libs
67 76
 	$(INSTALL_TOUCH) $(modules_prefix)/$(modules_dir)/$(NAME)
68 77
 	$(INSTALL_MODULES)  $(NAME)  $(modules_prefix)/$(modules_dir)
69 78
 
... ...
@@ -99,3 +108,7 @@ else
99 108
 man:
100 109
 
101 110
 endif
111
+
112
+endif # ifeq($(makefile_defs),1)
113
+
114
+include $(COREPATH)/Makefile.cfg
Browse code

- missing include Makefile.targets

Andrei Pelinescu-Onciul authored on 26/06/2008 10:08:03
Showing 1 changed files
... ...
@@ -51,6 +51,7 @@ LDFLAGS:=$(MOD_LDFLAGS)
51 51
 endif
52 52
 
53 53
 
54
+include $(COREPATH)/Makefile.targets
54 55
 include $(COREPATH)/Makefile.rules
55 56
 
56 57
 
Browse code

- README target support: make README will regenerate the README from all the current modules - man target: (experimental) make man will generate a man page for all the modules that support it (.xml file in the module directory, for now only acc_db, acc_syslog & auth_db support it)

Andrei Pelinescu-Onciul authored on 23/06/2008 18:35:26
Showing 1 changed files
... ...
@@ -9,6 +9,7 @@
9 9
 #  2007-03-29  if a module depends on SER_LIBS, it will be rebuilt on install
10 10
 #               with the proper rpath; libraries will be automatically
11 11
 #               installed if needed (andrei)
12
+#  2008-06-23  added the README & man targets (andrei)
12 13
 #
13 14
 
14 15
 MOD_NAME=$(NAME:.so=)
... ...
@@ -70,3 +71,30 @@ install-libs:
70 71
 		$(MAKE) -C "$${lib}" install-if-newer ;\
71 72
 	done
72 73
 
74
+# README build rules
75
+ifneq (,$(wildcard doc/Makefile))
76
+#doc/Makefile present => we can generate README
77
+
78
+README: doc/*.xml
79
+	$(MAKE) -C doc $(MOD_NAME).txt
80
+	cp doc/$(MOD_NAME).txt $@
81
+
82
+else
83
+# do nothing
84
+
85
+README:
86
+endif
87
+
88
+#man page build rules
89
+ifneq (,$(wildcard $(MOD_NAME).xml))
90
+
91
+$(MOD_NAME).7: $(MOD_NAME).xml
92
+	docbook2x-man -s ../../doc/stylesheets/serdoc2man.xsl $<
93
+
94
+man: $(MOD_NAME).7
95
+
96
+else
97
+
98
+man:
99
+
100
+endif
Browse code

- don't path libdl and libresolve to modules by default (thanks to Marcus Better <marcus@better.se>)

Andrei Pelinescu-Onciul authored on 05/06/2008 16:36:58
Showing 1 changed files
... ...
@@ -56,6 +56,7 @@ include $(COREPATH)/Makefile.rules
56 56
 $(modules_prefix)/$(modules_dir):
57 57
 		mkdir -p $(modules_prefix)/$(modules_dir)
58 58
 
59
+LIBS:=$(filter-out -ldl -lresolv, $(LIBS))
59 60
 
60 61
 
61 62
 .PHONY: install
Browse code

- make doxygen and clean_doxygen targets available in module Makefiles