[sr-dev] git:sr_3.0: makefile: fix make bin & basedir

Andrei Pelinescu-Onciul andrei at iptel.org
Tue Dec 15 01:00:33 CET 2009


Module: sip-router
Branch: sr_3.0
Commit: 31442b832dd4fc606833a06fb92d90f62af9f1b0
URL:    http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=31442b832dd4fc606833a06fb92d90f62af9f1b0

Author: Andrei Pelinescu-Onciul <andrei at iptel.org>
Committer: Andrei Pelinescu-Onciul <andrei at iptel.org>
Date:   Tue Dec 15 00:58:14 2009 +0100

makefile: fix make bin &  basedir

- make bin and make sunpkg fixed (basedir was not an absolute
  path)
- auto-transform basedir to an absolute path if it does not start
  with '/'
- fix unexported makefile_defs, after loading the config in the
  main Makefile

---

 Makefile |   16 ++++++++++++++--
 1 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/Makefile b/Makefile
index 601d215..e7bc7cb 100644
--- a/Makefile
+++ b/Makefile
@@ -257,6 +257,7 @@ ifeq ($(makefile_defs),1)
 ifeq ($(quiet),verbose)
 $(info config.mak loaded)
 endif # verbose
+export makefile_defs
 # config_make valid & used
 config_mak=1
 ifeq ($(MAIN_NAME),)
@@ -278,6 +279,7 @@ else
 # config.mak not strictly needed, but try to load it if exists for $(Q)
 config_mak=skip
 -include config.mak
+export makefile_defs
 endif
 endif
 
@@ -426,6 +428,15 @@ ifeq ($(config_mak),1)
 
 include Makefile.cfg
 
+# fix basedir path (relative -> absolute)
+ifneq (,$(basedir))
+ifeq (,$(filter /%, $(basedir)))
+override basedir:=$(CURDIR)/$(basedir)
+# remove basedir from command line overrides
+MAKEOVERRIDES:=$(filter-out basedir=%,$ $(MAKEOVERRIDES))
+endif # (,$(filter /%, $(basedir)))
+endif # (,$(basedir))
+
 else ifneq ($(config_mak),skip)
 
 config.mak: Makefile.defs
@@ -718,7 +729,7 @@ tar: $(auto_gen_keep)
 .PHONY: bin
 bin:
 	mkdir -p tmp/$(MAIN_NAME)/usr/local
-	$(MAKE) install basedir=tmp/$(MAIN_NAME) $(mk_params)
+	$(MAKE) install basedir=$(CURDIR)/tmp/$(MAIN_NAME) $(mk_params)
 	$(TAR) -C tmp/$(MAIN_NAME)/ -zcf ../$(NAME)-$(RELEASE)_$(OS)_$(ARCH).tar.gz .
 	rm -rf tmp/$(MAIN_NAME)
 
@@ -736,7 +747,8 @@ deb:
 sunpkg:
 	mkdir -p tmp/$(MAIN_NAME)
 	mkdir -p tmp/$(MAIN_NAME)_sun_pkg
-	$(MAKE) install basedir=tmp/$(MAIN_NAME) prefix=/usr/local $(mk_params)
+	$(MAKE) install basedir=$(CURDIR)/tmp/$(MAIN_NAME) \
+			prefix=/usr/local $(mk_params)
 	(cd pkg/solaris; \
 	pkgmk -r ../../tmp/$(MAIN_NAME)/usr/local -o -d ../../tmp/$(MAIN_NAME)_sun_pkg/ -v "$(RELEASE)" ;\
 	cd ../..)




More information about the sr-dev mailing list