[sr-dev] git:master: makefile: per modules arch. indep. files install support

Andrei Pelinescu-Onciul andrei at iptel.org
Thu Oct 1 17:01:09 CEST 2009


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

Author: Andrei Pelinescu-Onciul <andrei at iptel.org>
Committer: Andrei Pelinescu-Onciul <andrei at iptel.org>
Date:   Thu Oct  1 16:48:30 2009 +0200

makefile: per modules arch. indep. files install support

Support for easily adding arch. independent files that should be
installed along a module.
The following new module makefile variable is supported:

MOD_INSTALL_SHARE - list of files to install into the
arch-independent shared directory (by default
/usr/local/share/$(MAIN_NAME)).

---

 Makefile.modules |   33 ++++++++++++++++++++++++++++++++-
 1 files changed, 32 insertions(+), 1 deletions(-)

diff --git a/Makefile.modules b/Makefile.modules
index fab1bf9..f1f172b 100644
--- a/Makefile.modules
+++ b/Makefile.modules
@@ -48,6 +48,11 @@
 #
 # MOD_INSTALL_CFGS - list of extra config files that should be installed in
 #                    the main config directory, along the module (OPTIONAL).
+#
+# MOD_INSTALL_SHARE - list of files to install into the arch-independent
+#                     shared directory (by default
+#                     /usr/local/share/$(MAIN_NAME))
+#
 
 MOD_NAME=$(NAME:.so=)
 
@@ -119,7 +124,7 @@ LIBS:=$(filter-out -ldl -lresolv, $(LIBS))
 .PHONY: install-scripts
 .PHONY: install-cfgs
 install: $(NAME) $(mods_dst) install-libs install-utils install-scripts \
-		install-cfg
+		install-cfg install-share
 	$(INSTALL_TOUCH) $(mods_dst)/$(NAME)
 	$(INSTALL_MODULES)  $(NAME)  $(mods_dst)
 
@@ -191,6 +196,29 @@ install-cfg:
 
 endif # $(MOD_INSTALL_CFGS)
 
+ifneq (,$(MOD_INSTALL_SHARE))
+install-share: $(share_prefix)/$(share_dir)
+	@for r in $(MOD_INSTALL_SHARE) ; do \
+		if [ -n "$$r" ]; then \
+			if [ -f "$$r" ]; then \
+				$(call try_err, $(INSTALL_TOUCH) \
+					$(share_prefix)/$(share_dir)/`basename "$$r"` ); \
+				$(call try_err,\
+					$(INSTALL_SHARE)  "$$r"  $(share_prefix)/$(share_dir) ); \
+			else \
+				echo "ERROR: $$r not found" ; \
+				if [ ${err_fail} = 1 ] ; then \
+					exit 1; \
+				fi ; \
+			fi ; \
+		fi ; \
+	done; true
+
+else
+install-share:
+
+endif # $(MOD_INSTALL_SHARE)
+
 
 $(bin_prefix)/$(bin_dir):
 	mkdir -p $@
@@ -198,6 +226,9 @@ $(bin_prefix)/$(bin_dir):
 $(cfg_prefix)/$(cfg_dir):
 	mkdir -p $@
 
+$(share_prefix)/$(share_dir):
+	mkdir -p $@
+
 # README build rules
 ifneq (,$(wildcard doc/Makefile))
 #doc/Makefile present => we can generate README




More information about the sr-dev mailing list