Browse code

Merge commit 'origin/ser_core_cvs'

* 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

Andrei Pelinescu-Onciul authored on 23/04/2009 12:33:37
Showing 8 changed files
... ...
@@ -343,13 +343,29 @@ Example: make modules-list include_modules="tls" skip_modules="print"
343 343
 Clean:
344 344
 
345 345
 make clean   (clean the modules too)
346
-make proper  (clean also the dependencies and the config)
346
+make proper  (clean also the dependencies and the config, but not the module
347
+  list)
347 348
 make distclean (the same as proper)
348
-make mantainer-clean (clean everything, including make's config, saved 
349
+make maintainer-clean (clean everything, including make's config, saved 
349 350
   module list, auto generated files, tags, *.dbg a.s.o)
350 351
 make clean-all (clean all the modules in modules/*)
351 352
 make proper-all (like make proper but for all the  modules in modules/*)
352 353
 
354
+Config clean:
355
+
356
+make clean-cfg (cleans the compile config)
357
+make clean-modules-cfg (cleans the modules list)
358
+
359
+"Reduced" clean:
360
+
361
+make local-clean    (cleans only the core, no libs, utils or modules)
362
+make clean-modules  (like make clean, but cleans only the modules)
363
+make clean-libs     (like make clean, but cleans only the libs)
364
+make clean-utils    (like make clean, but cleans only the utils
365
+make proper-modules (like make proper, but only for modules)
366
+make proper-libs    (like make proper, but only for libs)
367
+make proper-utils   (like make proper, but only for utils)
368
+
353 369
 Compile:
354 370
 
355 371
 make proper
... ...
@@ -60,6 +60,8 @@
60 60
 #  2009-04-02  workaround for export not supported in gnu make 3.80
61 61
 #               target specific variables: use mk_params for each
62 62
 #               $(MAKE) invocation (andrei)
63
+#  2009-04-22  don't rebuild config.mak or modules.lst if not needed
64
+#              (e.g. on clean) (andrei)
63 65
 #
64 66
 
65 67
 # check make version
... ...
@@ -77,6 +79,8 @@ auto_gen_others=cfg.tab.h  # auto generated, non-c
77 77
 
78 78
 #include  source related defs
79 79
 include Makefile.sources
80
+#include special targets lists
81
+include Makefile.targets
80 82
 
81 83
 # whether or not the entire build process should fail if building a module or
82 84
 #  an utility fails
... ...
@@ -97,7 +101,15 @@ include Makefile.dirs
97 97
 # Alternatives are txt, html, xhtml, and pdf (see Makefile.doc)
98 98
 doc_format?=html
99 99
 
100
+# don't force modules.lst generation if the makefile goals do not
101
+# require it (but if present use it)
102
+ifeq (,$(strip $(filter-out $(clean_targets) $(aux_targets),$(MAKECMDGOALS))))
103
+ifneq (,$(strip $(wildcard modules.lst)))
104
+-include modules.lst
105
+endif
106
+else
100 107
 include modules.lst
108
+endif # ifneq (,$(strip $(filter-out ...,$(MAKECMDGOALS))))
101 109
 
102 110
 #if called with group_include, ignore the modules from modules.lst
103 111
 ifneq ($(group_include),)
... ...
@@ -230,15 +242,17 @@ ALLDEP=config.mak Makefile Makefile.dirs Makefile.sources Makefile.rules
230 230
 #C_DEFS:=
231 231
 
232 232
 
233
-# try saved cfg, unless we are in the process of building it
234
-ifeq (,$(filter config.mak config cfg cfg-defs,$(MAKECMDGOALS)))
233
+# try saved cfg, unless we are in the process of building it or if we're doing
234
+# a clean
235
+ifeq (,$(strip \
236
+	$(filter config.mak config cfg cfg-defs $(clean_targets),$(MAKECMDGOALS))))
235 237
 include config.mak
236 238
 ifeq ($(makefile_defs),1)
237 239
 $(info config.mak loaded)
238 240
 # config_make valid & used
239 241
 config_mak=1
240 242
 endif
241
-else
243
+else # config.mak doesn't need to be used
242 244
 ifneq (,$(filter cfg config cfg-defs,$(word 1,$(MAKECMDGOALS))))
243 245
 # needed here to avoid starting a config submake 
244 246
 # (e.g. rm -f config.mak; make config.mak), which would either require 
... ...
@@ -351,7 +365,6 @@ ifneq ($(TLS),)
351 351
 endif
352 352
 
353 353
 # include the common rules
354
-include Makefile.targets
355 354
 include Makefile.rules
356 355
 
357 356
 #extra targets 
... ...
@@ -411,13 +424,14 @@ modules.lst:
411 411
 		$(call cfg_save_var2,$(mods),$@))
412 412
 	@echo "modules_configured:=1" >>$@
413 413
 
414
+
414 415
 .PHONY: cfg config cfg-defs
415 416
 cfg-defs: config.mak
416 417
 
417 418
 cfg config: cfg-defs modules-cfg
418 419
 
419 420
 .PHONY: modules-cfg modules-list modules-lst
420
-modules-cfg modules-list modules-lst: 
421
+modules-cfg modules-list modules-lst:
421 422
 	rm -f modules.lst
422 423
 	$(MAKE) modules.lst
423 424
 
... ...
@@ -851,23 +865,40 @@ install-man:  install-ser-man install-every-module-man
851 851
 
852 852
 
853 853
 
854
-.PHONY: clean_libs
854
+# libs cleaning targets
855
+.PHONY: clean-libs
856
+clean-libs:
857
+			$(MAKE) -C lib clean
855 858
 
856
-clean_libs:
857
-			$(MAKE) -C lib proper
859
+.PHONY: proper-libs realclean-libs distclean-libs maintainer-clean-libs
860
+proper-libs realclean-libs distclean-libs maintainer-clean-libs:
861
+			$(MAKE) -C lib $(patsubst %-libs,%,$@)
858 862
 
859 863
 
864
+# clean modules on make clean
865
+clean: clean-modules
866
+# clean utils on make clean
867
+clean: clean-utils
860 868
 # cleaning in libs always when cleaning ser
861
-clean:	clean_libs
869
+clean: clean-libs
870
+
871
+# proper/distclean a.s.o modules, utils and libs too
872
+
873
+proper: proper-modules proper-utils proper-libs
874
+distclean: distclean-modules distclean-utils distclean-libs
875
+realclean: realclean-modules realclean-utils realclean-libs
876
+maintainer-clean: maintainer-clean-modules maintainer-clean-utils \
877
+ maintainer-clean-libs
862 878
 
863 879
 #try to clean everything (including all the modules, even ones that are not
864 880
 # configured/compiled normally
865 881
 .PHONY: clean-all
866 882
 clean-all: cmodules=$(all_modules_lst)
867 883
 clean-all: clean
884
+maintainer-clean: modules=$(modules_all)
868 885
 
869 886
 # on make proper clean also the build config (w/o module list)
870
-proper realclean distclean: clean_cfg 
887
+proper realclean distclean maintainer-clean: clean_cfg
871 888
 
872 889
 # on maintainer clean, remove also the configured module list
873 890
 maintainer-clean: clean_modules_cfg
... ...
@@ -877,8 +908,8 @@ proper-all realclean-all distclean-all: cmodules=$(all_modules_lst)
877 877
 proper-all realclean-all distclean-all: proper
878 878
 
879 879
 
880
-.PHONY: clean_cfg
881
-clean_cfg:
880
+.PHONY: clean_cfg clean-cfg
881
+clean_cfg clean-cfg:
882 882
 	rm -f config.mak
883 883
 
884 884
 .PHONY: clean_modules_cfg clean-modules-cfg
... ...
@@ -163,15 +163,25 @@ clean:
163 163
 	@rm -f $(pdf_files)
164 164
 	@rm -f $(html_files)
165 165
 
166
-.PHONY: proper realclean distclean
167
-proper realclean distclean: clean
166
+.PHONY: proper distclean realclean maintainer-clean
167
+proper realclean distclean maintainer-clean: clean
168 168
 	@rm -f $(dep_files) *~
169 169
 
170
+maintainer-clean: clean-tmp
171
+
172
+.PHONY: clean-tmp
173
+clean-tmp:
174
+	-rm -f TAGS tags *.dbg .*.swp
175
+
176
+
170 177
 
171 178
 ifeq (,$(MAKECMDGOALS))
172 179
 include $(dep_files) 
180
+else
181
+ifeq (,$(strip $(nodep_targets)))
182
+include $(ROOT_DIR)/Makefile.targets
173 183
 endif
174
-ifneq (,$(filter-out clean proper realclean distclean check, $(MAKECMDGOALS)))
184
+ifneq (,$(filter-out $(nodep_targets) check, $(MAKECMDGOALS)))
175 185
 include $(dep_files)
176 186
 endif
177
-
187
+endif
... ...
@@ -123,16 +123,13 @@ link_clean:
123 123
 	-@rm -f $(LIB_RUNTIME_NAME)
124 124
 	-@rm -f $(LIB_LINK_NAME)
125 125
 
126
-clean: link_clean
126
+local-clean: link_clean
127 127
 
128
-ifneq ($(strip $(LIBINAME_F)),)
129 128
 .PHONY: libiname_clean
130
-
131 129
 libiname_clean:
132
-	-@rm -f "$(LIBINAME_F)"
130
+	-@rm -f libiname.lst
133 131
 
134
-clean: libiname_clean
135
-endif
132
+local-clean: libiname_clean
136 133
 
137 134
 $(lib_prefix)/$(lib_dir):
138 135
 	mkdir -p $(lib_prefix)/$(lib_dir)
... ...
@@ -170,54 +170,78 @@ dep: $(depends)
170 170
 .PHONY: static
171 171
 static: $(objs)
172 172
 
173
-.PHONY: clean
174
-clean: 
173
+# clean only the current directory (no modules or utils)
174
+# (it's usefull to have it separated from clean for speeding up make proper)
175
+.PHONY: local-clean
176
+local-clean:
175 177
 	-@rm -f $(objs) $(NAME) $(objs:.o=.il) librpath.lst 2>/dev/null
178
+
179
+.PHONY: clean
180
+clean: local-clean
181
+
182
+.PHONY: clean-modules
183
+clean-modules:
176 184
 	-@for r in $(cmodules) $(static_modules_path) "" ; do \
177 185
 		if [ -d "$$r" ]; then \
178 186
 			echo "module $$r" ; \
179
-			$(MAKE) -C $$r clean ; \
180
-			$(MAKE) -C $$r/doc clean ; \
187
+			$(MAKE) -C "$$r" clean ; \
188
+			[ -d "$$r"/doc/Makefile ] && $(MAKE) -C "$$r"/doc clean ; \
181 189
 		fi ; \
182
-	done 
190
+	done
191
+
192
+.PHONY: clean-utils
193
+clean-utils:
183 194
 	@if [ -n "$(cmodules)" ]; then \
184 195
 		for r in $(utils_compile) "" ; do \
185 196
 			if [ -d "$$r" ]; then \
186
-				 $(MAKE) -C $$r clean ; \
197
+				 $(MAKE) -C "$$r" clean ; \
187 198
 			fi ; \
188 199
 		done \
189 200
 	fi
190 201
 
202
+# make proper for the local directory
191 203
 .PHONY: proper
192 204
 .PHONY: distclean
193 205
 .PHONY: realclean
194
-proper realclean distclean: mrproper
195
-
196
-mrproper: clean 
206
+.PHONY: maintainer-clean
207
+proper distclean realclean maintainer-clean: local-clean
197 208
 	-@rm -f $(depends) $(auto_gen) $(auto_gen_others) \
198 209
 			makecfg.lst 2>/dev/null
210
+
211
+maintainer-clean: clean-tmp
212
+
213
+.PHONY: proper-modules
214
+.PHONY: distclean-modules
215
+.PHONY: realclean-modules
216
+.PHONY: maintainer-clean-modules
217
+proper-modules realclean-modules distclean-modules maintainer-clean-modules: \
218
+ clean_target=$(patsubst %-modules,%,$@)
219
+proper-modules realclean-modules distclean-modules maintainer-clean-modules:
199 220
 	-@for r in $(cmodules) "" ; do \
200 221
 		if [ -d "$$r" ]; then \
201
-			$(MAKE) -C $$r proper ; \
202
-			$(MAKE) -C $$r/doc proper ; \
222
+			$(MAKE) -C "$$r" $(clean_target); \
223
+			[ -r "$$r"/doc/Makefile ] && $(MAKE) -C "$$r"/doc $(clean_target);\
203 224
 		fi ; \
204
-	done 
225
+	done
226
+
227
+.PHONY: proper-utils
228
+.PHONY: distclean-utils
229
+.PHONY: realclean-utils
230
+.PHONY: maintainer-clean-utils
231
+proper-utils realclean-utils distclean-utils maintainer-clean-utils: \
232
+ clean_target=$(patsubst %-utils,%,$@)
233
+proper-utils realclean-utils distclean-utils maintainer-clean-utils:
205 234
 	@if [ -n "$(cmodules)" ]; then \
206 235
 		for r in $(utils_compile) "" ; do \
207 236
 			if [ -d "$$r" ]; then \
208
-				 $(MAKE) -C $$r proper ; \
237
+				 $(MAKE) -C "$$r" $(clean_target); \
209 238
 			fi ; \
210 239
 		done \
211 240
 	fi
212 241
 
213
-.PHONY: mantainer-cleaan
214
-mantainer-clean: distclean
215
-	-rm -f TAGS tags *.dbg .*.swp
216
-	-@for r in $(cmodules) "" ; do \
217
-		if [ -d "$$r" ]; then \
218
-			$(MAKE) -C $$r mantainer-clean; \
219
-		fi ; \
220
-	 done 
242
+.PHONY: clean-tmp
243
+clean-tmp:
244
+	-@rm -f TAGS tags *.dbg .*.swp
221 245
 
222 246
 
223 247
 .PHONY: doxygen
... ...
@@ -242,7 +266,7 @@ ifeq (,$(MAKECMDGOALS))
242 242
 -include $(depends)
243 243
 else
244 244
 ifeq (,$(strip $(nodep_targets)))
245
-include Makefile.targets
245
+include $(COREPATH)/Makefile.targets
246 246
 endif
247 247
 ifneq (,$(filter-out $(nodep_targets),$(MAKECMDGOALS)))
248 248
 -include $(depends)
... ...
@@ -17,9 +17,16 @@ ifeq (,$(strip $(modules_dirs)))
17 17
 include $(COREPATH)/Makefile.dirs
18 18
 endif
19 19
 
20
-clean_targets:=	clean proper distclean realclean mantainer-clean clean_libs \
20
+clean_targets:=	clean proper distclean realclean maintainer-clean local-clean \
21 21
 				clean-all proper-all distclean-all realclean-all \
22
-				clean_cfg clean_modules_cfg clean-modules-cfg
22
+				clean_cfg clean-cfg clean_modules_cfg clean-modules-cfg \
23
+				clean-modules proper-modules realclean-modules \
24
+				distclean-modules maintainer-clean-modules \
25
+				clean-utils proper-utils realclean-utils distclean-utils \
26
+				maintaner-clean-utils \
27
+				clean-libs proper-libs realclean-libs distclean-libs \
28
+				maintainer-clean-libs \
29
+				clean-tmp clean_doxygen
23 30
 doc_targets:=	README man install-doc install-man install-ser-man \
24 31
 		install-every-module-doc install-every-module-man \
25 32
 		$(foreach m,$(modules_dirs),$(m)-doc $(m)-readme $(m)-man) \
... ...
@@ -27,8 +34,8 @@ doc_targets:=	README man install-doc install-man install-ser-man \
27 27
 
28 28
 # auxiliary: maintance, debugging, etc. (don't affect code/objects)
29 29
 aux_targets:=	TAGS tar dist cfg-defs cfg config config.mak print-modules \
30
-		dbg dbinstall librpath.lst makecfg.lst \
31
-		modules-cfg modules-list modules-lst modules.lst mk-install_dirs
30
+		dbg dbinstall librpath.lst makecfg.lst modules.lst modules-cfg \
31
+		modules-list modules-lst mk-install_dirs
32 32
 # other targets that don't produce code in the current directory ("external")
33 33
 ext_targets:=	every-module $(modules_dirs) libs utils \
34 34
 		install-cfg install-utils  install-modules-all install-every-module\
... ...
@@ -7,7 +7,10 @@
7 7
 #
8 8
 
9 9
 
10
-SUBDIRS=binrpc cds xcap presence shm_regex
10
+#SUBDIRS=binrpc cds xcap presence shm_regex
11
+
12
+SUBDIRS=$(filter-out CVS doc $(lib_exclude), $(strip \
13
+			$(patsubst %/Makefile,%,$(wildcard */Makefile))))
11 14
 
