Greg Kroah-Hartman | b244131 | 2017-11-01 15:07:57 +0100 | [diff] [blame] | 1 | # SPDX-License-Identifier: GPL-2.0 |
Jiri Olsa | 9f7ef98 | 2015-09-23 12:33:58 +0200 | [diff] [blame] | 2 | ifeq ($(srctree),) |
Uwe Kleine-König | e19b7ce | 2016-11-22 09:30:26 +0100 | [diff] [blame] | 3 | srctree := $(patsubst %/,%,$(dir $(CURDIR))) |
Jiri Olsa | 9f7ef98 | 2015-09-23 12:33:58 +0200 | [diff] [blame] | 4 | srctree := $(patsubst %/,%,$(dir $(srctree))) |
| 5 | endif |
| 6 | |
| 7 | include $(srctree)/tools//scripts/Makefile.include |
| 8 | |
| 9 | define allow-override |
| 10 | $(if $(or $(findstring environment,$(origin $(1))),\ |
| 11 | $(findstring command line,$(origin $(1)))),,\ |
| 12 | $(eval $(1) = $(2))) |
| 13 | endef |
| 14 | |
| 15 | $(call allow-override,CC,$(CROSS_COMPILE)gcc) |
| 16 | $(call allow-override,LD,$(CROSS_COMPILE)ld) |
| 17 | |
Jiri Olsa | 0c3b7e4 | 2016-09-27 16:18:46 +0200 | [diff] [blame] | 18 | export HOSTCC HOSTLD HOSTAR |
| 19 | |
Jiri Olsa | 9f7ef98 | 2015-09-23 12:33:58 +0200 | [diff] [blame] | 20 | ifeq ($(V),1) |
| 21 | Q = |
| 22 | else |
| 23 | Q = @ |
| 24 | endif |
| 25 | |
| 26 | export Q srctree CC LD |
| 27 | |
| 28 | MAKEFLAGS := --no-print-directory |
| 29 | build := -f $(srctree)/tools/build/Makefile.build dir=. obj |
| 30 | |
Jiri Olsa | 5e50426 | 2015-11-26 19:50:55 +0100 | [diff] [blame] | 31 | all: $(OUTPUT)fixdep |
Jiri Olsa | 9f7ef98 | 2015-09-23 12:33:58 +0200 | [diff] [blame] | 32 | |
Jiri Olsa | 762323e | 2021-02-24 16:08:31 +0100 | [diff] [blame] | 33 | # Make sure there's anything to clean, |
| 34 | # feature contains check for existing OUTPUT |
James Clark | 8af52e6 | 2021-08-16 14:07:05 +0100 | [diff] [blame] | 35 | TMP_O := $(if $(OUTPUT),$(OUTPUT)feature/,./) |
Jiri Olsa | 762323e | 2021-02-24 16:08:31 +0100 | [diff] [blame] | 36 | |
Jiri Olsa | 9f7ef98 | 2015-09-23 12:33:58 +0200 | [diff] [blame] | 37 | clean: |
| 38 | $(call QUIET_CLEAN, fixdep) |
Jiri Olsa | 85e0d50 | 2017-02-17 15:00:54 +0100 | [diff] [blame] | 39 | $(Q)find $(if $(OUTPUT),$(OUTPUT),.) -name '*.o' -delete -o -name '\.*.cmd' -delete -o -name '\.*.d' -delete |
| 40 | $(Q)rm -f $(OUTPUT)fixdep |
Jesper Dangaard Brouer | 661b37c | 2020-08-27 10:53:36 +0200 | [diff] [blame] | 41 | $(call QUIET_CLEAN, feature-detect) |
Jiri Olsa | 762323e | 2021-02-24 16:08:31 +0100 | [diff] [blame] | 42 | ifneq ($(wildcard $(TMP_O)),) |
| 43 | $(Q)$(MAKE) -C feature OUTPUT=$(TMP_O) clean >/dev/null |
| 44 | endif |
Jiri Olsa | 9f7ef98 | 2015-09-23 12:33:58 +0200 | [diff] [blame] | 45 | |
| 46 | $(OUTPUT)fixdep-in.o: FORCE |
| 47 | $(Q)$(MAKE) $(build)=fixdep |
| 48 | |
| 49 | $(OUTPUT)fixdep: $(OUTPUT)fixdep-in.o |
Laura Abbott | b90a368 | 2018-07-09 17:46:00 -0700 | [diff] [blame] | 50 | $(QUIET_LINK)$(HOSTCC) $(KBUILD_HOSTLDFLAGS) -o $@ $< |
Jiri Olsa | 9f7ef98 | 2015-09-23 12:33:58 +0200 | [diff] [blame] | 51 | |
| 52 | FORCE: |
| 53 | |
| 54 | .PHONY: FORCE |