Browse code

- better utils handling: make utils will compile them, make install-utils will install them, as well as make install. They also also properly cleaned on make proper.

Andrei Pelinescu-Onciul authored on 14/02/2006 17:41:23
Showing 2 changed files
... ...
@@ -29,6 +29,7 @@
29 29
 #              added skip_cfg_install (andrei)
30 30
 #  2004-09-02  install-man will automatically "fix" the path of the files
31 31
 #               referred in the man pages
32
+#  2006-02-14  added utils & install-utils (andrei)
32 33
 #
33 34
 
34 35
 auto_gen=lex.yy.c cfg.tab.c #lexx, yacc etc
... ...
@@ -88,6 +89,13 @@ modules_basenames=$(shell echo $(modules)| \
88 88
 modules_full_path=$(join  $(modules), $(addprefix /, $(modules_names)))
89 89
 
90 90
 
91
+# which utils need compilation (directory path) and which to install
92
+# (full path including file name)
93
+utils_compile=	utils/gen_ha1 utils/serunix
94
+utils_install=	utils/gen_ha1/gen_ha1 utils/serunix/serunix \
95
+				scripts/sc scripts/mysql/ser_mysql.sh
96
+
97
+
91 98
 ALLDEP=Makefile Makefile.sources Makefile.defs Makefile.rules
92 99
 
93 100
 #include general defs (like CC, CFLAGS  a.s.o)
... ...
@@ -160,6 +168,15 @@ $(extra_objs):
160 160
 		fi ; \
161 161
 	done 
162 162
 
163
+.PHONY: utils
164
+utils:
165
+	-@for r in $(utils_compile) "" ; do \
166
+		if [ -n "$$r" ]; then \
167
+			echo  "" ; \
168
+			echo  "" ; \
169
+			$(MAKE) -C $$r ; \
170
+		fi ; \
171
+	done 
163 172
 
164 173
 	
165 174
 dbg: ser
... ...
@@ -231,7 +248,8 @@ sunpkg:
231 231
 
232 232
 .PHONY: install
233 233
 install: all mk-install-dirs install-cfg install-bin install-modules \
234
-	install-doc install-man
234
+	install-doc install-man install-utils
235
+		mv -f $(bin-prefix)/$(bin-dir)/sc $(bin-prefix)/$(bin-dir)/serctl #fix
235 236
 
236 237
 .PHONY: dbinstall
237 238
 dbinstall:
... ...
@@ -278,24 +296,9 @@ install-cfg: $(cfg-prefix)/$(cfg-dir)
278 278
 		$(INSTALL-CFG) etc/dictionary.ser $(cfg-prefix)/$(cfg-dir)
279 279
 #		$(INSTALL-CFG) etc/ser.cfg $(cfg-prefix)/$(cfg-dir)
280 280
 
281
-install-bin: $(bin-prefix)/$(bin-dir) utils/gen_ha1/gen_ha1 utils/serunix/serunix
281
+install-bin: $(bin-prefix)/$(bin-dir) 
282 282
 		$(INSTALL-TOUCH) $(bin-prefix)/$(bin-dir)/ser 
283 283
 		$(INSTALL-BIN) ser $(bin-prefix)/$(bin-dir)
284
-		$(INSTALL-TOUCH)   $(bin-prefix)/$(bin-dir)/sc
285
-		$(INSTALL-BIN) scripts/sc $(bin-prefix)/$(bin-dir)
286
-		mv -f $(bin-prefix)/$(bin-dir)/sc $(bin-prefix)/$(bin-dir)/serctl
287
-		$(INSTALL-TOUCH)   $(bin-prefix)/$(bin-dir)/ser_mysql.sh  
288
-		$(INSTALL-BIN) scripts/mysql/ser_mysql.sh  $(bin-prefix)/$(bin-dir)
289
-		$(INSTALL-TOUCH)   $(bin-prefix)/$(bin-dir)/gen_ha1
290
-		$(INSTALL-BIN) utils/gen_ha1/gen_ha1 $(bin-prefix)/$(bin-dir)
291
-		$(INSTALL-TOUCH)   $(bin-prefix)/$(bin-dir)/serunix
292
-		$(INSTALL-BIN) utils/serunix/serunix $(bin-prefix)/$(bin-dir)
293
-
294
-utils/gen_ha1/gen_ha1:
295
-		cd utils/gen_ha1; $(MAKE) all
296
-
297
-utils/serunix/serunix:
298
-		cd utils/serunix; $(MAKE) all
299 284
 
300 285
 install-modules: modules $(modules-prefix)/$(modules-dir)
301 286
 	-@for r in $(modules_full_path) "" ; do \
... ...
@@ -310,6 +313,20 @@ install-modules: modules $(modules-prefix)/$(modules-dir)
310 310
 		fi ; \
311 311
 	done 
312 312
 
313
+install-utils: utils $(bin-prefix)/$(bin-dir)
314
+	-@for r in $(utils_install) "" ; do \
315
+		if [ -n "$$r" ]; then \
316
+			if [ -f "$$r" ]; then \
317
+				$(INSTALL-TOUCH) \
318
+					$(bin-prefix)/$(bin-dir)/`basename "$$r"` ; \
319
+				$(INSTALL-BIN)  "$$r"  $(bin-prefix)/$(bin-dir) ; \
320
+			else \
321
+				echo "ERROR: $$r not compiled" ; \
322
+			fi ;\
323
+		fi ; \
324
+	done 
325
+
326
+
313 327
 
314 328
 install-modules-all: install-modules install-modules-doc
315 329
 
... ...
@@ -45,10 +45,13 @@ clean:
45 45
 			echo "module $$r" ; \
46 46
 			$(MAKE) -C $$r clean ; \
47 47
 		fi ; \
48
-	done
49
-	@if [ -n "$(modules)" -a -d utils/gen_ha1 ]; then \
50
-		cd utils/gen_ha1; $(MAKE) clean; \
51
-		cd ../serunix; $(MAKE) clean; \
48
+	done 
49
+	@if [ -n "$(modules)" ]; then \
50
+		for r in $(utils_compile) "" ; do \
51
+			if [ -d "$$r" ]; then \
52
+				 $(MAKE) -C $$r clean ; \
53
+			fi ; \
54
+		done \
52 55
 	fi
53 56
 
54 57
 .PHONY: proper
... ...
@@ -61,6 +64,13 @@ proper realclean distclean: clean
61 61
 			 $(MAKE) -C $$r proper ; \
62 62
 		fi ; \
63 63
 	done 
64
+	@if [ -n "$(modules)" ]; then \
65
+		for r in $(utils_compile) "" ; do \
66
+			if [ -d "$$r" ]; then \
67
+				 $(MAKE) -C $$r proper ; \
68
+			fi ; \
69
+		done \
70
+	fi
64 71
 
65 72
 .PHONY: mantainer-cleaan
66 73
 mantainer-clean: distclean