From 9467ce42da7fbcec1a4b5b8e08e2dcea3c67aa96 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Mon, 20 Feb 2017 14:24:54 +0100 Subject: [PATCH] build: get rid of host.mk Defined required host related variables in toplevel.mk instead Signed-off-by: Felix Fietkau --- Makefile | 2 +- include/host-build.mk | 1 - include/host.mk | 46 ---------------------------- include/image.mk | 1 - include/kernel-build.mk | 1 - include/package.mk | 1 - include/prereq-build.mk | 7 ++--- include/scan.mk | 4 +-- include/toplevel.mk | 4 ++- target/imagebuilder/Makefile | 1 - target/imagebuilder/files/Makefile | 3 +- target/linux/apm821xx/image/Makefile | 1 - target/linux/brcm2708/Makefile | 1 - target/linux/brcm2708/image/Makefile | 1 - target/linux/sunxi/image/Makefile | 1 - target/linux/uml/Makefile | 1 - target/linux/zynq/Makefile | 1 - target/sdk/Makefile | 1 - target/sdk/files/Makefile | 2 +- target/toolchain/Makefile | 1 - 20 files changed, 11 insertions(+), 70 deletions(-) delete mode 100644 include/host.mk diff --git a/Makefile b/Makefile index a26eeee0a8..670e6a25de 100644 --- a/Makefile +++ b/Makefile @@ -18,7 +18,7 @@ $(if $(findstring $(space),$(TOPDIR)),$(error ERROR: The path to the LEDE direct world: -include $(TOPDIR)/include/host.mk +export PATH:=$(TOPDIR)/staging_dir/host/bin:$(PATH) ifneq ($(OPENWRT_BUILD),1) _SINGLE=export MAKEFLAGS=$(space); diff --git a/include/host-build.mk b/include/host-build.mk index ffb68468f9..c8477e1ddf 100644 --- a/include/host-build.mk +++ b/include/host-build.mk @@ -19,7 +19,6 @@ else HOST_JOBS?=$(if $(HOST_BUILD_PARALLEL),$(HOST_MAKE_J),-j1) endif -include $(INCLUDE_DIR)/host.mk include $(INCLUDE_DIR)/unpack.mk include $(INCLUDE_DIR)/depends.mk diff --git a/include/host.mk b/include/host.mk deleted file mode 100644 index 2ccab8e1e6..0000000000 --- a/include/host.mk +++ /dev/null @@ -1,46 +0,0 @@ -# -# Copyright (C) 2007-2015 OpenWrt.org -# -# This is free software, licensed under the GNU General Public License v2. -# See /LICENSE for more information. -# - -TMP_DIR ?= $(TOPDIR)/tmp -ifeq ($(if $(TARGET_BUILD),,$(DUMP)),) - -include $(TMP_DIR)/.host.mk -endif - -ifneq ($(__host_inc),1) -__host_inc:=1 - -export PATH:=$(TOPDIR)/staging_dir/host/bin:$(PATH) - -try-run = $(shell set -e; \ - TMP_F="$(TMP_DIR)/try-run.$$$$.tmp"; \ - if ($(1)) >/dev/null 2>&1; then echo "$(2)"; else echo "$(3)"; fi; \ - rm -f "$$TMP_F"; \ -) - -host-cc-option = $(call try-run, \ - $(HOSTCC) $(HOST_CFLAGS) $(1) -c -xc /dev/null -o "$$TMP_F",$(1),$(2) \ -) - -.PRECIOUS: $(TMP_DIR)/.host.mk -$(TMP_DIR)/.host.mk: $(TOPDIR)/include/host.mk - @mkdir -p $(TMP_DIR) - @( \ - HOST_OS=`uname`; \ - case "$$HOST_OS" in \ - Linux) HOST_ARCH=`uname -m`;; \ - Darwin) HOST_ARCH=`uname -m`;; \ - *) HOST_ARCH=`uname -p`;; \ - esac; \ - GNU_HOST_NAME=`gcc -dumpmachine`; \ - [ -z "$$GNU_HOST_NAME" -o "$$HOST_OS" = "Darwin" ] && \ - GNU_HOST_NAME=`$(TOPDIR)/scripts/config.guess`; \ - echo "HOST_OS:=$$HOST_OS" > $@; \ - echo "HOST_ARCH:=$$HOST_ARCH" >> $@; \ - echo "GNU_HOST_NAME:=$$GNU_HOST_NAME" >> $@; \ - ) >/dev/null 2>/dev/null - -endif diff --git a/include/image.mk b/include/image.mk index 81519cd183..9bc30c663d 100644 --- a/include/image.mk +++ b/include/image.mk @@ -8,7 +8,6 @@ override TARGET_BUILD= include $(INCLUDE_DIR)/prereq.mk include $(INCLUDE_DIR)/kernel.mk -include $(INCLUDE_DIR)/host.mk include $(INCLUDE_DIR)/version.mk include $(INCLUDE_DIR)/image-commands.mk diff --git a/include/kernel-build.mk b/include/kernel-build.mk index 56c0fe386b..7d1e23c6ea 100644 --- a/include/kernel-build.mk +++ b/include/kernel-build.mk @@ -4,7 +4,6 @@ # This is free software, licensed under the GNU General Public License v2. # See /LICENSE for more information. # -include $(INCLUDE_DIR)/host.mk include $(INCLUDE_DIR)/prereq.mk include $(INCLUDE_DIR)/depends.mk diff --git a/include/package.mk b/include/package.mk index ce1aa256bd..a3ef3029d8 100644 --- a/include/package.mk +++ b/include/package.mk @@ -37,7 +37,6 @@ endif include $(INCLUDE_DIR)/hardening.mk include $(INCLUDE_DIR)/prereq.mk -include $(INCLUDE_DIR)/host.mk include $(INCLUDE_DIR)/unpack.mk include $(INCLUDE_DIR)/depends.mk diff --git a/include/prereq-build.mk b/include/prereq-build.mk index af4e8b5e14..2d3a1faf2d 100644 --- a/include/prereq-build.mk +++ b/include/prereq-build.mk @@ -7,7 +7,6 @@ include $(TOPDIR)/rules.mk include $(INCLUDE_DIR)/prereq.mk -include $(INCLUDE_DIR)/host.mk include $(INCLUDE_DIR)/host-build.mk SHELL:=sh @@ -123,9 +122,9 @@ $(eval $(call SetupHostCommand,getopt, \ getopt -o t --long test -- --test | grep '^ *--test *--')) $(eval $(call SetupHostCommand,stat,Cannot find a file stat utility, \ - gnustat -c%s $(TMP_DIR)/.host.mk, \ - gstat -c%s $(TMP_DIR)/.host.mk, \ - stat -c%s $(TMP_DIR)/.host.mk)) + gnustat -c%s $(TOPDIR)/Makefile, \ + gstat -c%s $(TOPDIR)/Makefile, \ + stat -c%s $(TOPDIR)/Makefile)) $(eval $(call SetupHostCommand,unzip,Please install 'unzip', \ unzip 2>&1 | grep zipfile, \ diff --git a/include/scan.mk b/include/scan.mk index 92f2dc3f93..86d9576c82 100644 --- a/include/scan.mk +++ b/include/scan.mk @@ -3,8 +3,6 @@ TMP_DIR:=$(TOPDIR)/tmp all: $(TMP_DIR)/.$(SCAN_TARGET) -include $(TOPDIR)/include/host.mk - SCAN_TARGET ?= packageinfo SCAN_NAME ?= package SCAN_DIR ?= package @@ -12,6 +10,8 @@ TARGET_STAMP:=$(TMP_DIR)/info/.files-$(SCAN_TARGET).stamp FILELIST:=$(TMP_DIR)/info/.files-$(SCAN_TARGET)-$(SCAN_COOKIE) OVERRIDELIST:=$(TMP_DIR)/info/.overrides-$(SCAN_TARGET)-$(SCAN_COOKIE) +export PATH:=$(TOPDIR)/staging_dir/host/bin:$(PATH) + ifeq ($(IS_TTY),1) define progress printf "\033[M\r$(1)" >&2; diff --git a/include/toplevel.mk b/include/toplevel.mk index a9ea21bbef..0f68580955 100644 --- a/include/toplevel.mk +++ b/include/toplevel.mk @@ -24,6 +24,9 @@ export REVISION export SOURCE_DATE_EPOCH export GIT_CONFIG_PARAMETERS='core.autocrlf=false' export MAKE_JOBSERVER=$(filter --jobserver%,$(MAKEFLAGS)) +export GNU_HOST_NAME:=$(shell $(TOPDIR)/scripts/config.guess) +export HOST_OS:=$(shell uname) +export HOST_ARCH:=$(shell uname -m) # prevent perforce from messing with the patch utility unexport P4PORT P4USER P4CONFIG P4CLIENT @@ -148,7 +151,6 @@ kernel_nconfig: prepare_kernel_conf staging_dir/host/.prereq-build: include/prereq-build.mk mkdir -p tmp - rm -f tmp/.host.mk @$(_SINGLE)$(NO_TRACE_MAKE) -j1 -r -s -f $(TOPDIR)/include/prereq-build.mk prereq 2>/dev/null || { \ echo "Prerequisite check failed. Use FORCE=1 to override."; \ false; \ diff --git a/target/imagebuilder/Makefile b/target/imagebuilder/Makefile index f9dd61c031..e8e4641f67 100644 --- a/target/imagebuilder/Makefile +++ b/target/imagebuilder/Makefile @@ -7,7 +7,6 @@ include $(TOPDIR)/rules.mk include $(INCLUDE_DIR)/kernel.mk -include $(INCLUDE_DIR)/host.mk include $(INCLUDE_DIR)/version.mk include $(INCLUDE_DIR)/feeds.mk diff --git a/target/imagebuilder/files/Makefile b/target/imagebuilder/files/Makefile index baa0e1f271..f0e2bd1281 100644 --- a/target/imagebuilder/files/Makefile +++ b/target/imagebuilder/files/Makefile @@ -13,7 +13,7 @@ export TOPDIR LC_ALL LANG export OPENWRT_VERBOSE=s all: help -include $(TOPDIR)/include/host.mk +export PATH:=$(TOPDIR)/staging_dir/host/bin:$(PATH) ifneq ($(OPENWRT_BUILD),1) override OPENWRT_BUILD=1 @@ -82,7 +82,6 @@ PROFILE_LIST = $(foreach p,$(PROFILE_NAMES), \ staging_dir/host/.prereq-build: include/prereq-build.mk mkdir -p tmp - rm -f tmp/.host.mk @$(_SINGLE)$(NO_TRACE_MAKE) -j1 -r -s -f $(TOPDIR)/include/prereq-build.mk prereq 2>/dev/null || { \ echo "Prerequisite check failed. Use FORCE=1 to override."; \ false; \ diff --git a/target/linux/apm821xx/image/Makefile b/target/linux/apm821xx/image/Makefile index a11e989705..355333695d 100644 --- a/target/linux/apm821xx/image/Makefile +++ b/target/linux/apm821xx/image/Makefile @@ -4,7 +4,6 @@ # include $(TOPDIR)/rules.mk include $(INCLUDE_DIR)/image.mk -include $(INCLUDE_DIR)/host.mk DEVICE_VARS += DEVICE_PROFILE IMAGE_SIZE DTB_SIZE diff --git a/target/linux/brcm2708/Makefile b/target/linux/brcm2708/Makefile index 07574f9815..8dc923907d 100644 --- a/target/linux/brcm2708/Makefile +++ b/target/linux/brcm2708/Makefile @@ -5,7 +5,6 @@ # See /LICENSE for more information. # include $(TOPDIR)/rules.mk -include $(INCLUDE_DIR)/host.mk ARCH:=arm BOARD:=brcm2708 diff --git a/target/linux/brcm2708/image/Makefile b/target/linux/brcm2708/image/Makefile index dbe014565e..0b3f6a7588 100644 --- a/target/linux/brcm2708/image/Makefile +++ b/target/linux/brcm2708/image/Makefile @@ -7,7 +7,6 @@ # include $(TOPDIR)/rules.mk include $(INCLUDE_DIR)/image.mk -include $(INCLUDE_DIR)/host.mk FAT32_BLOCK_SIZE=1024 FAT32_BLOCKS=$(shell echo $$(($(CONFIG_BRCM2708_SD_BOOT_PARTSIZE)*1024*1024/$(FAT32_BLOCK_SIZE)))) diff --git a/target/linux/sunxi/image/Makefile b/target/linux/sunxi/image/Makefile index c3f368f2e4..d0d86ee10d 100644 --- a/target/linux/sunxi/image/Makefile +++ b/target/linux/sunxi/image/Makefile @@ -7,7 +7,6 @@ # include $(TOPDIR)/rules.mk include $(INCLUDE_DIR)/image.mk -include $(INCLUDE_DIR)/host.mk FAT32_BLOCK_SIZE=1024 FAT32_BLOCKS=$(shell echo $$(($(CONFIG_SUNXI_SD_BOOT_PARTSIZE)*1024*1024/$(FAT32_BLOCK_SIZE)))) diff --git a/target/linux/uml/Makefile b/target/linux/uml/Makefile index 7cf1614218..6967e403cb 100644 --- a/target/linux/uml/Makefile +++ b/target/linux/uml/Makefile @@ -5,7 +5,6 @@ # See /LICENSE for more information. # include $(TOPDIR)/rules.mk -include $(INCLUDE_DIR)/host.mk # UML only makes sense on linux ifeq ($(HOST_OS),Linux) diff --git a/target/linux/zynq/Makefile b/target/linux/zynq/Makefile index 47b678ddbd..82b5d36942 100644 --- a/target/linux/zynq/Makefile +++ b/target/linux/zynq/Makefile @@ -5,7 +5,6 @@ # See /LICENSE for more information. # include $(TOPDIR)/rules.mk -include $(INCLUDE_DIR)/host.mk ARCH:=arm BOARD:=zynq diff --git a/target/sdk/Makefile b/target/sdk/Makefile index a1b64155bb..ae65fd1c8f 100644 --- a/target/sdk/Makefile +++ b/target/sdk/Makefile @@ -8,7 +8,6 @@ include $(TOPDIR)/rules.mk include $(INCLUDE_DIR)/kernel.mk -include $(INCLUDE_DIR)/host.mk include $(INCLUDE_DIR)/version.mk override MAKEFLAGS= diff --git a/target/sdk/files/Makefile b/target/sdk/files/Makefile index 2edf7b3a20..8df1904cb0 100644 --- a/target/sdk/files/Makefile +++ b/target/sdk/files/Makefile @@ -14,7 +14,7 @@ export TOPDIR LC_ALL LANG SDK world: -include $(TOPDIR)/include/host.mk +export PATH:=$(TOPDIR)/staging_dir/host/bin:$(PATH) ifneq ($(OPENWRT_BUILD),1) override OPENWRT_BUILD=1 diff --git a/target/toolchain/Makefile b/target/toolchain/Makefile index 2fcda3e25f..ef2dc68a97 100644 --- a/target/toolchain/Makefile +++ b/target/toolchain/Makefile @@ -9,7 +9,6 @@ include $(TOPDIR)/rules.mk include $(INCLUDE_DIR)/kernel.mk -include $(INCLUDE_DIR)/host.mk include $(INCLUDE_DIR)/version.mk override MAKEFLAGS=