Browse code

make: fix the module path in installed cfg

- fix: the module path is updated in the installed cfg and man
pages (broken when the multiple modules were added).

Andrei Pelinescu-Onciul authored on 06/05/2009 15:48:05
Showing 2 changed files
... ...
@@ -382,7 +382,8 @@ nullstring=
382 382
 space=$(nullstring) $(nullstring)
383 383
 
384 384
 modules_search_path=$(subst $(space),:,$(strip\
385
-						$(addprefix $(modules_target),$(modules_dirs))))
385
+						$(foreach m,$(modules_dirs),$($(m)_target))))
386
+		#				$(addprefix $(modules_target),$(modules_dirs))))
386 387
 
387 388
 main.o: DEFS+=-DMODS_DIR='"$(modules_search_path)"'
388 389
 
... ...
@@ -455,6 +456,7 @@ print-modules:
455 455
 define MODULES_RULES_template
456 456
 
457 457
 $(1)_dst=$(modules_prefix)/$(modules_dir)$(1)
458
+$(1)_target=$(prefix)/$(modules_dir)$(1)
458 459
 
459 460
 .PHONY: $(1)
460 461
 $(1): modules.lst
... ...
@@ -738,7 +740,8 @@ $(man_prefix)/$(man_dir)/man5:
738 738
 
739 739
 # note: sed with POSIX.1 regex doesn't support |, + or ? (darwin, solaris ...) 
740 740
 install-cfg: $(cfg_prefix)/$(cfg_dir)
741
-		sed -e "s#/usr/.*lib/ser/modules/#$(modules-target)#g" \
741
+		sed $(foreach m,$(modules_dirs),\
742
+				-e "s#/usr/[^:]*lib/ser/$(m)\([:/\"]\)#$($(m)_target)\1#g") \
742 743
 			< etc/ser-basic.cfg > $(cfg_prefix)/$(cfg_dir)ser.cfg.sample
743 744
 		chmod 644 $(cfg_prefix)/$(cfg_dir)ser.cfg.sample
744 745
 		if [ -z "${skip_cfg_install}" -a \
... ...
@@ -746,7 +749,8 @@ install-cfg: $(cfg_prefix)/$(cfg_dir)
746 746
 			mv -f $(cfg_prefix)/$(cfg_dir)ser.cfg.sample \
747 747
 				$(cfg_prefix)/$(cfg_dir)ser.cfg; \
748 748
 		fi
749
-		sed -e "s#/usr/.*lib/ser/modules/#$(modules-target)#g" \
749
+		sed $(foreach m,$(modules_dirs),\
750
+			-e "s#/usr/[^:]*lib/ser/$(m)\([:/\"]\)#$($(m)_target)\1#g") \
750 751
 			< etc/ser-oob.cfg \
751 752
 			> $(cfg_prefix)/$(cfg_dir)ser-advanced.cfg.sample
752 753
 		chmod 644 $(cfg_prefix)/$(cfg_dir)ser-advanced.cfg.sample
... ...
@@ -850,13 +854,15 @@ install-doc: $(doc_prefix)/$(doc_dir) install-every-module-doc
850 850
 install-ser-man: $(man_prefix)/$(man_dir)/man8 $(man_prefix)/$(man_dir)/man5
851 851
 		sed -e "s#/etc/ser/ser\.cfg#$(cfg_target)ser.cfg#g" \
852 852
 			-e "s#/usr/sbin/#$(bin_target)#g" \
853
-			-e "s#/usr/lib/ser/modules/#$(modules_target)#g" \
853
+			$(foreach m,$(modules_dirs),\
854
+				-e "s#/usr/lib/ser/$(m)\([^_]\)#$($(m)_target)\1#g") \
854 855
 			-e "s#/usr/share/doc/ser/#$(doc_target)#g" \
855 856
 			< ser.8 >  $(man_prefix)/$(man_dir)/man8/ser.8
856 857
 		chmod 644  $(man_prefix)/$(man_dir)/man8/ser.8
857 858
 		sed -e "s#/etc/ser/ser\.cfg#$(cfg_target)ser.cfg#g" \
858 859
 			-e "s#/usr/sbin/#$(bin_target)#g" \
859
-			-e "s#/usr/lib/ser/modules/#$(modules_target)#g" \
860
+			$(foreach m,$(modules_dirs),\
861
+				-e "s#/usr/lib/ser/$(m)\([^_]\)#$($(m)_target)\1#g") \
860 862
 			-e "s#/usr/share/doc/ser/#$(doc_target)#g" \
861 863
 			< ser.cfg.5 >  $(man_prefix)/$(man_dir)/man5/ser.cfg.5
862 864
 		chmod 644  $(man_prefix)/$(man_dir)/man5/ser.cfg.5
... ...
@@ -234,7 +234,7 @@ share_prefix = $(basedir)$(prefix)
234 234
 # target dirs for various stuff
235 235
 cfg_target = $(prefix)/$(cfg_dir)
236 236
 bin_target = $(prefix)/$(bin_dir)
237
-modules_target = $(prefix)/$(modules_dir)
237
+#modules_target = $(prefix)/$(modules_dir)
238 238
 lib_target = $(prefix)/$(lib_dir)
239 239
 doc_target = $(prefix)/$(doc_dir)
240 240
 
... ...
@@ -1709,7 +1709,7 @@ saved_chg_vars:=\
1709 1709
 		cfg_prefix cfg_dir bin_prefix bin_dir modules_prefix modules_dir \
1710 1710
 		doc_prefix doc_dir man_prefix man_dir ut_prefix ut_dir \
1711 1711
 		share_prefix share_dir lib_prefix lib_dir \
1712
-		cfg_target lib_target modules_target
1712
+		cfg_target lib_target
1713 1713
 
1714 1714
 
1715 1715
 #export relevant variables to the sub-makes