Browse code

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

Andrei Pelinescu-Onciul authored on 14/12/2009 23:58:14
Showing 1 changed files
... ...
@@ -257,6 +257,7 @@ ifeq ($(makefile_defs),1)
257 257
 ifeq ($(quiet),verbose)
258 258
 $(info config.mak loaded)
259 259
 endif # verbose
260
+export makefile_defs
260 261
 # config_make valid & used
261 262
 config_mak=1
262 263
 ifeq ($(MAIN_NAME),)
... ...
@@ -278,6 +279,7 @@ else
278 278
 # config.mak not strictly needed, but try to load it if exists for $(Q)
279 279
 config_mak=skip
280 280
 -include config.mak
281
+export makefile_defs
281 282
 endif
282 283
 endif
283 284
 
... ...
@@ -426,6 +428,15 @@ ifeq ($(config_mak),1)
426 426
 
427 427
 include Makefile.cfg
428 428
 
429
+# fix basedir path (relative -> absolute)
430
+ifneq (,$(basedir))
431
+ifeq (,$(filter /%, $(basedir)))
432
+override basedir:=$(CURDIR)/$(basedir)
433
+# remove basedir from command line overrides
434
+MAKEOVERRIDES:=$(filter-out basedir=%,$ $(MAKEOVERRIDES))
435
+endif # (,$(filter /%, $(basedir)))
436
+endif # (,$(basedir))
437
+
429 438
 else ifneq ($(config_mak),skip)
430 439
 
431 440
 config.mak: Makefile.defs
... ...
@@ -718,7 +729,7 @@ tar: $(auto_gen_keep)
718 718
 .PHONY: bin
719 719
 bin:
720 720
 	mkdir -p tmp/$(MAIN_NAME)/usr/local
721
-	$(MAKE) install basedir=tmp/$(MAIN_NAME) $(mk_params)
721
+	$(MAKE) install basedir=$(CURDIR)/tmp/$(MAIN_NAME) $(mk_params)
722 722
 	$(TAR) -C tmp/$(MAIN_NAME)/ -zcf ../$(NAME)-$(RELEASE)_$(OS)_$(ARCH).tar.gz .
723 723
 	rm -rf tmp/$(MAIN_NAME)
724 724
 
... ...
@@ -736,7 +747,8 @@ deb:
736 736
 sunpkg:
737 737
 	mkdir -p tmp/$(MAIN_NAME)
738 738
 	mkdir -p tmp/$(MAIN_NAME)_sun_pkg
739
-	$(MAKE) install basedir=tmp/$(MAIN_NAME) prefix=/usr/local $(mk_params)
739
+	$(MAKE) install basedir=$(CURDIR)/tmp/$(MAIN_NAME) \
740
+			prefix=/usr/local $(mk_params)
740 741
 	(cd pkg/solaris; \
741 742
 	pkgmk -r ../../tmp/$(MAIN_NAME)/usr/local -o -d ../../tmp/$(MAIN_NAME)_sun_pkg/ -v "$(RELEASE)" ;\
742 743
 	cd ../..)