Makefile.kmk revision ba5dd00fabaa3475fa5da200d134c73f1c961b49
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync# Sub-Makefile for the VBox Disassembler.
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync# Copyright (C) 2006-2007 Sun Microsystems, Inc.
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync# This file is part of VirtualBox Open Source Edition (OSE), as
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync# available from http://www.virtualbox.org. This file is free software;
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync# you can redistribute it and/or modify it under the terms of the GNU
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync# General Public License (GPL) as published by the Free Software
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync# Foundation, in version 2 as it comes in the "COPYING" file of the
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync# Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync# Clara, CA 95054 USA or visit http://www.sun.com if you need
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync# additional information or have any questions.
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsyncSUB_DEPTH = ../../../..
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsyncinclude $(KBUILD_PATH)/subheader.kmk
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsyncifdef VBOX_WITH_TESTCASES
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsyncPROGRAMS += tstDisasm-2
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsynctstDisasm-2_TEMPLATE = VBOXR3TSTEXE
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsynctstDisasm-2_DEFS = IN_DIS
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsynctstDisasm-2_SOURCES = \
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsynctstDisasm-2_LIBS = \
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync $(PATH_LIB)/DisasmR3$(VBOX_SUFF_LIB) \
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync $(LIB_RUNTIME)
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync# Tests that will be build, disassembled and re-build from disassembly.
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsyncVBOX_DISAS_TESTS_BUILD = \
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync# Tests that only contains invalid/undefined instructions.
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsyncVBOX_DISAS_TESTS_INVALID = \
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync# Tests that will be disassembled and re-build from disassembly (list of binaries).
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync## @todo tstBinMovzx-1.bin: does C7 imply 32-bit reg in 16-bit mode, or what exactly does it do?
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsyncVBOX_DISAS_TESTS_BINARIES := \
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsyncifeq ($(USER)x,bird)
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsyncVBOX_DISAS_TESTS_BINARIES += \
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync# $(PATH_BIN)/testcase/tstDisasm-2$(SUFF_EXEC)
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync# The gory bits...
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync# Where we put the output files from the testcases.
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsyncVBOX_DISAS_TEST_OUT_DIR := $(PATH_TARGET)/Disassembler/testcase
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsyncBLDDIRS += $(VBOX_DISAS_TEST_OUT_DIR)
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync# Generate the rules for creating the .bin files.
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsyncVBOX_DISAS_TESTS_BIN = $(VBOX_DISAS_TESTS_BUILD) $(VBOX_DISAS_TESTS_INVALID)
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsyncVBOX_DISAS_TEST_CLEAN += $(addprefix $(VBOX_DISAS_TEST_OUT_DIR)/,\
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync $(VBOX_DISAS_TESTS_BIN:.asm=-16.bin)\
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync $(VBOX_DISAS_TESTS_BIN:.asm=-32.bin)\
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync $(VBOX_DISAS_TESTS_BIN:.asm=-64.bin))
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync$(addprefix $(VBOX_DISAS_TEST_OUT_DIR)/, $(VBOX_DISAS_TESTS_BIN:.asm=-16.bin)): $(PATH_SUB_CURRENT)/$$(patsubst %-16.bin,%.asm,$$(notdir $$(@))) | $$(call DIRDEP,$$(@D))
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync @$(ECHO) "Assembling: $(<F) into $(@F)"
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync $(TOOL_YASM_AS) -f bin -a x86 --force-strict -DTEST_BITS=16 -o $@ $<
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync$(addprefix $(VBOX_DISAS_TEST_OUT_DIR)/, $(VBOX_DISAS_TESTS_BIN:.asm=-32.bin)): $(PATH_SUB_CURRENT)/$$(patsubst %-32.bin,%.asm,$$(notdir $$(@))) | $$(call DIRDEP,$$(@D))
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync @$(ECHO) "Assembling: $(<F) into $(@F)"
7528d4a15800321b4013826ce35ad184898dba21vboxsync $(TOOL_YASM_AS) -f bin -a x86 --force-strict -DTEST_BITS=32 -o $@ $<
7528d4a15800321b4013826ce35ad184898dba21vboxsync$(addprefix $(VBOX_DISAS_TEST_OUT_DIR)/, $(VBOX_DISAS_TESTS_BIN:.asm=-64.bin)): $(PATH_SUB_CURRENT)/$$(patsubst %-64.bin,%.asm,$$(notdir $$(@))) | $$(call DIRDEP,$$(@D))
7528d4a15800321b4013826ce35ad184898dba21vboxsync @$(ECHO) "Assembling: $(<F) into $(@F)"
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync $(TOOL_YASM_AS) -f bin -a x86 --force-strict -DTEST_BITS=64 -o $@ $<
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync# Generate the rules for the 'build' tests.
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsyncVBOX_DISAS_TEST_CLEAN += $(addprefix $(VBOX_DISAS_TEST_OUT_DIR)/,\
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync $(VBOX_DISAS_TESTS_BUILD:.asm=-16-disas.asm)\
917f4ee9f101c9786cf09ea0fe7923a7f6dfe40cvboxsync $(VBOX_DISAS_TESTS_BUILD:.asm=-32-disas.asm)\
$(VBOX_DISAS_TESTS_BUILD:.asm=-64-disas.asm))
$(addprefix $(VBOX_DISAS_TEST_OUT_DIR)/, $(VBOX_DISAS_TESTS_BUILD:.asm=-16-disas.asm)): $$(subst -disas.asm,.bin,$$@) $$(INSTARGET_tstDisasm-2) | $$(call DIRDEP,$$(@D))
$(addprefix $(VBOX_DISAS_TEST_OUT_DIR)/, $(VBOX_DISAS_TESTS_BUILD:.asm=-32-disas.asm)): $$(subst -disas.asm,.bin,$$@) $$(INSTARGET_tstDisasm-2) | $$(call DIRDEP,$$(@D))
$(addprefix $(VBOX_DISAS_TEST_OUT_DIR)/, $(VBOX_DISAS_TESTS_BUILD:.asm=-64-disas.asm)): $$(subst -disas.asm,.bin,$$@) $$(INSTARGET_tstDisasm-2) | $$(call DIRDEP,$$(@D))
$(VBOX_DISAS_TESTS_BUILD:.asm=-16-disas.bin)\
$(VBOX_DISAS_TESTS_BUILD:.asm=-32-disas.bin)\
$(VBOX_DISAS_TESTS_BUILD:.asm=-64-disas.bin))
$(addprefix $(VBOX_DISAS_TEST_OUT_DIR)/, $(VBOX_DISAS_TESTS_BUILD:.asm=-16-disas.bin)): $$(subst .bin,.asm,$$@) | $$(call DIRDEP,$$(@D))
$(addprefix $(VBOX_DISAS_TEST_OUT_DIR)/, $(VBOX_DISAS_TESTS_BUILD:.asm=-32-disas.bin)): $$(subst .bin,.asm,$$@) | $$(call DIRDEP,$$(@D))
$(addprefix $(VBOX_DISAS_TEST_OUT_DIR)/, $(VBOX_DISAS_TESTS_BUILD:.asm=-64-disas.bin)): $$(subst .bin,.asm,$$@) | $$(call DIRDEP,$$(@D))
VBOX_DISAS_TESTS += $(foreach test, $(VBOX_DISAS_TESTS_BUILD:.asm=), $(test)-16.tst $(test)-32.tst $(test)-64.tst)
$(VBOX_DISAS_TESTS_BUILD:.asm=-16.tst)\
$(VBOX_DISAS_TESTS_BUILD:.asm=-32.tst)\
VBOX_DISAS_TESTS += $(foreach test, $(VBOX_DISAS_TESTS_INVALID:.asm=), $(test)-16.tst $(test)-32.tst $(test)-64.tst)
$(addprefix $(VBOX_DISAS_TEST_OUT_DIR)/, $(VBOX_DISAS_TESTS_INVALID:.asm=-16.tst)): $$(patsubst %.tst,%.bin,$$@) $$(INSTARGET_tstDisasm-2) | $$(call DIRDEP,$$(@D))
$(addprefix $(VBOX_DISAS_TEST_OUT_DIR)/, $(VBOX_DISAS_TESTS_INVALID:.asm=-32.tst)): $$(patsubst %.tst,%.bin,$$@) $$(INSTARGET_tstDisasm-2) | $$(call DIRDEP,$$(@D))
$(addprefix $(VBOX_DISAS_TEST_OUT_DIR)/, $(VBOX_DISAS_TESTS_INVALID:.asm=-64.tst)): $$(patsubst %.tst,%.bin,$$@) $$(INSTARGET_tstDisasm-2) | $$(call DIRDEP,$$(@D))
$$(REDIRECT) -E VBOX_LOG_DEST=nofile -o $$@ -- $$(INSTARGET_tstDisasm-2) --style=yasm --cpumode=$(bits) --undef-op=db $$<
## @todo 64-bit is problematic because of bugs like POP RDI ending up as POP EDI (incorrect default opmode).
#$(foreach bits, 32 16 64, $(foreach binary, $(VBOX_DISAS_TESTS_BINARIES), $(evalvalctx def_vbox_disas_binary)))
$(foreach bits, 32 16, $(foreach binary, $(VBOX_DISAS_TESTS_BINARIES), $(evalvalctx def_vbox_disas_binary)))
include $(KBUILD_PATH)/subfooter.kmk