diff Makefile.in @ 4066:0962acdde3be

builld: allow out of source build * Makefile.in: add TOP_BUILD_DIR var and use TOP_DIR=srcdir, TOP_BUILD_DIR=builddir, modify paths to use TOP_DIR where needed * binary-dist-rules.mk: use TOP_DIR and TOP_BUILD_DIR where needed * makeinst-script.sh: use script path to determine TOPDIR, use TOPDIR where needed * src/default-octave.mk: install octave-version to builddir * src/stable-octave.mk: install octave-version to builddir * src/octave.mk: install octave-version to builddir * tools/set-mxe-env.sh.in: update fir builddir and srcdir use
author John Donoghue
date Wed, 23 Dec 2015 08:11:04 -0500
parents c7e31c07c915
children bdcddfdc57d0
line wrap: on
line diff
--- a/Makefile.in	Fri Dec 11 15:56:18 2015 -0500
+++ b/Makefile.in	Wed Dec 23 08:11:04 2015 -0500
@@ -4,7 +4,8 @@
 OCTAVE_TARGET := @ENABLE_OCTAVE@octave
 
 PWD := $(shell pwd)
-TOP_DIR := $(PWD)
+TOP_BUILD_DIR := @abs_builddir@
+TOP_DIR := @abs_srcdir@
 
 STRIP_DIST_FILES := @STRIP_DIST_FILES@
 
@@ -61,7 +62,7 @@
 # Should match what config.guess prints for your system.
 # If cross compiling, you must set it manually.
 ifeq ($(MXE_NATIVE_BUILD),yes)
-  TARGET := $(shell tools/config.guess)
+  TARGET := $(shell $(TOP_DIR)/tools/config.guess)
 else
   ifeq ($(ENABLE_WINDOWS_64),yes)
     TARGET := x86_64-w64-mingw32
@@ -69,7 +70,7 @@
     TARGET := i686-w64-mingw32
   endif
 endif
-BUILD_SYSTEM := $(shell tools/config.guess)
+BUILD_SYSTEM := $(shell $(TOP_DIR)/tools/config.guess)
 
 # Enable shared or static libs, or perhaps both.  Probably it doesn't
 # make sense to disable both...
@@ -125,7 +126,7 @@
 # and it's not clear to me how to change that.
 #
 # For native builds, dump everything all together in one directory tree.
-ROOT_PREFIX := $(TOP_DIR)/usr
+ROOT_PREFIX := $(TOP_BUILD_DIR)/usr
 BUILD_TOOLS_PREFIX := $(ROOT_PREFIX)
 ifeq ($(MXE_NATIVE_BUILD),yes)
   HOST_PREFIX := $(ROOT_PREFIX)
@@ -239,13 +240,13 @@
   BUILD_TOOLS := $(filter-out build-msvctools, $(BUILD_TOOLS))
 endif
 
-STAMP_DIR  := $(TOP_DIR)/installed-packages
-MSYS_INFO_DIR := $(TOP_DIR)/msys-info
-LOG_DIR    := $(TOP_DIR)/log
+STAMP_DIR  := $(TOP_BUILD_DIR)/installed-packages
+MSYS_INFO_DIR := $(TOP_BUILD_DIR)/msys-info
+LOG_DIR    := $(TOP_BUILD_DIR)/log
 TIMESTAMP  := $(shell date +%Y%m%d_%H%M%S)
 PKG_DIR    := $(TOP_DIR)/pkg
-TMP_DIR     = $(TOP_DIR)/tmp-$(1)
-MAKEFILE   := $(TOP_DIR)/Makefile
+TMP_DIR     = $(TOP_BUILD_DIR)/tmp-$(1)
+MAKEFILE   := $(TOP_BUILD_DIR)/Makefile
 PKGS       := $(filter-out $(ALL_BUILD_TOOLS), $(shell $(SED) -n 's/^.* class="package">\([^<]*\)<.*$$/\1/p' '$(TOP_DIR)/index.html'))
 
 PATH := $(BUILD_TOOLS_PREFIX)/bin:$(PATH)
@@ -371,8 +372,8 @@
     MSYS_EXTENSION_URL := $(MSYS_URL)/Extension
     MSYS_BASE_VER := 1.0.13
     MSYS_EXTENSION_VER := 1.0.13
