comparison 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
comparison
equal deleted inserted replaced
4065:aacf84e7af56 4066:0962acdde3be
2 # See index.html for further information. 2 # See index.html for further information.
3 3
4 OCTAVE_TARGET := @ENABLE_OCTAVE@octave 4 OCTAVE_TARGET := @ENABLE_OCTAVE@octave
5 5
6 PWD := $(shell pwd) 6 PWD := $(shell pwd)
7 TOP_DIR := $(PWD) 7 TOP_BUILD_DIR := @abs_builddir@
8 TOP_DIR := @abs_srcdir@
8 9
9 STRIP_DIST_FILES := @STRIP_DIST_FILES@ 10 STRIP_DIST_FILES := @STRIP_DIST_FILES@
10 11
11 DATE := $(shell date +%Y-%m-%d-%H-%M) 12 DATE := $(shell date +%Y-%m-%d-%H-%M)
12 13
59 ENABLE_DEVEL_TOOLS := @ENABLE_DEVEL_TOOLS@ 60 ENABLE_DEVEL_TOOLS := @ENABLE_DEVEL_TOOLS@
60 61
61 # Should match what config.guess prints for your system. 62 # Should match what config.guess prints for your system.
62 # If cross compiling, you must set it manually. 63 # If cross compiling, you must set it manually.
63 ifeq ($(MXE_NATIVE_BUILD),yes) 64 ifeq ($(MXE_NATIVE_BUILD),yes)
64 TARGET := $(shell tools/config.guess) 65 TARGET := $(shell $(TOP_DIR)/tools/config.guess)
65 else 66 else
66 ifeq ($(ENABLE_WINDOWS_64),yes) 67 ifeq ($(ENABLE_WINDOWS_64),yes)
67 TARGET := x86_64-w64-mingw32 68 TARGET := x86_64-w64-mingw32
68 else 69 else
69 TARGET := i686-w64-mingw32 70 TARGET := i686-w64-mingw32
70 endif 71 endif
71 endif 72 endif
72 BUILD_SYSTEM := $(shell tools/config.guess) 73 BUILD_SYSTEM := $(shell $(TOP_DIR)/tools/config.guess)
73 74
74 # Enable shared or static libs, or perhaps both. Probably it doesn't 75 # Enable shared or static libs, or perhaps both. Probably it doesn't
75 # make sense to disable both... 76 # make sense to disable both...
76 BUILD_SHARED := @BUILD_SHARED@ 77 BUILD_SHARED := @BUILD_SHARED@
77 BUILD_STATIC := @BUILD_STATIC@ 78 BUILD_STATIC := @BUILD_STATIC@
123 # These can't be chosen arbitrarily. The way things are configured now, 124 # These can't be chosen arbitrarily. The way things are configured now,
124 # GCC expects to find cross-compiler include files in $(PREFIX)/$(TARGET). 125 # GCC expects to find cross-compiler include files in $(PREFIX)/$(TARGET).
125 # and it's not clear to me how to change that. 126 # and it's not clear to me how to change that.
126 # 127 #
127 # For native builds, dump everything all together in one directory tree. 128 # For native builds, dump everything all together in one directory tree.
128 ROOT_PREFIX := $(TOP_DIR)/usr 129 ROOT_PREFIX := $(TOP_BUILD_DIR)/usr
129 BUILD_TOOLS_PREFIX := $(ROOT_PREFIX) 130 BUILD_TOOLS_PREFIX := $(ROOT_PREFIX)
130 ifeq ($(MXE_NATIVE_BUILD),yes) 131 ifeq ($(MXE_NATIVE_BUILD),yes)
131 HOST_PREFIX := $(ROOT_PREFIX) 132 HOST_PREFIX := $(ROOT_PREFIX)
132 else 133 else
133 HOST_PREFIX := $(ROOT_PREFIX)/$(TARGET) 134 HOST_PREFIX := $(ROOT_PREFIX)/$(TARGET)
237 endif 238 endif
238 ifneq ($(MXE_SYSTEM),msvc) 239 ifneq ($(MXE_SYSTEM),msvc)
239 BUILD_TOOLS := $(filter-out build-msvctools, $(BUILD_TOOLS)) 240 BUILD_TOOLS := $(filter-out build-msvctools, $(BUILD_TOOLS))
240 endif 241 endif
241 242
242 STAMP_DIR := $(TOP_DIR)/installed-packages 243 STAMP_DIR := $(TOP_BUILD_DIR)/installed-packages
243 MSYS_INFO_DIR := $(TOP_DIR)/msys-info 244 MSYS_INFO_DIR := $(TOP_BUILD_DIR)/msys-info
244 LOG_DIR := $(TOP_DIR)/log 245 LOG_DIR := $(TOP_BUILD_DIR)/log
245 TIMESTAMP := $(shell date +%Y%m%d_%H%M%S) 246 TIMESTAMP := $(shell date +%Y%m%d_%H%M%S)
246 PKG_DIR := $(TOP_DIR)/pkg 247 PKG_DIR := $(TOP_DIR)/pkg
247 TMP_DIR = $(TOP_DIR)/tmp-$(1) 248 TMP_DIR = $(TOP_BUILD_DIR)/tmp-$(1)
248 MAKEFILE := $(TOP_DIR)/Makefile 249 MAKEFILE := $(TOP_BUILD_DIR)/Makefile
249 PKGS := $(filter-out $(ALL_BUILD_TOOLS), $(shell $(SED) -n 's/^.* class="package">\([^<]*\)<.*$$/\1/p' '$(TOP_DIR)/index.html')) 250 PKGS := $(filter-out $(ALL_BUILD_TOOLS), $(shell $(SED) -n 's/^.* class="package">\([^<]*\)<.*$$/\1/p' '$(TOP_DIR)/index.html'))
250 251
251 PATH := $(BUILD_TOOLS_PREFIX)/bin:$(PATH) 252 PATH := $(BUILD_TOOLS_PREFIX)/bin:$(PATH)
252 253
253 CONFIGURE_CPPFLAGS := CPPFLAGS='-I$(HOST_PREFIX)/include' 254 CONFIGURE_CPPFLAGS := CPPFLAGS='-I$(HOST_PREFIX)/include'
369 MSYS_URL := http://sourceforge.net/projects/mingw/files/MSYS 370 MSYS_URL := http://sourceforge.net/projects/mingw/files/MSYS
370 MSYS_BASE_URL := $(MSYS_URL)/Base 371 MSYS_BASE_URL := $(MSYS_URL)/Base
371 MSYS_EXTENSION_URL := $(MSYS_URL)/Extension 372 MSYS_EXTENSION_URL := $(MSYS_URL)/Extension
372 MSYS_BASE_VER := 1.0.13 373 MSYS_BASE_VER := 1.0.13
373 MSYS_EXTENSION_VER := 1.0.13 374 MSYS_EXTENSION_VER := 1.0.13
374 MSYS_BASE_DIR := $(TOP_DIR)/msys-base 375 MSYS_BASE_DIR := $(TOP_BUILD_DIR)/msys-base
375 MSYS_EXTENSION_DIR := $(TOP_DIR)/msys-extension 376 MSYS_EXTENSION_DIR := $(TOP_BUILD_DIR)/msys-extension
376 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) 377 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)
377 378
378 ifeq ($(ENABLE_DEVEL_TOOLS),yes) 379 ifeq ($(ENABLE_DEVEL_TOOLS),yes)
379 MSYS_BASE_PACKAGES += msys-perl msys-libcrypt 380 MSYS_BASE_PACKAGES += msys-perl msys-libcrypt
380 endif 381 endif
381 382
382 MSYS_BASE_SOURCES := $(addprefix src-,$(MSYS_BASE_PACKAGES)) 383 MSYS_BASE_SOURCES := $(addprefix src-,$(MSYS_BASE_PACKAGES))
383 PKGS += $(MSYS_BASE_SOURCES) 384 PKGS += $(MSYS_BASE_SOURCES)
384 385
385 NOTEPAD_BASE_DIR := $(TOP_DIR)/notepad++ 386 NOTEPAD_BASE_DIR := $(TOP_BUILD_DIR)/notepad++
386 endif 387 endif
387 else ifeq ($(MXE_SYSTEM),msvc) 388 else ifeq ($(MXE_SYSTEM),msvc)
388 MXE_WINDOWS_BUILD := yes 389 MXE_WINDOWS_BUILD := yes
389 else 390 else
390 MXE_WINDOWS_BUILD := no 391 MXE_WINDOWS_BUILD := no
491 ) \ 492 ) \
492 > '$(PKG_DIR)/$($(1)_FILE)' || rm -f '$(PKG_DIR)/$($(1)_FILE)' 493 > '$(PKG_DIR)/$($(1)_FILE)' || rm -f '$(PKG_DIR)/$($(1)_FILE)'
493 494
494 ifeq ($(IGNORE_SETTINGS),yes) 495 ifeq ($(IGNORE_SETTINGS),yes)
495 $(info [ignore settings.mk]) 496 $(info [ignore settings.mk])
496 else ifeq ($(wildcard $(TOP_DIR)/settings.mk),$(TOP_DIR)/settings.mk) 497 else ifeq ($(wildcard $(TOP_BUILD_DIR)/settings.mk),$(TOP_BUILD_DIR)/settings.mk)
497 include $(TOP_DIR)/settings.mk 498 include $(TOP_BUILD_DIR)/settings.mk
498 else 499 else
499 $(info [create settings.mk]) 500 $(info [create settings.mk])
500 $(shell { \ 501 $(shell { \
501 echo '#JOBS = $(JOBS)'; \ 502 echo '#JOBS = $(JOBS)'; \
502 echo '#PKGS ='; \ 503 echo '#PKGS ='; \
503 } >'$(TOP_DIR)/settings.mk') 504 } >'$(TOP_BUILD_DIR)/settings.mk')
504 endif 505 endif
505 506
506 .PHONY: all 507 .PHONY: all
507 all: configure Makefile $(OCTAVE_TARGET) 508 all: $(TOP_DIR)/configure Makefile $(OCTAVE_TARGET)
508 509
509 .PHONY: all-packages 510 .PHONY: all-packages
510 all-packages: $(PKGS) 511 all-packages: $(PKGS)
511 512
512 $(PKGS): $(BUILD_TOOLS) cmake-toolchain-file.stamp 513 $(PKGS): $(BUILD_TOOLS) cmake-toolchain-file.stamp
524 blas-packages: $(BLAS_PACKAGES) 525 blas-packages: $(BLAS_PACKAGES)
525 526
526 .PHONY: devel-packages 527 .PHONY: devel-packages
527 devel-packages: $(DEVEL_PACKAGES) 528 devel-packages: $(DEVEL_PACKAGES)
528 529
529 configure: configure.ac 530 $(TOP_DIR)/configure: $(TOP_DIR)/configure.ac
530 autoconf 531 cd $(TOP_DIR) && autoconf
531 532
532 config.status: configure 533 config.status: $(TOP_DIR)/configure
533 $(SHELL) ./config.status --recheck 534 $(SHELL) ./config.status --recheck
534 535
535 Makefile: Makefile.in config.status 536 Makefile: $(TOP_DIR)/Makefile.in config.status
536 $(SHELL) ./config.status Makefile 537 $(SHELL) ./config.status Makefile
537 538
538 .PHONY: check-requirements 539 .PHONY: check-requirements
539 define CHECK_REQUIREMENT 540 define CHECK_REQUIREMENT
540 @if ! $(1) --help &>/dev/null; then \ 541 @if ! $(1) --help &>/dev/null; then \
565 @echo '[check requirements]' 566 @echo '[check requirements]'
566 $(foreach REQUIREMENT,$(REQUIREMENTS),$(call CHECK_REQUIREMENT,$(REQUIREMENT))) 567 $(foreach REQUIREMENT,$(REQUIREMENTS),$(call CHECK_REQUIREMENT,$(REQUIREMENT)))
567 @[ -d '$(STAMP_DIR)' ] || mkdir -p '$(STAMP_DIR)' 568 @[ -d '$(STAMP_DIR)' ] || mkdir -p '$(STAMP_DIR)'
568 @if test "$(USE_SYSTEM_GCC)" = yes; then \ 569 @if test "$(USE_SYSTEM_GCC)" = yes; then \
569 $(INSTALL) -d '$(BUILD_TOOLS_PREFIX)/bin' ; \ 570 $(INSTALL) -d '$(BUILD_TOOLS_PREFIX)/bin' ; \
570 $(INSTALL) -m 755 tools/config.guess '$(BUILD_TOOLS_PREFIX)/bin/config.guess' ; \ 571 $(INSTALL) -m 755 $(TOP_DIR)/tools/config.guess '$(BUILD_TOOLS_PREFIX)/bin/config.guess' ; \
571 $(INSTALL) -m 755 tools/config.sub '$(BUILD_TOOLS_PREFIX)/bin/config.sub' ; \ 572 $(INSTALL) -m 755 $(TOP_DIR)/tools/config.sub '$(BUILD_TOOLS_PREFIX)/bin/config.sub' ; \
572 fi 573 fi
573 @touch '$@' 574 @touch '$@'
574 575
575 define newline 576 define newline
576 577
851 @$(build-cmake-toolchain-file) 852 @$(build-cmake-toolchain-file)
852 @touch cmake-toolchain-file.stamp 853 @touch cmake-toolchain-file.stamp
853 @echo [done] 854 @echo [done]
854 855
855 # Files to distribute 856 # Files to distribute
856 include dist-files.mk 857 include $(TOP_DIR)/dist-files.mk
857 858
858 PACKAGE_VERSION := @PACKAGE_VERSION@ 859 PACKAGE_VERSION := @PACKAGE_VERSION@
859 PACKAGE_TARNAME := @PACKAGE_TARNAME@ 860 PACKAGE_TARNAME := @PACKAGE_TARNAME@
860 861
861 distdir := $(PACKAGE_TARNAME)-$(PACKAGE_VERSION) 862 distdir := $(PACKAGE_TARNAME)-$(PACKAGE_VERSION)
865 rm -rf $(distdir) 866 rm -rf $(distdir)
866 mkdir $(distdir) 867 mkdir $(distdir)
867 $(TAR) cf - $(DIST_FILES) | ( cd $(distdir) ; $(TAR) xpf - ) 868 $(TAR) cf - $(DIST_FILES) | ( cd $(distdir) ; $(TAR) xpf - )
868 $(TAR) czf $(distdir).tar.gz $(distdir) 869 $(TAR) czf $(distdir).tar.gz $(distdir)
869 870
870 include binary-dist-rules.mk 871 include $(TOP_DIR)/binary-dist-rules.mk