1 include ..
/scripts
/Makefile.
include
2 include ..
/scripts
/Makefile.arch
8 # always use the host compiler
14 srctree
:= $(patsubst %/,%,$(dir $(CURDIR
)))
15 srctree
:= $(patsubst %/,%,$(dir $(srctree
)))
18 SUBCMD_SRCDIR
= $(srctree
)/tools
/lib
/subcmd
/
19 LIBSUBCMD_OUTPUT
= $(if
$(OUTPUT
),$(OUTPUT
),$(CURDIR
)/)
20 LIBSUBCMD
= $(LIBSUBCMD_OUTPUT
)libsubcmd.a
22 OBJTOOL
:= $(OUTPUT
)objtool
23 OBJTOOL_IN
:= $(OBJTOOL
)-in.o
27 INCLUDES
:= -I
$(srctree
)/tools
/include -I
$(srctree
)/tools
/arch
/$(HOSTARCH
)/include/uapi
28 WARNINGS
:= $(EXTRA_WARNINGS
) -Wno-switch-default
-Wno-switch-enum
-Wno-packed
29 CFLAGS
+= -Wall
-Werror
$(WARNINGS
) -fomit-frame-pointer
-O2
-g
$(INCLUDES
)
30 LDFLAGS
+= -lelf
$(LIBSUBCMD
)
32 # Allow old libelf to be used:
33 elfshdr
:= $(shell echo
'\#include <libelf.h>' |
$(CC
) $(CFLAGS
) -x c
-E
- | grep elf_getshdr
)
34 CFLAGS
+= $(if
$(elfshdr
),,-DLIBELF_USE_DEPRECATED
)
37 export srctree OUTPUT CFLAGS SRCARCH AWK
38 include $(srctree
)/tools
/build
/Makefile.
include
40 $(OBJTOOL_IN
): fixdep FORCE
41 @
$(MAKE
) $(build
)=objtool
43 # Busybox's diff doesn't have -I, avoid warning in that case
45 $(OBJTOOL
): $(LIBSUBCMD
) $(OBJTOOL_IN
)
46 @
(diff
-I
2>&1 | grep
-q
'option requires an argument' && \
47 test -d ..
/..
/kernel
-a
-d ..
/..
/tools
-a
-d ..
/objtool
&& (( \
48 diff
-I
'^#include' arch
/x86
/insn
/insn.c ..
/..
/arch
/x86
/lib
/insn.c
>/dev
/null
&& \
49 diff
-I
'^#include' arch
/x86
/insn
/inat.c ..
/..
/arch
/x86
/lib
/inat.c
>/dev
/null
&& \
50 diff arch
/x86
/insn
/x86-opcode-map.txt ..
/..
/arch
/x86
/lib
/x86-opcode-map.txt
>/dev
/null
&& \
51 diff arch
/x86
/insn
/gen-insn-attr-x86.awk ..
/..
/arch
/x86
/tools
/gen-insn-attr-x86.awk
>/dev
/null
&& \
52 diff
-I
'^#include' arch
/x86
/insn
/insn.h ..
/..
/arch
/x86
/include/asm
/insn.h
>/dev
/null
&& \
53 diff
-I
'^#include' arch
/x86
/insn
/inat.h ..
/..
/arch
/x86
/include/asm
/inat.h
>/dev
/null
&& \
54 diff
-I
'^#include' arch
/x86
/insn
/inat_types.h ..
/..
/arch
/x86
/include/asm
/inat_types.h
>/dev
/null
) \
55 || echo
"warning: objtool: x86 instruction decoder differs from kernel" >&2 )) || true
56 @
(test -d ..
/..
/kernel
-a
-d ..
/..
/tools
-a
-d ..
/objtool
&& (( \
57 diff ..
/..
/arch
/x86
/include/asm
/orc_types.h orc_types.h
>/dev
/null
) \
58 || echo
"warning: objtool: orc_types.h differs from kernel" >&2 )) || true
59 $(QUIET_LINK
)$(CC
) $(OBJTOOL_IN
) $(LDFLAGS
) -o
$@
62 $(LIBSUBCMD
): fixdep FORCE
63 $(Q
)$(MAKE
) -C
$(SUBCMD_SRCDIR
) OUTPUT
=$(LIBSUBCMD_OUTPUT
)
66 $(call QUIET_CLEAN
, objtool
) $(RM
) $(OBJTOOL
)
67 $(Q
)find
$(OUTPUT
) -name
'*.o' -delete
-o
-name
'\.*.cmd' -delete
-o
-name
'\.*.d' -delete
68 $(Q
)$(RM
) $(OUTPUT
)arch
/x86
/insn
/inat-tables.c
$(OUTPUT
)fixdep