blob: 7278e2545c3500d6022663d46e8e928c5f2d0ab8 [file] [log] [blame]
Greg Kroah-Hartmanb2441312017-11-01 15:07:57 +01001# SPDX-License-Identifier: GPL-2.0
Masami Hiramatsuca0e9ba2009-08-13 16:34:21 -04002PHONY += posttest
Masami Hiramatsud65ff752009-11-16 18:06:18 -05003
Masahiro Yamada6ae4b982022-12-23 01:25:34 +09004ifneq ($(findstring 1, $(KBUILD_VERBOSE)),)
Masami Hiramatsu80509e22009-11-20 12:13:08 -05005 posttest_verbose = -v
Masami Hiramatsud65ff752009-11-16 18:06:18 -05006else
Masami Hiramatsu80509e22009-11-20 12:13:08 -05007 posttest_verbose =
8endif
9
10ifeq ($(CONFIG_64BIT),y)
11 posttest_64bit = -y
12else
13 posttest_64bit = -n
Masami Hiramatsud65ff752009-11-16 18:06:18 -050014endif
15
Masami Hiramatsu98fe07f2017-11-25 00:10:54 +090016reformatter = $(srctree)/arch/x86/tools/objdump_reformat.awk
Masami Hiramatsu6f5f6722009-11-20 12:13:14 -050017chkobjdump = $(srctree)/arch/x86/tools/chkobjdump.awk
18
Masami Hiramatsuca0e9ba2009-08-13 16:34:21 -040019quiet_cmd_posttest = TEST $@
Nathan Chancellor52259522023-11-29 15:17:43 -070020 cmd_posttest = $(OBJDUMP) -d -j .text $(objtree)/vmlinux | $(AWK) -f $(reformatter) | $(obj)/insn_decoder_test $(posttest_64bit) $(posttest_verbose)
Masami Hiramatsuca0e9ba2009-08-13 16:34:21 -040021
Masami Hiramatsu1ec454b2011-10-20 23:01:09 +090022quiet_cmd_sanitytest = TEST $@
23 cmd_sanitytest = $(obj)/insn_sanity $(posttest_64bit) -m 1000000
24
Masami Hiramatsu6b63dd12017-11-25 00:10:25 +090025posttest: $(obj)/insn_decoder_test vmlinux $(obj)/insn_sanity
Masami Hiramatsuca0e9ba2009-08-13 16:34:21 -040026 $(call cmd,posttest)
Masami Hiramatsu1ec454b2011-10-20 23:01:09 +090027 $(call cmd,sanitytest)
Masami Hiramatsuca0e9ba2009-08-13 16:34:21 -040028
Masahiro Yamada5f2fb522020-02-02 01:49:24 +090029hostprogs += insn_decoder_test insn_sanity
Masami Hiramatsuca0e9ba2009-08-13 16:34:21 -040030
31# -I needed for generated C source and C source which in the kernel tree.
Vasily Gorbikc8d7b7e2020-11-13 00:03:20 +010032HOSTCFLAGS_insn_decoder_test.o := -Wall -I$(srctree)/tools/arch/x86/lib/ -I$(srctree)/tools/arch/x86/include/ -I$(objtree)/arch/x86/lib/
Masami Hiramatsuca0e9ba2009-08-13 16:34:21 -040033
Vasily Gorbikc8d7b7e2020-11-13 00:03:20 +010034HOSTCFLAGS_insn_sanity.o := -Wall -I$(srctree)/tools/arch/x86/lib/ -I$(srctree)/tools/arch/x86/include/ -I$(objtree)/arch/x86/lib/
Masami Hiramatsu1ec454b2011-10-20 23:01:09 +090035
Ingo Molnar9bf4e7f2009-10-21 14:39:51 +020036# Dependencies are also needed.
Vasily Gorbikc8d7b7e2020-11-13 00:03:20 +010037$(obj)/insn_decoder_test.o: $(srctree)/tools/arch/x86/lib/insn.c $(srctree)/tools/arch/x86/lib/inat.c $(srctree)/tools/arch/x86/include/asm/inat_types.h $(srctree)/tools/arch/x86/include/asm/inat.h $(srctree)/tools/arch/x86/include/asm/insn.h $(objtree)/arch/x86/lib/inat-tables.c
Masami Hiramatsuca0e9ba2009-08-13 16:34:21 -040038
Vasily Gorbikc8d7b7e2020-11-13 00:03:20 +010039$(obj)/insn_sanity.o: $(srctree)/tools/arch/x86/lib/insn.c $(srctree)/tools/arch/x86/lib/inat.c $(srctree)/tools/arch/x86/include/asm/inat_types.h $(srctree)/tools/arch/x86/include/asm/inat.h $(srctree)/tools/arch/x86/include/asm/insn.h $(objtree)/arch/x86/lib/inat-tables.c
H. Peter Anvin6520fe52012-05-08 21:22:24 +030040
41HOST_EXTRACFLAGS += -I$(srctree)/tools/include
Masahiro Yamada5f2fb522020-02-02 01:49:24 +090042hostprogs += relocs
H. Peter Anvinc889ba82013-04-16 16:02:58 -070043relocs-objs := relocs_32.o relocs_64.o relocs_common.o
Masahiro Yamadae6bcd1a2014-04-10 10:35:42 +090044PHONY += relocs
H. Peter Anvinc889ba82013-04-16 16:02:58 -070045relocs: $(obj)/relocs
Masahiro Yamadae6bcd1a2014-04-10 10:35:42 +090046 @: