[sr-dev] git:master: makefile: make install for utils

Andrei Pelinescu-Onciul andrei at iptel.org
Thu Oct 1 13:47:49 CEST 2009


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

Author: Andrei Pelinescu-Onciul <andrei at iptel.org>
Committer: Andrei Pelinescu-Onciul <andrei at iptel.org>
Date:   Thu Oct  1 13:42:36 2009 +0200

makefile: make install for utils

- make install for utils
- various small Makefile.utils fixes

---

 Makefile.utils |   39 ++++++++++++++++++++++++++++++++++-----
 1 files changed, 34 insertions(+), 5 deletions(-)

diff --git a/Makefile.utils b/Makefile.utils
index 8c31594..0c38a79 100644
--- a/Makefile.utils
+++ b/Makefile.utils
@@ -8,6 +8,7 @@
 # --------
 #  2009-04-23  initial version derived from Makefile.modules (andrei)
 
+UTIL_NAME=$(NAME)
 
 # default path to the core makefiles
 COREPATH ?=../..
@@ -20,6 +21,9 @@ override modules=
 override static_modules=
 override static_modules_path=
 
+# temporary def (visible only in the util makefile, not exported)
+DEFS +=
+
 ifneq ($(makefile_defs_included),1)
 $(error "the local makefile does not include Makefile.defs!")
 endif
@@ -41,20 +45,45 @@ include $(COREPATH)/Makefile.sources
 # the rest of makefile and try only to remake the config
 ifeq ($(makefile_defs),1)
 
+err_fail?=1
 
 include $(COREPATH)/Makefile.dirs
 include $(COREPATH)/Makefile.targets
 include $(COREPATH)/Makefile.rules
+include $(COREPATH)/Makefile.shared
+
+# default: if not overwritten by the main Makefile, install in bin_dir
+util_dst=$(bin_prefix)/$(bin_dir)
+
+$(util_dst):
+		mkdir -p $(util_dst)
 
 modules:
 
+.PHONY: install
+.PHONY: install-libs
+install: $(NAME) $(util_dst) install-libs
+	$(INSTALL_TOUCH) $(util_dst)/$(NAME)
+	$(INSTALL_BIN)  $(NAME)  $(util_dst)
+
+install-libs:
+	@for lib in $(dir $(SER_LIBS)); do \
+		$(call try_err, $(MAKE) -C "$${lib}" install-if-newer ) ;\
+	done
+
+.PHONY: install-if-newer
+install-if-newer: $(util_dst)/$(NAME)
+
+$(util_dst)/$(NAME): $(NAME)
+	@$(MAKE) install
+
 # README build rules
 ifneq (,$(wildcard doc/Makefile))
 #doc/Makefile present => we can generate README
 
 README: doc/*.xml
-	$(MAKE) -C doc $(MOD_NAME).txt
-	mv doc/$(MOD_NAME).txt $@
+	$(MAKE) -C doc $(UTIL_NAME).txt
+	mv doc/$(UTIL_NAME).txt $@
 
 else
 # do nothing
@@ -63,12 +92,12 @@ README:
 endif
 
 #man page build rules
-ifneq (,$(wildcard $(MOD_NAME).xml))
+ifneq (,$(wildcard $(UTIL_NAME).xml))
 
-$(MOD_NAME).7: $(MOD_NAME).xml
+$(UTIL_NAME).7: $(UTIL_NAME).xml
 	docbook2x-man -s ../../doc/stylesheets/serdoc2man.xsl $<
 
-man: $(MOD_NAME).7
+man: $(UTIL_NAME).7
 
 else
 




More information about the sr-dev mailing list