kernel: bump 5.10 to 5.10.90
[openwrt/staging/chunkeey.git] / include / toplevel.mk
index 77a5b155cea315184e1e5cb268b0049b722c7bd9..f5a2593a105c5bd2cec238c81f33d9f096525fa6 100644 (file)
@@ -1,24 +1,66 @@
-# Makefile for OpenWrt
-#
-# Copyright (C) 2007-2012 OpenWrt.org
-#
-# This is free software, licensed under the GNU General Public License v2.
-# See /LICENSE for more information.
+# SPDX-License-Identifier: GPL-2.0-only
 #
+# Copyright (C) 2007-2020 OpenWrt.org
 
 PREP_MK= OPENWRT_BUILD= QUIET=0
 
-export IS_TTY=$(shell tty -s && echo 1 || echo 0)
+export IS_TTY=$(if $(MAKE_TERMOUT),1,0)
 
 include $(TOPDIR)/include/verbose.mk
-ifeq ($(OPENWRT_VARS),)
-  include $(TOPDIR)/include/toplevel-vars.mk
+
+ifeq ($(SDK),1)
+  include $(TOPDIR)/include/version.mk
+else
+  REVISION:=$(shell $(TOPDIR)/scripts/getver.sh)
+  SOURCE_DATE_EPOCH:=$(shell $(TOPDIR)/scripts/get_source_date_epoch.sh)
+endif
+
+export REVISION
+export SOURCE_DATE_EPOCH
+export GIT_CONFIG_PARAMETERS='core.autocrlf=false'
+export GIT_ASKPASS:=/bin/true
+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)
+
+ifeq ($(HOST_OS),Darwin)
+  ifneq ($(filter /Applications/Xcode.app/% /Library/Developer/%,$(MAKE)),)
+    $(error Please use a newer version of GNU make. The version shipped by Apple is not supported)
+  endif
 endif
 
+# prevent perforce from messing with the patch utility
+unexport P4PORT P4USER P4CONFIG P4CLIENT
+
+# prevent user defaults for quilt from interfering
+unexport QUILT_PATCHES QUILT_PATCH_OPTS
+
+unexport C_INCLUDE_PATH CROSS_COMPILE ARCH
+
+# prevent distro default LPATH from interfering
+unexport LPATH
+
+# make sure that a predefined CFLAGS variable does not disturb packages
+export CFLAGS=
+export LDFLAGS=
+
+empty:=
+space:= $(empty) $(empty)
+path:=$(subst :,$(space),$(PATH))
+path:=$(filter-out .%,$(path))
+path:=$(subst $(space),:,$(path))
+export PATH:=$(path)
+
+unexport TAR_OPTIONS
+
 ifeq ($(FORCE),)
   .config scripts/config/conf scripts/config/mconf: staging_dir/host/.prereq-build
 endif
 
+SCAN_COOKIE?=$(shell echo $$$$)
+export SCAN_COOKIE
+
 SUBMAKE:=umask 022; $(SUBMAKE)
 
 ULIMIT_FIX=_limit=`ulimit -n`; [ "$$_limit" = "unlimited" -o "$$_limit" -ge 1024 ] || ulimit -n 1024;
@@ -61,7 +103,7 @@ endif
 scripts/config/%onf: CFLAGS+= -O2
 scripts/config/%onf:
        @$(_SINGLE)$(SUBMAKE) $(if $(findstring s,$(OPENWRT_VERBOSE)),,-s) \
-               -C scripts/config $(notdir $@) CC="$(HOSTCC_WRAPPER)"
+               -C scripts/config $(notdir $@)
 
 $(eval $(call rdep,scripts/config,scripts/config/mconf))
 
@@ -215,8 +257,8 @@ package/symlinks-clean:
 help:
        cat README.md
 
-distclean: cacheclean
-       rm -rf bin build_dir .config* dl feeds key-build* logs package/feeds package/openwrt-packages staging_dir tmp
+distclean:
+       rm -rf bin build_dir .ccache .config* dl feeds key-build* logs package/feeds staging_dir tmp
        @$(_SINGLE)$(SUBMAKE) -C scripts/config clean
 
 ifeq ($(findstring v,$(DEBUG)),)