|
| 1 | +.NOTPARALLEL : |
| 2 | + |
| 3 | +SOURCES_PATH ?= $(BASEDIR)/sources |
| 4 | +BASE_CACHE ?= $(BASEDIR)/built |
| 5 | +SDK_PATH ?= $(BASEDIR)/SDKs |
| 6 | +NO_QT ?= |
| 7 | +NO_WALLET ?= |
| 8 | +NO_UPNP ?= |
| 9 | + |
| 10 | +BUILD = $(shell ./config.guess) |
| 11 | +HOST ?= $(BUILD) |
| 12 | +PATCHES_PATH = $(BASEDIR)/patches |
| 13 | +BASEDIR = $(CURDIR) |
| 14 | +HASH_LENGTH:=11 |
| 15 | + |
| 16 | +host:=$(BUILD) |
| 17 | +ifneq ($(HOST),) |
| 18 | +host:=$(HOST) |
| 19 | +host_toolchain:=$(HOST)- |
| 20 | +endif |
| 21 | + |
| 22 | +base_build_dir=$(BASEDIR)/work/build |
| 23 | +base_staging_dir=$(BASEDIR)/work/staging |
| 24 | +canonical_host:=$(shell ./config.sub $(HOST)) |
| 25 | +build:=$(shell ./config.sub $(BUILD)) |
| 26 | + |
| 27 | +build_arch =$(firstword $(subst -, ,$(build))) |
| 28 | +build_vendor=$(word 2,$(subst -, ,$(build))) |
| 29 | +full_build_os:=$(subst $(build_arch)-$(build_vendor)-,,$(build)) |
| 30 | +build_os:=$(findstring linux,$(full_build_os)) |
| 31 | +build_os+=$(findstring darwin,$(full_build_os)) |
| 32 | +build_os:=$(strip $(build_os)) |
| 33 | +ifeq ($(build_os),) |
| 34 | +build_os=$(full_build_os) |
| 35 | +endif |
| 36 | + |
| 37 | +host_arch=$(firstword $(subst -, ,$(canonical_host))) |
| 38 | +host_vendor=$(word 2,$(subst -, ,$(canonical_host))) |
| 39 | +full_host_os:=$(subst $(host_arch)-$(host_vendor)-,,$(canonical_host)) |
| 40 | +host_os:=$(findstring linux,$(full_host_os)) |
| 41 | +host_os+=$(findstring darwin,$(full_host_os)) |
| 42 | +host_os+=$(findstring mingw32,$(full_host_os)) |
| 43 | +host_os:=$(strip $(host_os)) |
| 44 | +ifeq ($(host_os),) |
| 45 | +host_os=$(full_host_os) |
| 46 | +endif |
| 47 | + |
| 48 | +$(host_arch)_$(host_os)_prefix=$(BASEDIR)/$(host) |
| 49 | +$(host_arch)_$(host_os)_host=$(host) |
| 50 | +host_prefix=$($(host_arch)_$(host_os)_prefix) |
| 51 | +build_prefix=$(host_prefix)/native |
| 52 | +build_host=$(build) |
| 53 | + |
| 54 | +AT_$(V):= |
| 55 | +AT_:=@ |
| 56 | +AT:=$(AT_$(V)) |
| 57 | + |
| 58 | +all: install |
| 59 | + |
| 60 | +include hosts/$(host_os).mk |
| 61 | +include hosts/default.mk |
| 62 | +include builders/$(build_os).mk |
| 63 | +include builders/default.mk |
| 64 | +include packages/packages.mk |
| 65 | + |
| 66 | +qt_packages_$(NO_QT) = $(qt_packages) $(qt_$(host_os)_packages) |
| 67 | +qt_native_packages_$(NO_QT) = $(qt_native_packages) |
| 68 | +wallet_packages_$(NO_WALLET) = $(wallet_packages) |
| 69 | +upnp_packages_$(NO_UPNP) = $(upnp_packages) |
| 70 | + |
| 71 | +packages += $($(host_arch)_$(host_os)_packages) $($(host_os)_packages) $(qt_packages_) $(wallet_packages_) $(upnp_packages_) |
| 72 | +native_packages += $($(host_arch)_$(host_os)_native_packages) $($(host_os)_native_packages) $(qt_native_packages_) |
| 73 | +all_packages = $(packages) $(native_packages) |
| 74 | + |
| 75 | +meta_depends = Makefile builders/default.mk hosts/default.mk hosts/$(host_os).mk builders/$(build_os).mk |
| 76 | + |
| 77 | +$(host_arch)_$(host_os)_native_toolchain?=$($(host_os)_native_toolchain) |
| 78 | + |
| 79 | +include funcs.mk |
| 80 | + |
| 81 | +toolchain_path=$($($(host_arch)_$(host_os)_native_toolchain)_prefixbin) |
| 82 | +final_build_id_long+=$(shell $(build_SHA256SUM) config.site.in) |
| 83 | +final_build_id+=$(shell echo -n $(final_build_id_long) | $(build_SHA256SUM) | cut -c-$(HASH_LENGTH)) |
| 84 | +$(host_prefix)/.stamp_$(final_build_id): | $(native_packages) $(packages) |
| 85 | + $(AT)rm -rf $(@D) |
| 86 | + $(AT)mkdir -p $(@D) |
| 87 | + $(AT)echo copying packages: $| |
| 88 | + $(AT)echo to: $(@D) |
| 89 | + $(AT)cd $(@D); $(foreach package,$|, tar xf $($(package)_cached); ) |
| 90 | + $(AT)touch $@ |
| 91 | + |
| 92 | +$(host_prefix)/share/config.site : config.site.in $(host_prefix)/.stamp_$(final_build_id) |
| 93 | + $(AT)@mkdir -p $(@D) |
| 94 | + $(AT)sed -e 's|@HOST@|$(host)|' \ |
| 95 | + -e 's|@CC@|$(toolchain_path)$(host_CC)|' \ |
| 96 | + -e 's|@CXX@|$(toolchain_path)$(host_CXX)|' \ |
| 97 | + -e 's|@AR@|$(toolchain_path)$(host_AR)|' \ |
| 98 | + -e 's|@RANLIB@|$(toolchain_path)$(host_RANLIB)|' \ |
| 99 | + -e 's|@NM@|$(toolchain_path)$(host_NM)|' \ |
| 100 | + -e 's|@STRIP@|$(toolchain_path)$(host_STRIP)|' \ |
| 101 | + -e 's|@build_os@|$(build_os)|' \ |
| 102 | + -e 's|@host_os@|$(host_os)|' \ |
| 103 | + -e 's|@CFLAGS@|$(host_CFLAGS)|' \ |
| 104 | + -e 's|@CXXFLAGS@|$(host_CXXFLAGS)|' \ |
| 105 | + -e 's|@LDFLAGS@|$(host_LDFLAGS)|' \ |
| 106 | + -e 's|@no_qt@|$(NO_QT)|' \ |
| 107 | + -e 's|@no_wallet@|$(NO_WALLET)|' \ |
| 108 | + -e 's|@no_upnp@|$(NO_UPNP)|' \ |
| 109 | + $< > $@ |
| 110 | + $(AT)touch $@ |
| 111 | + |
| 112 | +install: $(host_prefix)/share/config.site |
| 113 | +download: $(all_sources) |
| 114 | +.PHONY: install cached |
0 commit comments