drm/ast: Only warn about unsupported TX chips on Gen4 and later
[drm/drm-misc.git] / tools / objtool / Makefile
blobf56e2772753414ff8d3462bdebbc8e95e7667fcd
1 # SPDX-License-Identifier: GPL-2.0
2 include ../scripts/Makefile.include
3 include ../scripts/Makefile.arch
5 ifeq ($(srctree),)
6 srctree := $(patsubst %/,%,$(dir $(CURDIR)))
7 srctree := $(patsubst %/,%,$(dir $(srctree)))
8 endif
10 LIBSUBCMD_DIR = $(srctree)/tools/lib/subcmd/
11 ifneq ($(OUTPUT),)
12 LIBSUBCMD_OUTPUT = $(abspath $(OUTPUT))/libsubcmd
13 else
14 LIBSUBCMD_OUTPUT = $(CURDIR)/libsubcmd
15 endif
16 LIBSUBCMD = $(LIBSUBCMD_OUTPUT)/libsubcmd.a
18 OBJTOOL := $(OUTPUT)objtool
19 OBJTOOL_IN := $(OBJTOOL)-in.o
21 LIBELF_FLAGS := $(shell $(HOSTPKG_CONFIG) libelf --cflags 2>/dev/null)
22 LIBELF_LIBS := $(shell $(HOSTPKG_CONFIG) libelf --libs 2>/dev/null || echo -lelf)
24 all: $(OBJTOOL)
26 INCLUDES := -I$(srctree)/tools/include \
27 -I$(srctree)/tools/include/uapi \
28 -I$(srctree)/tools/arch/$(HOSTARCH)/include/uapi \
29 -I$(srctree)/tools/arch/$(SRCARCH)/include \
30 -I$(srctree)/tools/objtool/include \
31 -I$(srctree)/tools/objtool/arch/$(SRCARCH)/include \
32 -I$(LIBSUBCMD_OUTPUT)/include
33 # Note, EXTRA_WARNINGS here was determined for CC and not HOSTCC, it
34 # is passed here to match a legacy behavior.
35 WARNINGS := $(EXTRA_WARNINGS) -Wno-switch-default -Wno-switch-enum -Wno-packed -Wno-nested-externs
36 OBJTOOL_CFLAGS := -Werror $(WARNINGS) $(KBUILD_HOSTCFLAGS) -g $(INCLUDES) $(LIBELF_FLAGS)
37 OBJTOOL_LDFLAGS := $(LIBELF_LIBS) $(LIBSUBCMD) $(KBUILD_HOSTLDFLAGS)
39 # Allow old libelf to be used:
40 elfshdr := $(shell echo '$(pound)include <libelf.h>' | $(HOSTCC) $(OBJTOOL_CFLAGS) -x c -E - | grep elf_getshdr)
41 OBJTOOL_CFLAGS += $(if $(elfshdr),,-DLIBELF_USE_DEPRECATED)
43 # Always want host compilation.
44 HOST_OVERRIDES := CC="$(HOSTCC)" LD="$(HOSTLD)" AR="$(HOSTAR)"
46 AWK = awk
47 MKDIR = mkdir
49 ifeq ($(V),1)
50 Q =
51 else
52 Q = @
53 endif
55 BUILD_ORC := n
57 ifeq ($(SRCARCH),x86)
58 BUILD_ORC := y
59 endif
61 ifeq ($(SRCARCH),loongarch)
62 BUILD_ORC := y
63 endif
65 export BUILD_ORC
66 export srctree OUTPUT CFLAGS SRCARCH AWK
67 include $(srctree)/tools/build/Makefile.include
69 $(OBJTOOL_IN): fixdep $(LIBSUBCMD) FORCE
70 $(Q)$(CONFIG_SHELL) ./sync-check.sh
71 $(Q)$(MAKE) $(build)=objtool $(HOST_OVERRIDES) CFLAGS="$(OBJTOOL_CFLAGS)" \
72 LDFLAGS="$(OBJTOOL_LDFLAGS)"
75 $(OBJTOOL): $(LIBSUBCMD) $(OBJTOOL_IN)
76 $(QUIET_LINK)$(HOSTCC) $(OBJTOOL_IN) $(OBJTOOL_LDFLAGS) -o $@
79 $(LIBSUBCMD_OUTPUT):
80 $(Q)$(MKDIR) -p $@
82 $(LIBSUBCMD): fixdep $(LIBSUBCMD_OUTPUT) FORCE
83 $(Q)$(MAKE) -C $(LIBSUBCMD_DIR) O=$(LIBSUBCMD_OUTPUT) \
84 DESTDIR=$(LIBSUBCMD_OUTPUT) prefix= subdir= \
85 $(HOST_OVERRIDES) EXTRA_CFLAGS="$(OBJTOOL_CFLAGS)" \
86 $@ install_headers
88 $(LIBSUBCMD)-clean:
89 $(call QUIET_CLEAN, libsubcmd)
90 $(Q)$(RM) -r -- $(LIBSUBCMD_OUTPUT)
92 clean: $(LIBSUBCMD)-clean
93 $(call QUIET_CLEAN, objtool) $(RM) $(OBJTOOL)
94 $(Q)find $(OUTPUT) -name '*.o' -delete -o -name '\.*.cmd' -delete -o -name '\.*.d' -delete
95 $(Q)$(RM) $(OUTPUT)arch/x86/lib/inat-tables.c $(OUTPUT)fixdep
97 FORCE:
99 .PHONY: clean FORCE