-    MSYS_BASE_DIR := $(TOP_DIR)/msys-base
-    MSYS_EXTENSION_DIR := $(TOP_DIR)/msys-extension
+    MSYS_BASE_DIR := $(TOP_BUILD_DIR)/msys-base
+    MSYS_EXTENSION_DIR := $(TOP_BUILD_DIR)/msys-extension
     MSYS_BASE_PACKAGES := $(addprefix msys-,bash coreutils diffutils dos2unix file findutils gawk grep gzip less libiconv libintl libmagic libopenssl make msys-core patch regex sed tar termcap unzip zip wget zlib)
 
     ifeq ($(ENABLE_DEVEL_TOOLS),yes)
@@ -382,7 +383,7 @@
     MSYS_BASE_SOURCES := $(addprefix src-,$(MSYS_BASE_PACKAGES))
     PKGS += $(MSYS_BASE_SOURCES)
 
-     NOTEPAD_BASE_DIR := $(TOP_DIR)/notepad++
+     NOTEPAD_BASE_DIR := $(TOP_BUILD_DIR)/notepad++
   endif
 else ifeq ($(MXE_SYSTEM),msvc)
   MXE_WINDOWS_BUILD := yes
@@ -493,18 +494,18 @@
 
 ifeq ($(IGNORE_SETTINGS),yes)
     $(info [ignore settings.mk])
-else ifeq ($(wildcard $(TOP_DIR)/settings.mk),$(TOP_DIR)/settings.mk)
-    include $(TOP_DIR)/settings.mk
+else ifeq ($(wildcard $(TOP_BUILD_DIR)/settings.mk),$(TOP_BUILD_DIR)/settings.mk)
+    include $(TOP_BUILD_DIR)/settings.mk
 else
     $(info [create settings.mk])
     $(shell { \
         echo '#JOBS = $(JOBS)'; \
         echo '#PKGS ='; \
-    } >'$(TOP_DIR)/settings.mk')
+    } >'$(TOP_BUILD_DIR)/settings.mk')
 endif
 
 .PHONY: all
-all: configure Makefile $(OCTAVE_TARGET)
+all: $(TOP_DIR)/configure Makefile $(OCTAVE_TARGET)
 
 .PHONY: all-packages
 all-packages: $(PKGS)
@@ -526,13 +527,13 @@
 .PHONY: devel-packages
 devel-packages: $(DEVEL_PACKAGES)
 
-configure: configure.ac
-	autoconf
+$(TOP_DIR)/configure: $(TOP_DIR)/configure.ac
+	cd $(TOP_DIR) && autoconf
 
-config.status: configure
+config.status: $(TOP_DIR)/configure
 	$(SHELL) ./config.status --recheck
 
-Makefile: Makefile.in config.status
+Makefile: $(TOP_DIR)/Makefile.in config.status
 	$(SHELL) ./config.status Makefile
 
 .PHONY: check-requirements
@@ -567,8 +568,8 @@
 	@[ -d '$(STAMP_DIR)' ] || mkdir -p '$(STAMP_DIR)'
 	@if test "$(USE_SYSTEM_GCC)" = yes; then \
 	  $(INSTALL) -d '$(BUILD_TOOLS_PREFIX)/bin' ; \
-	  $(INSTALL) -m 755 tools/config.guess '$(BUILD_TOOLS_PREFIX)/bin/config.guess' ; \
-	  $(INSTALL) -m 755 tools/config.sub '$(BUILD_TOOLS_PREFIX)/bin/config.sub' ; \
+	  $(INSTALL) -m 755 $(TOP_DIR)/tools/config.guess '$(BUILD_TOOLS_PREFIX)/bin/config.guess' ; \
+	  $(INSTALL) -m 755 $(TOP_DIR)/tools/config.sub '$(BUILD_TOOLS_PREFIX)/bin/config.sub' ; \
 	fi
 	@touch '$@'
 
@@ -853,7 +854,7 @@
 	@echo [done]
 
 # Files to distribute
-include dist-files.mk
+include $(TOP_DIR)/dist-files.mk
 
 PACKAGE_VERSION := @PACKAGE_VERSION@
 PACKAGE_TARNAME := @PACKAGE_TARNAME@
@@ -867,4 +868,4 @@
 	$(TAR) cf - $(DIST_FILES) | ( cd $(distdir) ; $(TAR) xpf - )
 	$(TAR) czf $(distdir).tar.gz $(distdir)
 
-include binary-dist-rules.mk
+include $(TOP_DIR)/binary-dist-rules.mk