Browse code

makefile: FLAVOUR support

Basic support for sip-router, ser and kamailio flavours and
install flavours, e.g.:
make config FLAVOUR=sip-router
make config INSTALL_FLAVOUR=kamailio; make install (will install
only kamailio specific tools, but won't change the main name)
make config FLAVOUR=ser; make install (will install ser tools and
change the name to ser).

Note that FLAVOUR does not influence the module list (one should
use modules_dirs, group_include and/or modules, modules_s,
modules_k) and that for now choosing kamailio will only change the
name.

Andrei Pelinescu-Onciul authored on 09/10/2009 22:38:34
Showing 3 changed files
... ...
@@ -915,6 +915,8 @@ proper-libs realclean-libs distclean-libs maintainer-clean-libs:
915 915
 			$(MAKE) -C lib $(patsubst %-libs,%,$@)
916 916
 
917 917
 
918
+# clean extra binary names (common "flavour" names)
919
+clean: clean-extra-names
918 920
 # clean modules on make clean
919 921
 clean: clean-modules
920 922
 # clean utils on make clean
... ...
@@ -922,9 +924,13 @@ clean: clean-utils
922 922
 # cleaning in libs always when cleaning sip-router
923 923
 clean: clean-libs
924 924
 
925
+.PHONY: clean-extra-names
926
+clean-extra-names:
927
+	@rm -f $(filter-out $(MAIN_NAME), sip-router ser kamailio)
928
+
925 929
 # proper/distclean a.s.o modules, utils and libs too
926 930
 
927
-proper: proper-modules proper-utils proper-libs
931
+proper: clean-extra-names proper-modules proper-utils proper-libs
928 932
 distclean: distclean-modules distclean-utils distclean-libs
929 933
 realclean: realclean-modules realclean-utils realclean-libs
930 934
 maintainer-clean: maintainer-clean-modules maintainer-clean-utils \
... ...
@@ -111,14 +111,33 @@ export makefile_defs
111 111
 ifeq ($(quiet),verbose)
112 112
 $(info normal Makefile.defs exec)
113 113
 endif # verbose
114
+
115
+# flavour: sip-router, ser or kamailio
116
+FLAVOUR=sip-router
117
+
118
+ifeq ($(FLAVOUR),sip-router)
114 119
 # main binary name
115 120
 MAIN_NAME=ser
121
+else ifeq ($(FLAVOUR),ser)
122
+# main binary name
123
+MAIN_NAME=ser
124
+else ifeq ($(FLAVOUR),kamailio)
125
+# main binary name
126
+MAIN_NAME=kamailio
127
+else # default:
128
+# main binary name
129
+MAIN_NAME=sip-router
130
+endif
131
+
116 132
 #prefix for various configs and scripts
117 133
 #config name/name-prefix for distributed configs
118 134
 CFG_NAME=sip-router
119 135
 #config name/name-prefix for distributed scripts
120 136
 SCR_NAME=sip-router
121 137
 
138
+# what to install
139
+INSTALL_FLAVOUR=$(FLAVOUR)
140
+
122 141
 #version number
123 142
 VERSION = 2
124 143
 PATCHLEVEL = 99
... ...
@@ -1898,7 +1917,7 @@ export exported_vars
1898 1898
 # variable changeable only at configure time (once saved in config.mak they
1899 1899
 #  cannot be overwritten from environment or command line, unless make cfg
1900 1900
 #  is run)
1901
-saved_fixed_vars:=	MAIN_NAME  CFG_NAME SCR_NAME \
1901
+saved_fixed_vars:=	MAIN_NAME  CFG_NAME SCR_NAME FLAVOUR INSTALL_FLAVOUR \
1902 1902
 		RELEASE OS ARCH \
1903 1903
 		C_DEFS DEFS_RM PROFILE CC LD MKDEP MKTAGS LDFLAGS C_INCLUDES \
1904 1904
 		MOD_LDFLAGS LIB_LDFLAGS UTILS_LDFLAGS LIB_SONAME LD_RPATH \
... ...
@@ -26,7 +26,7 @@ clean_targets:=	clean proper distclean realclean maintainer-clean local-clean \
26 26
 				maintaner-clean-utils \
27 27
 				clean-libs proper-libs realclean-libs distclean-libs \
28 28
 				maintainer-clean-libs \
29
-				clean-tmp clean_doxygen
29
+				clean-tmp clean_doxygen clean-extra-names
30 30
 doc_targets:=	README man install-doc install-man install-ser-man \
31 31
 		install-every-module-doc install-every-module-man \
32 32
 		$(foreach m,$(modules_dirs),$(m)-doc $(m)-readme $(m)-man) \