[sr-dev] git:master: makefile: FLAVOUR support

Andrei Pelinescu-Onciul andrei at iptel.org
Sat Oct 10 00:45:49 CEST 2009


Module: sip-router
Branch: master
Commit: caf3128c5495d4bf556af246550e0789cc795dc6
URL:    http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=caf3128c5495d4bf556af246550e0789cc795dc6

Author: Andrei Pelinescu-Onciul <andrei at iptel.org>
Committer: Andrei Pelinescu-Onciul <andrei at iptel.org>
Date:   Sat Oct 10 00:38:34 2009 +0200

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.

---

 Makefile         |    8 +++++++-
 Makefile.defs    |   21 ++++++++++++++++++++-
 Makefile.targets |    2 +-
 3 files changed, 28 insertions(+), 3 deletions(-)

diff --git a/Makefile b/Makefile
index 88d96e6..768c080 100644
--- a/Makefile
+++ b/Makefile
@@ -915,6 +915,8 @@ proper-libs realclean-libs distclean-libs maintainer-clean-libs:
 			$(MAKE) -C lib $(patsubst %-libs,%,$@)
 
 
+# clean extra binary names (common "flavour" names)
+clean: clean-extra-names
 # clean modules on make clean
 clean: clean-modules
 # clean utils on make clean
@@ -922,9 +924,13 @@ clean: clean-utils
 # cleaning in libs always when cleaning sip-router
 clean: clean-libs
 
+.PHONY: clean-extra-names
+clean-extra-names:
+	@rm -f $(filter-out $(MAIN_NAME), sip-router ser kamailio)
+
 # proper/distclean a.s.o modules, utils and libs too
 
-proper: proper-modules proper-utils proper-libs
+proper: clean-extra-names proper-modules proper-utils proper-libs
 distclean: distclean-modules distclean-utils distclean-libs
 realclean: realclean-modules realclean-utils realclean-libs
 maintainer-clean: maintainer-clean-modules maintainer-clean-utils \
diff --git a/Makefile.defs b/Makefile.defs
index ee02e39..d3d14b0 100644
--- a/Makefile.defs
+++ b/Makefile.defs
@@ -111,14 +111,33 @@ export makefile_defs
 ifeq ($(quiet),verbose)
 $(info normal Makefile.defs exec)
 endif # verbose
+
+# flavour: sip-router, ser or kamailio
+FLAVOUR=sip-router
+
+ifeq ($(FLAVOUR),sip-router)
 # main binary name
 MAIN_NAME=ser
+else ifeq ($(FLAVOUR),ser)
+# main binary name
+MAIN_NAME=ser
+else ifeq ($(FLAVOUR),kamailio)
+# main binary name
+MAIN_NAME=kamailio
+else # default:
+# main binary name
+MAIN_NAME=sip-router
+endif
+
 #prefix for various configs and scripts
 #config name/name-prefix for distributed configs
 CFG_NAME=sip-router
 #config name/name-prefix for distributed scripts
 SCR_NAME=sip-router
 
+# what to install
+INSTALL_FLAVOUR=$(FLAVOUR)
+
 #version number
 VERSION = 2
 PATCHLEVEL = 99
@@ -1898,7 +1917,7 @@ export exported_vars
 # variable changeable only at configure time (once saved in config.mak they
 #  cannot be overwritten from environment or command line, unless make cfg
 #  is run)
-saved_fixed_vars:=	MAIN_NAME  CFG_NAME SCR_NAME \
+saved_fixed_vars:=	MAIN_NAME  CFG_NAME SCR_NAME FLAVOUR INSTALL_FLAVOUR \
 		RELEASE OS ARCH \
 		C_DEFS DEFS_RM PROFILE CC LD MKDEP MKTAGS LDFLAGS C_INCLUDES \
 		MOD_LDFLAGS LIB_LDFLAGS UTILS_LDFLAGS LIB_SONAME LD_RPATH \
diff --git a/Makefile.targets b/Makefile.targets
index 3541bfe..eeb0f5a 100644
--- a/Makefile.targets
+++ b/Makefile.targets
@@ -26,7 +26,7 @@ clean_targets:=	clean proper distclean realclean maintainer-clean local-clean \
 				maintaner-clean-utils \
 				clean-libs proper-libs realclean-libs distclean-libs \
 				maintainer-clean-libs \
-				clean-tmp clean_doxygen
+				clean-tmp clean_doxygen clean-extra-names
 doc_targets:=	README man install-doc install-man install-ser-man \
 		install-every-module-doc install-every-module-man \
 		$(foreach m,$(modules_dirs),$(m)-doc $(m)-readme $(m)-man) \




More information about the sr-dev mailing list