12 15
 .PHONY: subdirs $(SUBDIRS) 
13 16
 
... ...
@@ -22,11 +25,11 @@ subdirs: $(SUBDIRS)
22 22
 $(SUBDIRS):	
23 23
 			-@echo "Making $(sub_goals) in $@" ; $(MAKE) $(sub_goals) -C $@
24 24
 
25
-all:	subdirs
25
+include ../Makefile.targets
26 26
 
27
-proper:	clean
27
+all:	subdirs
28 28
 
29
-clean:	subdirs
29
+$(clean_targets): subdirs
30 30
 
31 31
 install:	subdirs
32 32
 
... ...
@@ -3499,11 +3499,21 @@ inline static int handle_tcpconn_ev(struct tcp_connection* tcpconn, short ev,
3499 3499
 			}
3500 3500
 			if (unlikely(ev & POLLERR)){
3501 3501
 				if (unlikely(tcpconn->state=S_CONN_CONNECT)){
3502
+#ifdef USE_DST_BLACKLIST
3503
+					if (cfg_get(core, core_cfg, use_dst_blacklist))
3504
+						dst_blacklist_su(BLST_ERR_CONNECT, tcpconn->rcv.proto,
3505
+											&tcpconn->rcv.src_su, 0);
3506
+#endif /* USE_DST_BLACKLIST */
3502 3507
 					TCP_EV_CONNECT_ERR(0, TCP_LADDR(tcpconn),
3503 3508
 										TCP_LPORT(tcpconn), TCP_PSU(tcpconn),
3504 3509
 										TCP_PROTO(tcpconn));
3505 3510
 					TCP_STATS_CONNECT_FAILED();
3506 3511
 				}else{
3512
+#ifdef USE_DST_BLACKLIST
3513
+					if (cfg_get(core, core_cfg, use_dst_blacklist))
3514
+						dst_blacklist_su(BLST_ERR_SEND, tcpconn->rcv.proto,
3515
+											&tcpconn->rcv.src_su, 0);
3516
+#endif /* USE_DST_BLACKLIST */
3507 3517
 					TCP_STATS_CON_RESET(); /* FIXME: it could != RST */
3508 3518
 				}
3509 3519
 			}