blob: 6f11e6fc9ffe33337564c4d0496a26ab6956640e [file] [log] [blame]
Greg Kroah-Hartmanb2441312017-11-01 15:07:57 +01001# SPDX-License-Identifier: GPL-2.0
Jiri Olsa9f7ef982015-09-23 12:33:58 +02002ifeq ($(srctree),)
Uwe Kleine-Könige19b7ce2016-11-22 09:30:26 +01003srctree := $(patsubst %/,%,$(dir $(CURDIR)))
Jiri Olsa9f7ef982015-09-23 12:33:58 +02004srctree := $(patsubst %/,%,$(dir $(srctree)))
5endif
6
7include $(srctree)/tools//scripts/Makefile.include
8
9define allow-override
10 $(if $(or $(findstring environment,$(origin $(1))),\
11 $(findstring command line,$(origin $(1)))),,\
12 $(eval $(1) = $(2)))
13endef
14
15$(call allow-override,CC,$(CROSS_COMPILE)gcc)
16$(call allow-override,LD,$(CROSS_COMPILE)ld)
17
Jiri Olsa0c3b7e42016-09-27 16:18:46 +020018export HOSTCC HOSTLD HOSTAR
19
Jiri Olsa9f7ef982015-09-23 12:33:58 +020020ifeq ($(V),1)
21 Q =
22else
23 Q = @
24endif
25
26export Q srctree CC LD
27
28MAKEFLAGS := --no-print-directory
29build := -f $(srctree)/tools/build/Makefile.build dir=. obj
30
Jiri Olsa5e504262015-11-26 19:50:55 +010031all: $(OUTPUT)fixdep
Jiri Olsa9f7ef982015-09-23 12:33:58 +020032
Jiri Olsa762323e2021-02-24 16:08:31 +010033# Make sure there's anything to clean,
34# feature contains check for existing OUTPUT
James Clark8af52e62021-08-16 14:07:05 +010035TMP_O := $(if $(OUTPUT),$(OUTPUT)feature/,./)
Jiri Olsa762323e2021-02-24 16:08:31 +010036
Jiri Olsa9f7ef982015-09-23 12:33:58 +020037clean:
38 $(call QUIET_CLEAN, fixdep)
Jiri Olsa85e0d502017-02-17 15:00:54 +010039 $(Q)find $(if $(OUTPUT),$(OUTPUT),.) -name '*.o' -delete -o -name '\.*.cmd' -delete -o -name '\.*.d' -delete
40 $(Q)rm -f $(OUTPUT)fixdep
Jesper Dangaard Brouer661b37c2020-08-27 10:53:36 +020041 $(call QUIET_CLEAN, feature-detect)
Jiri Olsa762323e2021-02-24 16:08:31 +010042ifneq ($(wildcard $(TMP_O)),)
43 $(Q)$(MAKE) -C feature OUTPUT=$(TMP_O) clean >/dev/null
44endif
Jiri Olsa9f7ef982015-09-23 12:33:58 +020045
46$(OUTPUT)fixdep-in.o: FORCE
47 $(Q)$(MAKE) $(build)=fixdep
48
49$(OUTPUT)fixdep: $(OUTPUT)fixdep-in.o
Laura Abbottb90a3682018-07-09 17:46:00 -070050 $(QUIET_LINK)$(HOSTCC) $(KBUILD_HOSTLDFLAGS) -o $@ $<
Jiri Olsa9f7ef982015-09-23 12:33:58 +020051
52FORCE:
53
54.PHONY: FORCE