Browse code

makefile: added CFG_NAME and SCR_NAME

CFG_NAME and SCR_NAME are used now to hold the name or prefix for
the config and scripts _in_ the repository. All this configs and
scripts will be installed using MAIN_NAME
(e.g. $(CFG_NAME)-basic.cfg is installed into
etc/$(MAIN_NAME)/$(MAIN_NAME)-basic.cfg).
This was needed to allow installing using different names, without
having to revert the recent mass re-naming of man, config and
scripts.

Andrei Pelinescu-Onciul authored on 24/06/2009 21:38:19
Showing 2 changed files
... ...
@@ -735,7 +735,7 @@ install: install-bin install-every-module install-cfg \
735 735
 .PHONY: dbinstall
736 736
 dbinstall:
737 737
 	-@echo "Initializing $(MAIN_NAME) database"
738
-	scripts/mysql/$(MAIN_NAME)_mysql.sh create
738
+	scripts/mysql/$(SCR_NAME)_mysql.sh create
739 739
 	-@echo "Done"
740 740
 
741 741
 .PHONY: README
... ...
@@ -779,8 +779,9 @@ $(man_prefix)/$(man_dir)/man5:
779 779
 # note: sed with POSIX.1 regex doesn't support |, + or ? (darwin, solaris ...) 
780 780
 install-cfg: $(cfg_prefix)/$(cfg_dir)
781 781
 		sed $(foreach m,$(modules_dirs),\
782
-				-e "s#/usr/[^:]*lib/$(MAIN_NAME)/$(m)\([:/\"]\)#$($(m)_target)\1#g") \
783
-			< etc/$(MAIN_NAME)-basic.cfg > $(cfg_prefix)/$(cfg_dir)$(MAIN_NAME).cfg.sample
782
+				-e "s#/usr/[^:]*lib/$(CFG_NAME)/$(m)\([:/\"]\)#$($(m)_target)\1#g") \
783
+			< etc/$(CFG_NAME)-basic.cfg > \
784
+			$(cfg_prefix)/$(cfg_dir)$(MAIN_NAME).cfg.sample
784 785
 		chmod 644 $(cfg_prefix)/$(cfg_dir)$(MAIN_NAME).cfg.sample
785 786
 		if [ -z "${skip_cfg_install}" -a \
786 787
 				! -f $(cfg_prefix)/$(cfg_dir)$(MAIN_NAME).cfg ]; then \
... ...
@@ -788,23 +789,24 @@ install-cfg: $(cfg_prefix)/$(cfg_dir)
788 789
 				$(cfg_prefix)/$(cfg_dir)$(MAIN_NAME).cfg; \
789 790
 		fi
790 791
 		sed $(foreach m,$(modules_dirs),\
791
-			-e "s#/usr/[^:]*lib/$(MAIN_NAME)/$(m)\([:/\"]\)#$($(m)_target)\1#g") \
792
-			< etc/$(MAIN_NAME)-oob.cfg \
792
+			-e "s#/usr/[^:]*lib/$(CFG_NAME)/$(m)\([:/\"]\)#$($(m)_target)\1#g") \
793
+			< etc/$(CFG_NAME)-oob.cfg \
793 794
 			> $(cfg_prefix)/$(cfg_dir)$(MAIN_NAME)-advanced.cfg.sample
794 795
 		chmod 644 $(cfg_prefix)/$(cfg_dir)$(MAIN_NAME)-advanced.cfg.sample
795 796
 		if [ -z "${skip_cfg_install}" -a \
796
-				! -f $(cfg_prefix)/$(cfg_dir)$(MAIN_NAME)-advanced.cfg ]; then \
797
+				! -f $(cfg_prefix)/$(cfg_dir)$(MAIN_NAME)-advanced.cfg ]; \
798
+		then \
797 799
 			mv -f $(cfg_prefix)/$(cfg_dir)$(MAIN_NAME)-advanced.cfg.sample \
798 800
 				$(cfg_prefix)/$(cfg_dir)$(MAIN_NAME)-advanced.cfg; \
799 801
 		fi
800 802
 		# radius dictionary
801
-		$(INSTALL_TOUCH) $(cfg_prefix)/$(cfg_dir)/dictionary.$(MAIN_NAME)
802
-		$(INSTALL_CFG) etc/dictionary.$(MAIN_NAME) $(cfg_prefix)/$(cfg_dir)
803
+		$(INSTALL_TOUCH) $(cfg_prefix)/$(cfg_dir)/dictionary.$(CFG_NAME)
804
+		$(INSTALL_CFG) etc/dictionary.$(CFG_NAME) $(cfg_prefix)/$(cfg_dir)
803 805
 
804 806
 		# TLS configuration
805 807
 		$(INSTALL_TOUCH) $(cfg_prefix)/$(cfg_dir)/tls.cfg
806 808
 		$(INSTALL_CFG) modules/tls/tls.cfg $(cfg_prefix)/$(cfg_dir)
807
-		modules/tls/$(MAIN_NAME)_cert.sh -d $(cfg_prefix)/$(cfg_dir)
809
+		modules/tls/$(SCR_NAME)_cert.sh -d $(cfg_prefix)/$(cfg_dir)
808 810
 
809 811
 install-bin: $(bin_prefix)/$(bin_dir) $(NAME)
810 812
 		$(INSTALL_TOUCH) $(bin_prefix)/$(bin_dir)/$(NAME)
... ...
@@ -869,7 +871,8 @@ install-utils: utils $(bin_prefix)/$(bin_dir)
869 871
 	# FIXME: This is a hack, this should be (and will be) done properly in
