1b2441318SGreg Kroah-Hartman# SPDX-License-Identifier: GPL-2.0 29f7ef985SJiri Olsaifeq ($(srctree),) 3e19b7ceeSUwe Kleine-Königsrctree := $(patsubst %/,%,$(dir $(CURDIR))) 49f7ef985SJiri Olsasrctree := $(patsubst %/,%,$(dir $(srctree))) 59f7ef985SJiri Olsaendif 69f7ef985SJiri Olsa 79f7ef985SJiri Olsainclude $(srctree)/tools//scripts/Makefile.include 89f7ef985SJiri Olsa 99f7ef985SJiri Olsadefine allow-override 109f7ef985SJiri Olsa $(if $(or $(findstring environment,$(origin $(1))),\ 119f7ef985SJiri Olsa $(findstring command line,$(origin $(1)))),,\ 129f7ef985SJiri Olsa $(eval $(1) = $(2))) 139f7ef985SJiri Olsaendef 149f7ef985SJiri Olsa 159f7ef985SJiri Olsa$(call allow-override,CC,$(CROSS_COMPILE)gcc) 169f7ef985SJiri Olsa$(call allow-override,LD,$(CROSS_COMPILE)ld) 179f7ef985SJiri Olsa 180c3b7e42SJiri Olsaexport HOSTCC HOSTLD HOSTAR 190c3b7e42SJiri Olsa 209f7ef985SJiri Olsaifeq ($(V),1) 219f7ef985SJiri Olsa Q = 229f7ef985SJiri Olsaelse 239f7ef985SJiri Olsa Q = @ 249f7ef985SJiri Olsaendif 259f7ef985SJiri Olsa 269f7ef985SJiri Olsaexport Q srctree CC LD 279f7ef985SJiri Olsa 289f7ef985SJiri OlsaMAKEFLAGS := --no-print-directory 299f7ef985SJiri Olsabuild := -f $(srctree)/tools/build/Makefile.build dir=. obj 309f7ef985SJiri Olsa 315e50426dSJiri Olsaall: $(OUTPUT)fixdep 329f7ef985SJiri Olsa 33762323ebSJiri Olsa# Make sure there's anything to clean, 34762323ebSJiri Olsa# feature contains check for existing OUTPUT 358af52e69SJames ClarkTMP_O := $(if $(OUTPUT),$(OUTPUT)feature/,./) 36762323ebSJiri Olsa 379f7ef985SJiri Olsaclean: 389f7ef985SJiri Olsa $(call QUIET_CLEAN, fixdep) 395c816641SMasahiro Yamada $(Q)find $(or $(OUTPUT),.) -name '*.o' -delete -o -name '\.*.cmd' -delete -o -name '\.*.d' -delete 4085e0d509SJiri Olsa $(Q)rm -f $(OUTPUT)fixdep 41661b37cdSJesper Dangaard Brouer $(call QUIET_CLEAN, feature-detect) 42762323ebSJiri Olsaifneq ($(wildcard $(TMP_O)),) 43762323ebSJiri Olsa $(Q)$(MAKE) -C feature OUTPUT=$(TMP_O) clean >/dev/null 44762323ebSJiri Olsaendif 459f7ef985SJiri Olsa 46ea974028SBrian Norris$(OUTPUT)fixdep: $(srctree)/tools/build/fixdep.c 47*b53f20b3SAlexander Gordeev $(QUIET_CC)$(HOSTCC) $(KBUILD_HOSTCFLAGS) $(KBUILD_HOSTLDFLAGS) -o $@ $< 48