2017-11-01 15:07:57 +01:00
|
|
|
# SPDX-License-Identifier: GPL-2.0
|
2015-09-23 12:33:58 +02:00
|
|
|
ifeq ($(srctree),)
|
2016-11-22 09:30:26 +01:00
|
|
|
srctree := $(patsubst %/,%,$(dir $(CURDIR)))
|
2015-09-23 12:33:58 +02:00
|
|
|
srctree := $(patsubst %/,%,$(dir $(srctree)))
|
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
include $(srctree)/tools//scripts/Makefile.include
|
|
|
|
|
|
|
|
|
|
define allow-override
|
|
|
|
|
$(if $(or $(findstring environment,$(origin $(1))),\
|
|
|
|
|
$(findstring command line,$(origin $(1)))),,\
|
|
|
|
|
$(eval $(1) = $(2)))
|
|
|
|
|
endef
|
|
|
|
|
|
|
|
|
|
$(call allow-override,CC,$(CROSS_COMPILE)gcc)
|
|
|
|
|
$(call allow-override,LD,$(CROSS_COMPILE)ld)
|
|
|
|
|
|
2016-09-27 16:18:46 +02:00
|
|
|
export HOSTCC HOSTLD HOSTAR
|
|
|
|
|
|
2025-02-13 13:06:21 -08:00
|
|
|
export srctree CC LD
|
2015-09-23 12:33:58 +02:00
|
|
|
|
|
|
|
|
MAKEFLAGS := --no-print-directory
|
|
|
|
|
build := -f $(srctree)/tools/build/Makefile.build dir=. obj
|
|
|
|
|
|
2015-11-26 19:50:55 +01:00
|
|
|
all: $(OUTPUT)fixdep
|
2015-09-23 12:33:58 +02:00
|
|
|
|
2021-02-24 16:08:31 +01:00
|
|
|
# Make sure there's anything to clean,
|
|
|
|
|
# feature contains check for existing OUTPUT
|
2021-08-16 14:07:05 +01:00
|
|
|
TMP_O := $(if $(OUTPUT),$(OUTPUT)feature/,./)
|
2021-02-24 16:08:31 +01:00
|
|
|
|
2015-09-23 12:33:58 +02:00
|
|
|
clean:
|
|
|
|
|
$(call QUIET_CLEAN, fixdep)
|
2022-02-11 14:14:11 +09:00
|
|
|
$(Q)find $(or $(OUTPUT),.) -name '*.o' -delete -o -name '\.*.cmd' -delete -o -name '\.*.d' -delete
|
2017-02-17 15:00:54 +01:00
|
|
|
$(Q)rm -f $(OUTPUT)fixdep
|
2020-08-27 10:53:36 +02:00
|
|
|
$(call QUIET_CLEAN, feature-detect)
|
2021-02-24 16:08:31 +01:00
|
|
|
ifneq ($(wildcard $(TMP_O)),)
|
|
|
|
|
$(Q)$(MAKE) -C feature OUTPUT=$(TMP_O) clean >/dev/null
|
|
|
|
|
endif
|
2015-09-23 12:33:58 +02:00
|
|
|
|
2025-03-02 17:01:42 -08:00
|
|
|
FIXDEP := $(OUTPUT)fixdep
|
|
|
|
|
FIXDEP_IN := $(OUTPUT)fixdep-in.o
|
|
|
|
|
|
|
|
|
|
# To track fixdep's dependencies properly, fixdep needs to run on itself.
|
|
|
|
|
# Build it twice the first time.
|
|
|
|
|
$(FIXDEP_IN): FORCE
|
|
|
|
|
$(Q)if [ ! -f $(FIXDEP) ]; then \
|
|
|
|
|
$(MAKE) $(build)=fixdep HOSTCFLAGS="$(KBUILD_HOSTCFLAGS)"; \
|
|
|
|
|
rm -f $(FIXDEP).o; \
|
|
|
|
|
fi
|
|
|
|
|
$(Q)$(MAKE) $(build)=fixdep HOSTCFLAGS="$(KBUILD_HOSTCFLAGS)"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$(FIXDEP): $(FIXDEP_IN)
|
|
|
|
|
$(QUIET_LINK)$(HOSTCC) $(FIXDEP_IN) $(KBUILD_HOSTLDFLAGS) -o $@
|
|
|
|
|
|
|
|
|
|
FORCE:
|
|
|
|
|
|
|
|
|
|
.PHONY: FORCE
|