VirtualBox

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

Last change on this file since 8707 was 8155, checked in by vboxsync, 17 years ago

The Big Sun Rebranding Header Change

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