Greg Kroah-Hartman | b244131 | 2017-11-01 15:07:57 +0100 | [diff] [blame] | 1 | # SPDX-License-Identifier: GPL-2.0 |
Masami Hiramatsu | ca0e9ba | 2009-08-13 16:34:21 -0400 | [diff] [blame] | 2 | PHONY += posttest |
Masami Hiramatsu | d65ff75 | 2009-11-16 18:06:18 -0500 | [diff] [blame] | 3 | |
Masahiro Yamada | 6ae4b98 | 2022-12-23 01:25:34 +0900 | [diff] [blame] | 4 | ifneq ($(findstring 1, $(KBUILD_VERBOSE)),) |
Masami Hiramatsu | 80509e2 | 2009-11-20 12:13:08 -0500 | [diff] [blame] | 5 | posttest_verbose = -v |
Masami Hiramatsu | d65ff75 | 2009-11-16 18:06:18 -0500 | [diff] [blame] | 6 | else |
Masami Hiramatsu | 80509e2 | 2009-11-20 12:13:08 -0500 | [diff] [blame] | 7 | posttest_verbose = |
| 8 | endif |
| 9 | |
| 10 | ifeq ($(CONFIG_64BIT),y) |
| 11 | posttest_64bit = -y |
| 12 | else |
| 13 | posttest_64bit = -n |
Masami Hiramatsu | d65ff75 | 2009-11-16 18:06:18 -0500 | [diff] [blame] | 14 | endif |
| 15 | |
Masami Hiramatsu | 98fe07f | 2017-11-25 00:10:54 +0900 | [diff] [blame] | 16 | reformatter = $(srctree)/arch/x86/tools/objdump_reformat.awk |
Masami Hiramatsu | 6f5f672 | 2009-11-20 12:13:14 -0500 | [diff] [blame] | 17 | chkobjdump = $(srctree)/arch/x86/tools/chkobjdump.awk |
| 18 | |
Masami Hiramatsu | ca0e9ba | 2009-08-13 16:34:21 -0400 | [diff] [blame] | 19 | quiet_cmd_posttest = TEST $@ |
Nathan Chancellor | 5225952 | 2023-11-29 15:17:43 -0700 | [diff] [blame] | 20 | cmd_posttest = $(OBJDUMP) -d -j .text $(objtree)/vmlinux | $(AWK) -f $(reformatter) | $(obj)/insn_decoder_test $(posttest_64bit) $(posttest_verbose) |
Masami Hiramatsu | ca0e9ba | 2009-08-13 16:34:21 -0400 | [diff] [blame] | 21 | |
Masami Hiramatsu | 1ec454b | 2011-10-20 23:01:09 +0900 | [diff] [blame] | 22 | quiet_cmd_sanitytest = TEST $@ |
| 23 | cmd_sanitytest = $(obj)/insn_sanity $(posttest_64bit) -m 1000000 |
| 24 | |
Masami Hiramatsu | 6b63dd1 | 2017-11-25 00:10:25 +0900 | [diff] [blame] | 25 | posttest: $(obj)/insn_decoder_test vmlinux $(obj)/insn_sanity |
Masami Hiramatsu | ca0e9ba | 2009-08-13 16:34:21 -0400 | [diff] [blame] | 26 | $(call cmd,posttest) |
Masami Hiramatsu | 1ec454b | 2011-10-20 23:01:09 +0900 | [diff] [blame] | 27 | $(call cmd,sanitytest) |
Masami Hiramatsu | ca0e9ba | 2009-08-13 16:34:21 -0400 | [diff] [blame] | 28 | |
Masahiro Yamada | 5f2fb52 | 2020-02-02 01:49:24 +0900 | [diff] [blame] | 29 | hostprogs += insn_decoder_test insn_sanity |
Masami Hiramatsu | ca0e9ba | 2009-08-13 16:34:21 -0400 | [diff] [blame] | 30 | |
| 31 | # -I needed for generated C source and C source which in the kernel tree. |
Vasily Gorbik | c8d7b7e | 2020-11-13 00:03:20 +0100 | [diff] [blame] | 32 | HOSTCFLAGS_insn_decoder_test.o := -Wall -I$(srctree)/tools/arch/x86/lib/ -I$(srctree)/tools/arch/x86/include/ -I$(objtree)/arch/x86/lib/ |
Masami Hiramatsu | ca0e9ba | 2009-08-13 16:34:21 -0400 | [diff] [blame] | 33 | |
Vasily Gorbik | c8d7b7e | 2020-11-13 00:03:20 +0100 | [diff] [blame] | 34 | HOSTCFLAGS_insn_sanity.o := -Wall -I$(srctree)/tools/arch/x86/lib/ -I$(srctree)/tools/arch/x86/include/ -I$(objtree)/arch/x86/lib/ |
Masami Hiramatsu | 1ec454b | 2011-10-20 23:01:09 +0900 | [diff] [blame] | 35 | |
Ingo Molnar | 9bf4e7f | 2009-10-21 14:39:51 +0200 | [diff] [blame] | 36 | # Dependencies are also needed. |
Vasily Gorbik | c8d7b7e | 2020-11-13 00:03:20 +0100 | [diff] [blame] | 37 | $(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 Hiramatsu | ca0e9ba | 2009-08-13 16:34:21 -0400 | [diff] [blame] | 38 | |
Vasily Gorbik | c8d7b7e | 2020-11-13 00:03:20 +0100 | [diff] [blame] | 39 | $(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 Anvin | 6520fe5 | 2012-05-08 21:22:24 +0300 | [diff] [blame] | 40 | |
| 41 | HOST_EXTRACFLAGS += -I$(srctree)/tools/include |
Masahiro Yamada | 5f2fb52 | 2020-02-02 01:49:24 +0900 | [diff] [blame] | 42 | hostprogs += relocs |
H. Peter Anvin | c889ba8 | 2013-04-16 16:02:58 -0700 | [diff] [blame] | 43 | relocs-objs := relocs_32.o relocs_64.o relocs_common.o |
Masahiro Yamada | e6bcd1a | 2014-04-10 10:35:42 +0900 | [diff] [blame] | 44 | PHONY += relocs |
H. Peter Anvin | c889ba8 | 2013-04-16 16:02:58 -0700 | [diff] [blame] | 45 | relocs: $(obj)/relocs |
Masahiro Yamada | e6bcd1a | 2014-04-10 10:35:42 +0900 | [diff] [blame] | 46 | @: |