VirtualBox

source: vbox/trunk/src/VBox/VMM/testcase/Makefile.kmk@ 7554

Last change on this file since 7554 was 5999, checked in by vboxsync, 17 years ago

The Giant CDDL Dual-License Header Change.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 10.6 KB
Line 
1# $Id: Makefile.kmk 5999 2007-12-07 15:05:06Z vboxsync $
2## @file
3# Sub-Makefile for the VMM testcases.
4#
5
6#
7# Copyright (C) 2006-2007 innotek GmbH
8#
9# This file is part of VirtualBox Open Source Edition (OSE), as
10# available from http://www.virtualbox.org. This file is free software;
11# you can redistribute it and/or modify it under the terms of the GNU
12# General Public License (GPL) as published by the Free Software
13# Foundation, in version 2 as it comes in the "COPYING" file of the
14# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
15# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
16#
17
18DEPTH ?= ../../../..
19SUB_DEPTH = ..
20include $(PATH_KBUILD)/subheader.kmk
21
22#
23# Target lists.
24#
25PROGRAMS += tstVMStructSize tstVMStructGC tstAsmStructs tstAsmStructsGC tstVMM tstVMM-HwAccm tstGlobalConfig
26ifneq ($(BUILD_TARGET),win)
27PROGRAMS += tstVMMFork
28endif
29ifdef VBOX_WITH_TESTCASES
30 PROGRAMS += tstCFGM tstSSM tstMMHyperHeap tstVMM-2 tstVMREQ tstMicro tstCompiler tstVMMR0CallHost-1
31 ifneq ($(BUILD_TARGET),l4)
32 PROGRAMS += tstAnimate
33 endif
34 SYSMODS += tstMicroGC
35endif # VBOX_WITH_TESTCASES
36
37ifdef VBOX_WITH_PDM_ASYNC_COMPLETION
38PROGRAMS += tstPDMAsyncCompletion
39endif
40
41#
42# We setup two 'other' targets for executing the two structure & alignment
43# validation testcases. Perhaps a bit hackish, but extremely useful.
44#
45ifeq ($(BUILD_TARGET),$(BUILD_PLATFORM))
46 ifeq ($(filter-out x86.x86 amd64.amd64 x86.amd64, $(BUILD_TARGET_ARCH).$(BUILD_PLATFORM_ARCH)),)
47 OTHERS += \
48 $(PATH_TARGET)/tstAsmStructs.run \
49 $(PATH_TARGET)/tstVMStructSize.run
50 endif
51endif
52OTHER_CLEAN += \
53 $(PATH_TARGET)/tstAsmStructs.run \
54 $(PATH_TARGET)/tstVMStructSize.run \
55 $(PATH_TARGET)/tstAsmStructs.h \
56 $(PATH_TARGET)/tstAsmStructsAsm.o \
57 $(PATH_TARGET)/tstAsmStructsAsm.mac \
58 $(PATH_TARGET)/tstAsmStructsAsm.mac.o \
59 $(PATH_TARGET)/tstAsmStructsAsm.mac.lst \
60 $(PATH_TARGET)/tstAsmStructs.h.dump \
61 $(PATH_TARGET)/tstAsmStructsGC.h \
62 $(PATH_TARGET)/tstAsmStructsHC.h \
63 $(PATH_TARGET)/tstVMStructGC.h
64
65#
66# Globals
67#
68VBOX_PATH_VMM_SRC = $(PATH_SUB_ROOT)
69
70#
71# Targets
72#
73tstVMStructGC_TEMPLATE = VBOXGCEXE
74tstVMStructGC_DEFS = IN_VMM_GC IN_PDM_GC IN_CFGM_GC IN_IOM_GC IN_VM_GC IN_CPUM_GC IN_SELM_GC IN_PGM_GC IN_TRPM_GC IN_MM_GC IN_PDM_GC IN_DBGF_GC IN_PATM_GC IN_DIS_GC IN_STAM_GC IN_VGADEVICE_GC IN_CSAM_GC IN_SSM_GC IN_REM_GC IN_RRM_GC
75ifdef VBOX_WITH_IDT_PATCHING
76tstVMStructGC_DEFS += VBOX_WITH_IDT_PATCHING
77endif
78tstVMStructGC_SOURCES = tstVMStructGC.cpp
79tstVMStructGC_INCS = $(VBOX_PATH_VMM_SRC) $(VBOX_PATH_VMM_SRC)/PATM
80
81tstVMStructSize_TEMPLATE= VBOXR3TSTEXE
82tstVMStructSize_DEFS = IN_VMM_R3 IN_PDM_R3 IN_CFGM_R3 IN_IOM_R3 IN_VM_R3 IN_CPUM_R3 IN_SELM_R3 IN_PGM_R3 IN_TRPM_R3 IN_MM_R3 IN_PDM_R3 IN_DBGF_R3 IN_PATM_R3 IN_DIS_R3 IN_STAM_R3 IN_VGADEVICE_R3 IN_CSAM_R3 IN_SSM_R3 IN_REM_R3
83ifdef VBOX_WITH_IDT_PATCHING
84tstVMStructSize_DEFS += VBOX_WITH_IDT_PATCHING
85endif
86tstVMStructSize_INCS = $(VBOX_PATH_VMM_SRC) $(VBOX_PATH_VMM_SRC)/PATM $(PATH_TARGET)
87tstVMStructSize_SOURCES = tstVMStructSize.cpp
88tstVMStructSize_LIBS.l4 = $(LIB_RUNTIME)
89tstVMStructSize.cpp_DEPS= $(PATH_TARGET)/tstVMStructGC.h
90
91tstAsmStructs_TEMPLATE = VBOXR3TSTEXE
92tstAsmStructs_DEFS = IN_VMM_R3 IN_PDM_R3 IN_CFGM_R3 IN_IOM_R3 IN_VM_R3 IN_CPUM_R3 IN_SELM_R3 IN_PGM_R3 IN_TRPM_R3 IN_MM_R3 IN_PDM_R3 IN_DBGF_R3 IN_PATM_R3 IN_DIS_R3 IN_STAM_R3 IN_VGADEVICE_R3 IN_CSAM_R3 IN_SSM_R3
93ifdef VBOX_WITH_IDT_PATCHING
94tstAsmStructs_DEFS += VBOX_WITH_IDT_PATCHING
95endif
96tstAsmStructs_INCS = $(VBOX_PATH_VMM_SRC) $(PATH_TARGET)
97tstAsmStructs_SOURCES = tstAsmStructs.cpp
98tstAsmStructs_LIBS.l4 = $(LIB_RUNTIME)
99
100tstAsmStructsGC_TEMPLATE= VBOXGCEXE
101tstAsmStructsGC_DEFS = IN_VMM_GC IN_PDM_GC IN_CFGM_GC IN_IOM_GC IN_VM_GC IN_CPUM_GC IN_SELM_GC IN_PGM_GC IN_TRPM_GC IN_MM_GC IN_PDM_GC IN_DBGF_GC IN_PATM_GC IN_DIS_GC IN_STAM_GC IN_VGADEVICE_GC IN_CSAM_GC IN_SSM_GC IN_RRM_GC
102ifdef VBOX_WITH_IDT_PATCHING
103tstAsmStructsGC_DEFS += VBOX_WITH_IDT_PATCHING
104endif
105tstAsmStructsGC_INCS = $(VBOX_PATH_VMM_SRC) $(PATH_TARGET)
106tstAsmStructsGC_SOURCES = tstAsmStructs.cpp
107
108tstAsmStructs.cpp_DEPS = $(PATH_TARGET)/tstAsmStructsHC.h $(PATH_TARGET)/tstAsmStructsGC.h
109
110
111tstGlobalConfig_TEMPLATE= VBOXR3TSTEXE
112tstGlobalConfig_SOURCES = tstGlobalConfig.cpp
113tstGlobalConfig_LIBS = $(LIB_RUNTIME)
114
115tstMMHyperHeap_TEMPLATE = VBOXR3TSTEXE
116tstMMHyperHeap_SOURCES = tstMMHyperHeap.cpp
117tstMMHyperHeap_LIBS = $(LIB_VMM) $(LIB_REM) $(LIB_RUNTIME)
118
119tstSSM_TEMPLATE = VBOXR3TSTEXE
120tstSSM_SOURCES = tstSSM.cpp
121tstSSM_LIBS = $(LIB_VMM) $(LIB_REM) $(LIB_RUNTIME)
122
123tstCFGM_TEMPLATE = VBOXR3TSTEXE
124tstCFGM_SOURCES = tstCFGM.cpp
125tstCFGM_LIBS = $(LIB_VMM) $(LIB_REM) $(LIB_RUNTIME)
126
127tstVMM_TEMPLATE = VBOXR3EXE
128tstVMM_SOURCES = tstVMM.cpp
129tstVMM_LIBS = $(LIB_VMM) $(LIB_REM) $(LIB_RUNTIME)
130
131tstVMM-HwAccm_TEMPLATE = VBOXR3EXE
132tstVMM-HwAccm_SOURCES = tstVMM-HwAccm.cpp
133tstVMM-HwAccm_LIBS = $(LIB_VMM) $(LIB_REM) $(LIB_RUNTIME)
134
135tstVMMFork_TEMPLATE = VBOXR3EXE
136tstVMMFork_SOURCES = tstVMMFork.cpp
137tstVMMFork_LIBS = $(LIB_VMM) $(LIB_REM) $(LIB_RUNTIME)
138
139tstVMM-2_TEMPLATE = VBOXR3EXE
140tstVMM-2_SOURCES = tstVMM-2.cpp
141tstVMM-2_LIBS = $(LIB_VMM) $(LIB_REM) $(LIB_RUNTIME)
142
143tstVMMR0CallHost-1_TEMPLATE = VBOXR3EXE
144tstVMMR0CallHost-1_INCS = $(VBOX_PATH_VMM_SRC)
145tstVMMR0CallHost-1_SOURCES = \
146 tstVMMR0CallHost-1.cpp \
147 $(VBOX_PATH_VMM_SRC)/VMMR0/VMMR0A.asm
148tstVMMR0CallHost-1_LIBS = $(LIB_VMM) $(LIB_REM) $(LIB_RUNTIME)
149
150tstVMREQ_TEMPLATE = VBOXR3EXE
151tstVMREQ_SOURCES = tstVMREQ.cpp
152tstVMREQ_LIBS = $(LIB_VMM) $(LIB_REM) $(LIB_RUNTIME)
153
154tstAnimate_TEMPLATE = VBOXR3EXE
155tstAnimate_SOURCES = tstAnimate.cpp
156tstAnimate_LIBS = $(LIB_VMM) $(LIB_REM) $(LIB_RUNTIME)
157
158tstCompiler_TEMPLATE = VBOXR3TSTEXE
159tstCompiler_SOURCES = tstCompiler.cpp
160tstCompiler_LIBS = $(LIB_VMM) $(LIB_REM) $(LIB_RUNTIME)
161
162tstMicro_TEMPLATE = VBOXR3EXE
163tstMicro_SOURCES = tstMicro.cpp
164tstMicro_LIBS = $(LIB_VMM) $(LIB_REM) $(LIB_RUNTIME)
165
166# tstMicroGC.gc
167tstMicroGC_TEMPLATE = VBOXGC
168tstMicroGC_SOURCES = tstMicroGC.cpp tstMicroGCA.asm
169tstMicroGC_DEFS =
170tstMicroGC_INCS = $(VBOX_PATH_VMM_SRC)/testcase
171ifeq ($(VBOX_LDR_FMT32),pe)
172tstMicroGC_LDFLAGS = -Entry:tstMicroGC
173endif
174tstMicroGC_SYSSUFF = .gc
175tstMicroGC_LIBS = \
176 $(PATH_LIB)/DisasmGC$(VBOX_SUFF_LIB) \
177 $(PATH_LIB)/RuntimeGC$(VBOX_SUFF_LIB)
178ifeq ($(filter-out pe lx,$(VBOX_LDR_FMT32)),)
179tstMicroGC_LIBS += \
180 $(PATH_LIB)/VMMGCBuiltin$(VBOX_SUFF_LIB) \
181 $(LIB_VMMGC)
182endif
183tstMicroGC_SOURCES.win = tstMicroGC.def
184
185ifdef VBOX_WITH_PDM_ASYNC_COMPLETION
186tstPDMAsyncCompletion_TEMPLATE = VBOXR3EXE
187tstPDMAsyncCompletion_SOURCES = tstPDMAsyncCompletion.cpp
188tstPDMAsyncCompletion_LIBS = $(LIB_VMM) $(LIB_REM) $(LIB_RUNTIME)
189endif
190
191include $(PATH_KBUILD)/subfooter.kmk
192
193
194ifndef USE_MULTI_TARGET
195# temporary hack.
196.NOTPARALLEL: $(TARGET_tstMicroGC) $(LIB_VMMGC)
197endif
198
199
200#
201# Some handcrafted support targets for tstAsmStructs.
202#
203
204ifeq ($(BUILD_PLATFORM),win)
205 include $(PATH_KBUILD)/tools/MINGW32.kmk
206 VBOX_NM ?= $(PATH_TOOL_MINGW32)/bin/nm.exe -p
207else
208 VBOX_NM ?= nm -p
209endif
210
211MY_ASA_ASM_STUFF = \
212 $(addprefix -D, \
213 $(DEFS) \
214 $(DEFS.$(BUILD_TYPE)) \
215 $(DEFS.$(BUILD_TARGET)) \
216 IN_RING3 \
217 $(DEFS.$(BUILD_TARGET_ARCH)) \
218 $(DEFS.$(BUILD_TARGET).$(BUILD_TARGET_ARCH)) \
219 ) \
220 -f $(if $(eq $(BUILD_TARGET),darwin),macho,elf) \
221 $(foreach inc,$(INCS) $(VBOX_PATH_VMM_SRC)/testcase $(PATH_TARGET),-I$(inc)/)
222
223# 1a. make a header file which makes all the structures+members globals.
224$(PATH_TARGET)/tstAsmStructsAsm.mac: \
225 $(VBOX_PATH_VMM_SRC)/testcase/tstAsmStructsAsm.asm \
226 $(VBOX_PATH_VMM_SRC)/testcase/tstAsmStructsAsm-lst.sed \
227 $(DEPTH)/include/iprt/asmdefs.mac \
228 $(DEPTH)/include/VBox/cpum.mac \
229 $(DEPTH)/include/VBox/sup.mac \
230 $(DEPTH)/include/VBox/vm.mac \
231 $(VBOX_PATH_VMM_SRC)/CPUMInternal.mac \
232 $(VBOX_PATH_VMM_SRC)/TRPMInternal.mac \
233 $(VBOX_PATH_VMM_SRC)/VMMInternal.mac \
234 $(VBOX_PATH_VMM_SRC)/testcase/Makefile.kmk \
235 | $(call DIRDEP,$(PATH_TARGET))
236 $(call MSG_GENERATE,tstVMStructSize,$@,$<)
237ifndef DONT_USE_YASM
238 $(QUIET)$(TOOL_YASM_AS) $(MY_ASA_ASM_STUFF) -o [email protected] -l [email protected] $<
239 $(SED) -f $(VBOX_PATH_VMM_SRC)/testcase/tstAsmStructsAsm-lst.sed --output $@ [email protected]
240else
241 $(QUIET)$(TOOL_NASM_AS) -g $(MY_ASA_ASM_STUFF) -o [email protected] -l [email protected] $<
242 $(VBOX_NM) [email protected] | $(SED) \
243 -e '/[0-9a-fA-F][0-9a-fA-F]* [^a] /d' \
244 -e 's/[0-9a-fA-F][0-9a-fA-F]* a \([^ ]*\)/global \1/' \
245 > $@
246endif
247
248# 1b. make an elf/macho object containing the offsets.
249$(PATH_TARGET)/tstAsmStructsAsm.o: \
250 $(VBOX_PATH_VMM_SRC)/testcase/tstAsmStructsAsm.asm \
251 $(PATH_TARGET)/tstAsmStructsAsm.mac \
252 $(VBOX_PATH_VMM_SRC)/testcase/Makefile.kmk \
253 | $(call DIRDEP,$(PATH_TARGET))
254 $(call MSG_COMPILE,tstAsmStructsasm,$<,$@,AS)
255ifndef DONT_USE_YASM
256 $(QUIET)$(TOOL_YASM_AS) $(MY_ASA_ASM_STUFF) -DDO_GLOBALS -o $@ $<
257else
258 $(QUIET)$(TOOL_NASM_AS) $(MY_ASA_ASM_STUFF) -DDO_GLOBALS -o $@ $<
259endif
260
261# 2. use nm and sed to transform this into the header we want.
262$(PATH_TARGET)/tstAsmStructsHC.h: $(PATH_TARGET)/tstAsmStructsAsm.o
263 $(call MSG_GENERATE,tstVMStructSize,$@,$<)
264 $(QUIET)$(RM) -f $@ [email protected] [email protected]
265 $(QUIET)$(REDIRECT) -wo [email protected] -- $(VBOX_NM) $<
266 $(QUIET)$(SED) -e '/STAMPROFILEADV/d' \
267 -e '/00[0-9a-fA-F]* [aA] [^_.]*\./!d' -e 's/\(00[0-9a-fA-F]*\) [aA] \([^.]*\)\.\(.*$$\)/ CHECK_OFF(\2, 0x0\1, \3);/' \
268 --output [email protected] [email protected]
269 $(QUIET)$(SED) -e '/VM_size$$/d' \
270 -e '/00[0-9a-fA-F]* [aA] [^_.]*_size$$/!d' -e 's/\(00[0-9a-fA-F]*\) [aA] \([^_.]*\)_size/ CHECK_SIZE(\2, 0x0\1);/' \
271 --append [email protected] [email protected]
272 $(QUIET)$(MV) -f [email protected] $@
273 $(QUIET)$(RM) -f [email protected]
274
275# 3. transform the HC header into a GC one by omitting some HC only structures.
276$(PATH_TARGET)/tstAsmStructsGC.h: $(PATH_TARGET)/tstAsmStructsHC.h
277 $(call MSG_GENERATE,tstVMStructSize,$@,$<)
278 $(QUIET)$(SED) -e '/VMMSWITCHERDEF/d' --output $@ $^
279
280## @todo make this default kBuild behaviour.
281.SECONDEXPANSION:
282
283# 4. run it.
284$(PATH_TARGET)/tstAsmStructs.run: $$(INSTARGET_tstAsmStructs) $$(INSTARGET_tstAsmStructsGC)
285 $(QUIET)$(RM) -f $@
286 $(INSTARGET_tstAsmStructs)
287 $(INSTARGET_tstAsmStructsGC)
288 $(QUIET)$(APPEND) "$@" "done"
289
290
291
292#
293# Run rule for tstVMStructSize.
294#
295
296# 1. Manually dump selected structures and members.
297$(PATH_TARGET)/tstVMStructGC.h: $$(INSTARGET_tstVMStructGC)
298 $(call MSG_GENERATE,tstVMStructSize,$@)
299 $(QUIET)$(REDIRECT) -wo $@ -- $(INSTARGET_tstVMStructGC)
300
301# 2. run it.
302$(PATH_TARGET)/tstVMStructSize.run: $$(INSTARGET_tstVMStructSize)
303 $(QUIET)$(RM) -f $@
304 $^
305 $(QUIET)$(APPEND) "$@" "done"
306
307# alias for the two struct tests.
308run-struct-tests: $(PATH_TARGET)/tstAsmStructs.run $(PATH_TARGET)/tstVMStructSize.run
309
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette