Jiri Olsa | 9f7ef98 | 2015-09-23 12:33:58 +0200 | [diff] [blame] | 1 | ifeq ($(srctree),) |
Uwe Kleine-König | e19b7ce | 2016-11-22 09:30:26 +0100 | [diff] [blame] | 2 | srctree := $(patsubst %/,%,$(dir $(CURDIR))) |
Jiri Olsa | 9f7ef98 | 2015-09-23 12:33:58 +0200 | [diff] [blame] | 3 | srctree := $(patsubst %/,%,$(dir $(srctree))) |
| 4 | endif |
| 5 | |
| 6 | include $(srctree)/tools//scripts/Makefile.include |
| 7 | |
| 8 | define allow-override |
| 9 | $(if $(or $(findstring environment,$(origin $(1))),\ |
| 10 | $(findstring command line,$(origin $(1)))),,\ |
| 11 | $(eval $(1) = $(2))) |
| 12 | endef |
| 13 | |
| 14 | $(call allow-override,CC,$(CROSS_COMPILE)gcc) |
| 15 | $(call allow-override,LD,$(CROSS_COMPILE)ld) |
| 16 | |
Jiri Olsa | 0c3b7e4 | 2016-09-27 16:18:46 +0200 | [diff] [blame] | 17 | HOSTCC ?= gcc |
| 18 | HOSTLD ?= ld |
| 19 | HOSTAR ?= ar |
| 20 | |
| 21 | export HOSTCC HOSTLD HOSTAR |
| 22 | |
Jiri Olsa | 9f7ef98 | 2015-09-23 12:33:58 +0200 | [diff] [blame] | 23 | ifeq ($(V),1) |
| 24 | Q = |
| 25 | else |
| 26 | Q = @ |
| 27 | endif |
| 28 | |
| 29 | export Q srctree CC LD |
| 30 | |
| 31 | MAKEFLAGS := --no-print-directory |
| 32 | build := -f $(srctree)/tools/build/Makefile.build dir=. obj |
| 33 | |
Jiri Olsa | 5e50426 | 2015-11-26 19:50:55 +0100 | [diff] [blame] | 34 | all: $(OUTPUT)fixdep |
Jiri Olsa | 9f7ef98 | 2015-09-23 12:33:58 +0200 | [diff] [blame] | 35 | |
| 36 | clean: |
| 37 | $(call QUIET_CLEAN, fixdep) |
Jiri Olsa | 85e0d50 | 2017-02-17 15:00:54 +0100 | [diff] [blame] | 38 | $(Q)find $(if $(OUTPUT),$(OUTPUT),.) -name '*.o' -delete -o -name '\.*.cmd' -delete -o -name '\.*.d' -delete |
| 39 | $(Q)rm -f $(OUTPUT)fixdep |
Jiri Olsa | 9f7ef98 | 2015-09-23 12:33:58 +0200 | [diff] [blame] | 40 | |
| 41 | $(OUTPUT)fixdep-in.o: FORCE |
| 42 | $(Q)$(MAKE) $(build)=fixdep |
| 43 | |
| 44 | $(OUTPUT)fixdep: $(OUTPUT)fixdep-in.o |
Jiri Olsa | 6b3db6f | 2016-09-27 16:18:46 +0200 | [diff] [blame] | 45 | $(QUIET_LINK)$(HOSTCC) $(LDFLAGS) -o $@ $< |
Jiri Olsa | 9f7ef98 | 2015-09-23 12:33:58 +0200 | [diff] [blame] | 46 | |
| 47 | FORCE: |
| 48 | |
| 49 | .PHONY: FORCE |