perf scripts python: exported-sql-viewer.py: Use new 'has_calls' column
[linux/fpc-iii.git] / tools / objtool / Makefile
blob88158239622bce38a7f27fb718123b8a62e03d09
1 # SPDX-License-Identifier: GPL-2.0
2 include ../scripts/Makefile.include
3 include ../scripts/Makefile.arch
5 ifeq ($(ARCH),x86_64)
6 ARCH := x86
7 endif
9 # always use the host compiler
10 HOSTAR ?= ar
11 HOSTCC ?= gcc
12 HOSTLD ?= ld
13 AR = $(HOSTAR)
14 CC = $(HOSTCC)
15 LD = $(HOSTLD)
17 ifeq ($(srctree),)
18 srctree := $(patsubst %/,%,$(dir $(CURDIR)))
19 srctree := $(patsubst %/,%,$(dir $(srctree)))
20 endif
22 SUBCMD_SRCDIR = $(srctree)/tools/lib/subcmd/
23 LIBSUBCMD_OUTPUT = $(if $(OUTPUT),$(OUTPUT),$(CURDIR)/)
24 LIBSUBCMD = $(LIBSUBCMD_OUTPUT)libsubcmd.a
26 OBJTOOL := $(OUTPUT)objtool
27 OBJTOOL_IN := $(OBJTOOL)-in.o
29 LIBELF_FLAGS := $(shell pkg-config libelf --cflags 2>/dev/null)
30 LIBELF_LIBS := $(shell pkg-config libelf --libs 2>/dev/null || echo -lelf)
32 all: $(OBJTOOL)
34 INCLUDES := -I$(srctree)/tools/include \
35 -I$(srctree)/tools/arch/$(HOSTARCH)/include/uapi \
36 -I$(srctree)/tools/objtool/arch/$(ARCH)/include
37 WARNINGS := $(EXTRA_WARNINGS) -Wno-switch-default -Wno-switch-enum -Wno-packed
38 CFLAGS += -Werror $(WARNINGS) $(KBUILD_HOSTCFLAGS) -g $(INCLUDES) $(LIBELF_FLAGS)
39 LDFLAGS += $(LIBELF_LIBS) $(LIBSUBCMD) $(KBUILD_HOSTLDFLAGS)
41 # Allow old libelf to be used:
42 elfshdr := $(shell echo '$(pound)include <libelf.h>' | $(CC) $(CFLAGS) -x c -E - | grep elf_getshdr)
43 CFLAGS += $(if $(elfshdr),,-DLIBELF_USE_DEPRECATED)
45 AWK = awk
46 export srctree OUTPUT CFLAGS SRCARCH AWK
47 include $(srctree)/tools/build/Makefile.include
49 $(OBJTOOL_IN): fixdep FORCE
50 @$(MAKE) $(build)=objtool
52 $(OBJTOOL): $(LIBSUBCMD) $(OBJTOOL_IN)
53 @$(CONFIG_SHELL) ./sync-check.sh
54 $(QUIET_LINK)$(CC) $(OBJTOOL_IN) $(LDFLAGS) -o $@
57 $(LIBSUBCMD): fixdep FORCE
58 $(Q)$(MAKE) -C $(SUBCMD_SRCDIR) OUTPUT=$(LIBSUBCMD_OUTPUT)
60 clean:
61 $(call QUIET_CLEAN, objtool) $(RM) $(OBJTOOL)
62 $(Q)find $(OUTPUT) -name '*.o' -delete -o -name '\.*.cmd' -delete -o -name '\.*.d' -delete
63 $(Q)$(RM) $(OUTPUT)arch/x86/lib/inat-tables.c $(OUTPUT)fixdep
65 FORCE:
67 .PHONY: clean FORCE