870 872
     # per-module Makefiles
871 873
 	sed -e "s#^DEFAULT_SCRIPT_DIR.*#DEFAULT_SCRIPT_DIR=\"$(share_prefix)/$(share_dir)\"#g" \
872
-		< scripts/mysql/$(MAIN_NAME)_mysql.sh > $(bin_prefix)/$(bin_dir)/$(MAIN_NAME)_mysql.sh
874
+		< scripts/mysql/$(SCR_NAME)_mysql.sh > \
875
+			$(bin_prefix)/$(bin_dir)/$(MAIN_NAME)_mysql.sh
873 876
 	chmod 755 $(bin_prefix)/$(bin_dir)/$(MAIN_NAME)_mysql.sh
874 877
 
875 878
 
... ...
@@ -889,23 +892,25 @@ install-doc: $(doc_prefix)/$(doc_dir) install-every-module-doc
889 892
 	$(INSTALL_DOC) README $(doc_prefix)/$(doc_dir)
890 893
 
891 894
 
892
-install-$(MAIN_NAME)-man: $(man_prefix)/$(man_dir)/man8 $(man_prefix)/$(man_dir)/man5
893
-		sed -e "s#/etc/$(MAIN_NAME)/$(MAIN_NAME)\.cfg#$(cfg_target)$(MAIN_NAME).cfg#g" \
895
+install-sr-man: $(man_prefix)/$(man_dir)/man8 $(man_prefix)/$(man_dir)/man5
896
+		sed -e "s#/etc/$(CFG_NAME)/$(CFG_NAME)\.cfg#$(cfg_target)$(MAIN_NAME).cfg#g" \
894 897
 			-e "s#/usr/sbin/#$(bin_target)#g" \
895 898
 			$(foreach m,$(modules_dirs),\
896
-				-e "s#/usr/lib/$(MAIN_NAME)/$(m)\([^_]\)#$($(m)_target)\1#g") \
897
-			-e "s#/usr/share/doc/$(MAIN_NAME)/#$(doc_target)#g" \
898
-			< $(MAIN_NAME).8 >  $(man_prefix)/$(man_dir)/man8/$(MAIN_NAME).8
899
+				-e "s#/usr/lib/$(CFG_NAME)/$(m)\([^_]\)#$($(m)_target)\1#g") \
900
+			-e "s#/usr/share/doc/$(CFG_NAME)/#$(doc_target)#g" \
901
+			< $(CFG_NAME).8 >  \
902
+							$(man_prefix)/$(man_dir)/man8/$(MAIN_NAME).8
899 903
 		chmod 644  $(man_prefix)/$(man_dir)/man8/$(MAIN_NAME).8
900
-		sed -e "s#/etc/$(MAIN_NAME)/$(MAIN_NAME)\.cfg#$(cfg_target)$(MAIN_NAME).cfg#g" \
904
+		sed -e "s#/etc/$(CFG_NAME)/$(CFG_NAME)\.cfg#$(cfg_target)$(MAIN_NAME).cfg#g" \
901 905
 			-e "s#/usr/sbin/#$(bin_target)#g" \
902 906
 			$(foreach m,$(modules_dirs),\
903
-				-e "s#/usr/lib/$(MAIN_NAME)/$(m)\([^_]\)#$($(m)_target)\1#g") \
904
-			-e "s#/usr/share/doc/$(MAIN_NAME)/#$(doc_target)#g" \
905
-			< $(MAIN_NAME).cfg.5 >  $(man_prefix)/$(man_dir)/man5/$(MAIN_NAME).cfg.5
907
+				-e "s#/usr/lib/$(CFG_NAME)/$(m)\([^_]\)#$($(m)_target)\1#g") \
908
+			-e "s#/usr/share/doc/$(CFG_NAME)/#$(doc_target)#g" \
909
+			< $(CFG_NAME).cfg.5 >  \
910
+			$(man_prefix)/$(man_dir)/man5/$(MAIN_NAME).cfg.5
906 911
 		chmod 644  $(man_prefix)/$(man_dir)/man5/$(MAIN_NAME).cfg.5
907 912
 
908
-install-man:  install-sip-router-man install-every-module-man
913
+install-man:  install-sr-man install-every-module-man
909 914
 
910 915
 
911 916
 
... ...
@@ -101,6 +101,11 @@ export makefile_defs
101 101
 $(info normal Makefile.defs exec)
102 102
 # main binary name
103 103
 MAIN_NAME=sip-router
104
+#prefix for various configs and scripts
105
+#config name/name-prefix for distributed configs
106
+CFG_NAME=sip-router
107
+#config name/name-prefix for distributed scripts
108
+SCR_NAME=sip-router
104 109
 
105 110
 #version number
106 111
 VERSION = 2
... ...
@@ -1698,7 +1703,7 @@ export exported_vars
1698 1703
 # variable changeable only at configure time (once saved in config.mak they
1699 1704
 #  cannot be overwritten from environment or command line, unless make cfg
1700 1705
 #  is run)
1701
-saved_fixed_vars:=	MAIN_NAME \
1706
+saved_fixed_vars:=	MAIN_NAME  CFG_NAME SCR_NAME \
1702 1707
 		RELEASE OS ARCH \
1703 1708
 		C_DEFS DEFS_RM PROFILE CC LD MKDEP MKTAGS LDFLAGS C_INCLUDES \
1704 1709
 		MOD_LDFLAGS LIB_LDFLAGS LIB_SONAME LD_RPATH \