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 788
 				$(cfg_prefix)/$(cfg_dir)$(MAIN_NAME).cfg; \
789 789
 		fi
790 790
 		sed $(foreach m,$(modules_dirs),\
791
-			-e "s#/usr/[^:]*lib/$(MAIN_NAME)/$(m)\([:/\"]\)#$($(m)_target)\1#g") \
792
-			< etc/$(MAIN_NAME)-oob.cfg \
791
+			-e "s#/usr/[^:]*lib/$(CFG_NAME)/$(m)\([:/\"]\)#$($(m)_target)\1#g") \
792
+			< etc/$(CFG_NAME)-oob.cfg \
793 793
 			> $(cfg_prefix)/$(cfg_dir)$(MAIN_NAME)-advanced.cfg.sample
794 794
 		chmod 644 $(cfg_prefix)/$(cfg_dir)$(MAIN_NAME)-advanced.cfg.sample
795 795
 		if [ -z "${skip_cfg_install}" -a \
796
-				! -f $(cfg_prefix)/$(cfg_dir)$(MAIN_NAME)-advanced.cfg ]; then \
796
+				! -f $(cfg_prefix)/$(cfg_dir)$(MAIN_NAME)-advanced.cfg ]; \
797
+		then \
797 798
 			mv -f $(cfg_prefix)/$(cfg_dir)$(MAIN_NAME)-advanced.cfg.sample \
798 799
 				$(cfg_prefix)/$(cfg_dir)$(MAIN_NAME)-advanced.cfg; \
799 800
 		fi
800 801
 		# radius dictionary
801
-		$(INSTALL_TOUCH) $(cfg_prefix)/$(cfg_dir)/dictionary.$(MAIN_NAME)
802
-		$(INSTALL_CFG) etc/dictionary.$(MAIN_NAME) $(cfg_prefix)/$(cfg_dir)
802
+		$(INSTALL_TOUCH) $(cfg_prefix)/$(cfg_dir)/dictionary.$(CFG_NAME)
803
+		$(INSTALL_CFG) etc/dictionary.$(CFG_NAME) $(cfg_prefix)/$(cfg_dir)
803 804
 
804 805
 		# TLS configuration
805 806
 		$(INSTALL_TOUCH) $(cfg_prefix)/$(cfg_dir)/tls.cfg
806 807
 		$(INSTALL_CFG) modules/tls/tls.cfg $(cfg_prefix)/$(cfg_dir)
807
-		modules/tls/$(MAIN_NAME)_cert.sh -d $(cfg_prefix)/$(cfg_dir)
808
+		modules/tls/$(SCR_NAME)_cert.sh -d $(cfg_prefix)/$(cfg_dir)
808 809
 
809 810
 install-bin: $(bin_prefix)/$(bin_dir) $(NAME)
810 811
 		$(INSTALL_TOUCH) $(bin_prefix)/$(bin_dir)/$(NAME)
... ...
@@ -869,7 +871,8 @@ install-utils: utils $(bin_prefix)/$(bin_dir)
869 869
 	# FIXME: This is a hack, this should be (and will be) done properly in
870 870
     # per-module Makefiles
871 871
 	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
872
+		< scripts/mysql/$(SCR_NAME)_mysql.sh > \
873
+			$(bin_prefix)/$(bin_dir)/$(MAIN_NAME)_mysql.sh
873 874
 	chmod 755 $(bin_prefix)/$(bin_dir)/$(MAIN_NAME)_mysql.sh
874 875
 
875 876
 
... ...
@@ -889,23 +892,25 @@ install-doc: $(doc_prefix)/$(doc_dir) install-every-module-doc
889 889
 	$(INSTALL_DOC) README $(doc_prefix)/$(doc_dir)
890 890
 
891 891
 
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" \
892
+install-sr-man: $(man_prefix)/$(man_dir)/man8 $(man_prefix)/$(man_dir)/man5
893
+		sed -e "s#/etc/$(CFG_NAME)/$(CFG_NAME)\.cfg#$(cfg_target)$(MAIN_NAME).cfg#g" \
894 894
 			-e "s#/usr/sbin/#$(bin_target)#g" \
895 895
 			$(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
896
+				-e "s#/usr/lib/$(CFG_NAME)/$(m)\([^_]\)#$($(m)_target)\1#g") \
897
+			-e "s#/usr/share/doc/$(CFG_NAME)/#$(doc_target)#g" \
898
+			< $(CFG_NAME).8 >  \
899
+							$(man_prefix)/$(man_dir)/man8/$(MAIN_NAME).8
899 900
 		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" \
901
+		sed -e "s#/etc/$(CFG_NAME)/$(CFG_NAME)\.cfg#$(cfg_target)$(MAIN_NAME).cfg#g" \
901 902
 			-e "s#/usr/sbin/#$(bin_target)#g" \
902 903
 			$(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
904
+				-e "s#/usr/lib/$(CFG_NAME)/$(m)\([^_]\)#$($(m)_target)\1#g") \
905
+			-e "s#/usr/share/doc/$(CFG_NAME)/#$(doc_target)#g" \
906
+			< $(CFG_NAME).cfg.5 >  \
907
+			$(man_prefix)/$(man_dir)/man5/$(MAIN_NAME).cfg.5
906 908
 		chmod 644  $(man_prefix)/$(man_dir)/man5/$(MAIN_NAME).cfg.5
907 909
 
908
-install-man:  install-sip-router-man install-every-module-man
910
+install-man:  install-sr-man install-every-module-man
909 911
 
910 912
 
911 913
 
... ...
@@ -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 1698
 # variable changeable only at configure time (once saved in config.mak they
1699 1699
 #  cannot be overwritten from environment or command line, unless make cfg
1700 1700
 #  is run)
1701
-saved_fixed_vars:=	MAIN_NAME \
1701
+saved_fixed_vars:=	MAIN_NAME  CFG_NAME SCR_NAME \
1702 1702
 		RELEASE OS ARCH \
1703 1703
 		C_DEFS DEFS_RM PROFILE CC LD MKDEP MKTAGS LDFLAGS C_INCLUDES \
1704 1704
 		MOD_LDFLAGS LIB_LDFLAGS LIB_SONAME LD_RPATH \