2015-09-23 17:33:58 +07:00
|
|
|
ifeq ($(srctree),)
|
2016-11-22 15:30:26 +07:00
|
|
|
srctree := $(patsubst %/,%,$(dir $(CURDIR)))
|
2015-09-23 17:33:58 +07: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 21:18:46 +07:00
|
|
|
HOSTCC ?= gcc
|
|
|
|
HOSTLD ?= ld
|
|
|
|
HOSTAR ?= ar
|
|
|
|
|
|
|
|
export HOSTCC HOSTLD HOSTAR
|
|
|
|
|
2015-09-23 17:33:58 +07:00
|
|
|
ifeq ($(V),1)
|
|
|
|
Q =
|
|
|
|
else
|
|
|
|
Q = @
|
|
|
|
endif
|
|
|
|
|
|
|
|
export Q srctree CC LD
|
|
|
|
|
|
|
|
MAKEFLAGS := --no-print-directory
|
|
|
|
build := -f $(srctree)/tools/build/Makefile.build dir=. obj
|
|
|
|
|
2015-11-27 01:50:55 +07:00
|
|
|
all: $(OUTPUT)fixdep
|
2015-09-23 17:33:58 +07:00
|
|
|
|
|
|
|
clean:
|
|
|
|
$(call QUIET_CLEAN, fixdep)
|
perf build: Add special fixdep cleaning rule
Ingo reported following build failure:
On Sat, Feb 11, 2017 at 12:12:34PM +0100, Ingo Molnar wrote:
>
> So I had this oldish 32-bit 15.10 Ubuntu installation around (fully updated), and
> trying to build perf gave me:
>
> deimos:~/tip/tools/perf> make
> BUILD: Doing 'make -j4' parallel build
> make[3]: *** No rule to make target '/usr/include/x86_64-linux-gnu/sys/types.h', needed by 'fixdep.o'. Stop.
> Makefile:42: recipe for target 'fixdep-in.o' failed
> make[2]: *** [fixdep-in.o] Error 2
> /home/mingo/tip/tools/build/Makefile.include:4: recipe for target 'fixdep' failed
> make[1]: *** [fixdep] Error 2
> Makefile:68: recipe for target 'all' failed
> make: *** [all] Error 2
>
> Now this got a bit better after I did a 'make mrproper' in the kernel tree:
>
> deimos:~/tip/tools/perf> make
> BUILD: Doing 'make -j4' parallel build
> HOSTCC fixdep.o
> /home/mingo/tip/tools/build/fixdep: 1: /home/mingo/tip/tools/build/fixdep: Syntax error: "(" unexpected
> /home/mingo/tip/tools/build/Makefile.build:101: recipe for target 'fixdep.o' failed
> make[3]: *** [fixdep.o] Error 2
> Makefile:42: recipe for target 'fixdep-in.o' failed
> make[2]: *** [fixdep-in.o] Error 2
> /home/mingo/tip/tools/build/Makefile.include:4: recipe for target 'fixdep' failed
> make[1]: *** [fixdep] Error 2
> Makefile:68: recipe for target 'all' failed
> make: *** [all] Error 2
>
> After some digging it turns out that my 'fixdep' binary was 64-bit:
>
> deimos:~/tip/tools/perf> file /home/mingo/tip/tools/build/fixdep
> /home/mingo/tip/tools/build/fixdep: ELF 64-bit LSB executable, x86-64, version 1
> (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux
> 2.6.32, BuildID[sha1]=d527f736b57b5ba47210fbcb562a3b52867d21c1, not stripped
>
> But it did not get cleaned out by 'make clean'.
>
> Only after I did a 'make clean' in tools/ itself, did it get built properly.
It shows we don't clean up properly the fixdep objects, so adding
special rule for that.
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Reported-by: Ingo Molnar <mingo@kernel.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1487340058-10496-2-git-send-email-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2017-02-17 21:00:54 +07:00
|
|
|
$(Q)find $(if $(OUTPUT),$(OUTPUT),.) -name '*.o' -delete -o -name '\.*.cmd' -delete -o -name '\.*.d' -delete
|
|
|
|
$(Q)rm -f $(OUTPUT)fixdep
|
2015-09-23 17:33:58 +07:00
|
|
|
|
|
|
|
$(OUTPUT)fixdep-in.o: FORCE
|
|
|
|
$(Q)$(MAKE) $(build)=fixdep
|
|
|
|
|
|
|
|
$(OUTPUT)fixdep: $(OUTPUT)fixdep-in.o
|
2016-09-27 21:18:46 +07:00
|
|
|
$(QUIET_LINK)$(HOSTCC) $(LDFLAGS) -o $@ $<
|
2015-09-23 17:33:58 +07:00
|
|
|
|
|
|
|
FORCE:
|
|
|
|
|
|
|
|
.PHONY: FORCE
|