VirtualBox

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

Last change on this file since 3020 was 2981, checked in by vboxsync, 17 years ago

InnoTek -> innotek: all the headers and comments.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 10.4 KB
Line 
1# $Id: Makefile.kmk 2981 2007-06-01 16:01:28Z 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 as published by the Free Software Foundation,
13# in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
14# distribution. VirtualBox OSE is distributed in the hope that it will
15# be useful, but WITHOUT ANY WARRANTY of any kind.
16#
17# If you received this file as part of a commercial VirtualBox
18# distribution, then only the terms of your commercial VirtualBox
19# license agreement apply instead of the previous paragraph.
20#
21
22DEPTH ?= ../../../..
23SUB_DEPTH = ..
24include $(PATH_KBUILD)/subheader.kmk
25
26#
27# Target lists.
28#
29PROGRAMS += tstVMStructSize tstVMStructGC tstAsmStructs tstAsmStructsGC tstVMM tstVMM-HwAccm
30ifdef VBOX_WITH_TESTCASES
31 PROGRAMS += tstCFGM tstSSM tstMMHyperHeap tstVMM-2 tstVMREQ tstMicro tstCompiler tstVMMR0CallHost-1
32 ifneq ($(BUILD_TARGET),l4)
33 PROGRAMS += tstAnimate
34 endif
35 SYSMODS += tstMicroGC
36endif # VBOX_WITH_TESTCASES
37
38#
39# We setup two 'other' targets for executing the two structure & alignment
40# validation testcases. Perhaps a bit hackish, but extremely useful.
41#
42ifeq ($(BUILD_TARGET),$(BUILD_PLATFORM))
43 ifeq ($(filter-out x86.x86 amd64.amd64 x86.amd64, $(BUILD_TARGET_ARCH).$(BUILD_PLATFORM_ARCH)),)
44 OTHERS += \
45 $(PATH_TARGET)/tstAsmStructs.run \
46 $(PATH_TARGET)/tstVMStructSize.run
47 endif
48endif
49OTHER_CLEAN += \
50 $(PATH_TARGET)/tstAsmStructs.run \
51 $(PATH_TARGET)/tstVMStructSize.run \
52 $(PATH_TARGET)/tstAsmStructs.h \
53 $(PATH_TARGET)/tstAsmStructsAsm.o \
54 $(PATH_TARGET)/tstAsmStructsAsm.mac \
55 $(PATH_TARGET)/tstAsmStructsAsm.mac.o \
56 $(PATH_TARGET)/tstAsmStructsAsm.mac.lst \
57 $(PATH_TARGET)/tstAsmStructs.h.dump \
58 $(PATH_TARGET)/tstAsmStructsGC.h \
59 $(PATH_TARGET)/tstAsmStructsHC.h \
60 $(PATH_TARGET)/tstVMStructGC.h
61
62#
63# Globals
64#
65VBOX_PATH_VMM_SRC = $(PATH_SUB_ROOT)
66
67#
68# Targets
69#
70tstVMStructGC_TEMPLATE = VBOXGCEXE
71tstVMStructGC_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
72tstVMStructGC_SOURCES = tstVMStructGC.cpp
73tstVMStructGC_INCS = $(VBOX_PATH_VMM_SRC) $(VBOX_PATH_VMM_SRC)/PATM
74
75tstVMStructSize_TEMPLATE= VBOXR3TSTEXE
76tstVMStructSize_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
77tstVMStructSize_INCS = $(VBOX_PATH_VMM_SRC) $(VBOX_PATH_VMM_SRC)/PATM $(PATH_TARGET)
78tstVMStructSize_SOURCES = tstVMStructSize.cpp
79tstVMStructSize_LIBS.l4 = $(LIB_RUNTIME)
80tstVMStructSize.cpp_DEPS= $(PATH_TARGET)/tstVMStructGC.h
81
82tstAsmStructs_TEMPLATE = VBOXR3TSTEXE
83tstAsmStructs_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
84tstAsmStructs_INCS = $(VBOX_PATH_VMM_SRC) $(PATH_TARGET)
85tstAsmStructs_SOURCES = tstAsmStructs.cpp
86tstAsmStructs_LIBS.l4 = $(LIB_RUNTIME)
87
88tstAsmStructsGC_TEMPLATE= VBOXGCEXE
89tstAsmStructsGC_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
90tstAsmStructsGC_INCS = $(VBOX_PATH_VMM_SRC) $(PATH_TARGET)
91tstAsmStructsGC_SOURCES = tstAsmStructs.cpp
92
93tstAsmStructs.cpp_DEPS = $(PATH_TARGET)/tstAsmStructsHC.h $(PATH_TARGET)/tstAsmStructsGC.h
94
95
96tstMMHyperHeap_TEMPLATE = VBOXR3TSTEXE
97tstMMHyperHeap_SOURCES = tstMMHyperHeap.cpp
98tstMMHyperHeap_LIBS = $(LIB_VMM) $(LIB_REM) $(LIB_RUNTIME)
99
100tstSSM_TEMPLATE = VBOXR3TSTEXE
101tstSSM_SOURCES = tstSSM.cpp
102tstSSM_LIBS = $(LIB_VMM) $(LIB_REM) $(LIB_RUNTIME)
103
104tstCFGM_TEMPLATE = VBOXR3TSTEXE
105tstCFGM_SOURCES = tstCFGM.cpp
106tstCFGM_LIBS = $(LIB_VMM) $(LIB_REM) $(LIB_RUNTIME)
107
108tstVMM_TEMPLATE = VBOXR3EXE
109tstVMM_SOURCES = tstVMM.cpp
110tstVMM_LIBS = $(LIB_VMM) $(LIB_REM) $(LIB_RUNTIME)
111
112tstVMM-HwAccm_TEMPLATE = VBOXR3EXE
113tstVMM-HwAccm_SOURCES = tstVMM-HwAccm.cpp
114tstVMM-HwAccm_LIBS = $(LIB_VMM) $(LIB_REM) $(LIB_RUNTIME)
115
116tstVMM-2_TEMPLATE = VBOXR3EXE
117tstVMM-2_SOURCES = tstVMM-2.cpp
118tstVMM-2_LIBS = $(LIB_VMM) $(LIB_REM) $(LIB_RUNTIME)
119
120tstVMMR0CallHost-1_TEMPLATE = VBOXR3EXE
121tstVMMR0CallHost-1_INCS = $(VBOX_PATH_VMM_SRC)
122tstVMMR0CallHost-1_SOURCES = \
123 tstVMMR0CallHost-1.cpp \
124 $(VBOX_PATH_VMM_SRC)/VMMR0/VMMR0A.asm
125tstVMMR0CallHost-1_LIBS = $(LIB_VMM) $(LIB_REM) $(LIB_RUNTIME)
126
127tstVMREQ_TEMPLATE = VBOXR3EXE
128tstVMREQ_SOURCES = tstVMREQ.cpp
129tstVMREQ_LIBS = $(LIB_VMM) $(LIB_REM) $(LIB_RUNTIME)
130
131tstAnimate_TEMPLATE = VBOXR3EXE
132tstAnimate_SOURCES = tstAnimate.cpp
133tstAnimate_LIBS = $(LIB_VMM) $(LIB_REM) $(LIB_RUNTIME)
134
135tstCompiler_TEMPLATE = VBOXR3TSTEXE
136tstCompiler_SOURCES = tstCompiler.cpp
137tstCompiler_LIBS = $(LIB_VMM) $(LIB_REM) $(LIB_RUNTIME)
138
139tstMicro_TEMPLATE = VBOXR3EXE
140tstMicro_SOURCES = tstMicro.cpp
141tstMicro_LIBS = $(LIB_VMM) $(LIB_REM) $(LIB_RUNTIME)
142
143# tstMicroGC.gc
144tstMicroGC_TEMPLATE = VBOXGC
145tstMicroGC_SOURCES = tstMicroGC.cpp tstMicroGCA.asm
146tstMicroGC_DEFS =
147ifeq ($(VBOX_LDR_FMT32),pe)
148tstMicroGC_LDFLAGS = -Entry:tstMicroGC
149endif
150tstMicroGC_SYSSUFF = .gc
151tstMicroGC_LIBS = \
152 $(PATH_LIB)/DisasmGC$(VBOX_SUFF_LIB) \
153 $(PATH_LIB)/RuntimeGC$(VBOX_SUFF_LIB)
154ifeq ($(filter-out pe lx,$(VBOX_LDR_FMT32)),)
155tstMicroGC_LIBS += \
156 $(PATH_LIB)/VMMGCBuiltin$(VBOX_SUFF_LIB) \
157 $(LIB_VMMGC)
158endif
159tstMicroGC_SOURCES.win = tstMicroGC.def
160
161
162
163
164include $(PATH_KBUILD)/subfooter.kmk
165
166
167ifndef USE_MULTI_TARGET
168# temporary hack.
169.NOTPARALLEL: $(TARGET_tstMicroGC) $(LIB_VMMGC)
170endif
171
172
173#
174# Some handcrafted support targets for tstAsmStructs.
175#
176
177ifeq ($(BUILD_PLATFORM),win)
178 include $(PATH_KBUILD)/tools/MINGW32.kmk
179 VBOX_NM ?= $(PATH_TOOL_MINGW32)/bin/nm.exe -p
180else
181 VBOX_NM ?= nm -p
182endif
183
184# 1a. make a header file which makes all the structures+members globals.
185$(PATH_TARGET)/tstAsmStructsAsm.mac: \
186 $(VBOX_PATH_VMM_SRC)/testcase/tstAsmStructsAsm.asm \
187 $(VBOX_PATH_VMM_SRC)/testcase/tstAsmStructsAsm-lst.sed \
188 $(DEPTH)/include/iprt/asmdefs.mac \
189 $(DEPTH)/include/VBox/cpum.mac \
190 $(DEPTH)/include/VBox/vm.mac \
191 $(VBOX_PATH_VMM_SRC)/CPUMInternal.mac \
192 $(VBOX_PATH_VMM_SRC)/TRPMInternal.mac \
193 $(VBOX_PATH_VMM_SRC)/VMMInternal.mac \
194 $(VBOX_PATH_VMM_SRC)/testcase/Makefile.kmk \
195 | $(call DIRDEP,$(PATH_TARGET))
196 $(call MSG_GENERATE,tstVMStructSize,$@,$<)
197ifndef DONT_USE_YASM
198 $(QUIET)$(TOOL_YASM_AS) \
199 $(addprefix -D, \
200 $(DEFS) \
201 $(DEFS.$(BUILD_TYPE)) \
202 $(DEFS.$(BUILD_TARGET)) \
203 IN_RING3 \
204 $(DEFS.$(BUILD_TARGET_ARCH)) \
205 $(DEFS.$(BUILD_TARGET).$(BUILD_TARGET_ARCH)) \
206 ) \
207 -f $(if $(eq $(BUILD_TARGET),darwin),macho,elf) \
208 $(foreach inc,$(INCS),-I$(inc)/) -o $@.o -l $@.lst $<
209 $(SED) -f $(VBOX_PATH_VMM_SRC)/testcase/tstAsmStructsAsm-lst.sed $@.lst > $@
210else
211 $(QUIET)$(TOOL_NASM_AS) \
212 -g \
213 $(addprefix -D, \
214 $(DEFS) \
215 $(DEFS.$(BUILD_TYPE)) \
216 $(DEFS.$(BUILD_TARGET)) \
217 IN_RING3 \
218 $(DEFS.$(BUILD_TARGET_ARCH)) \
219 $(DEFS.$(BUILD_TARGET).$(BUILD_TARGET_ARCH)) \
220 ) \
221 -f $(if $(eq $(BUILD_TARGET),darwin),macho,elf) \
222 $(foreach inc,$(INCS),-I$(inc)/) -o $@.o -l $@.lst $<
223 $(VBOX_NM) $@.o | $(SED) \
224 -e '/[0-9a-fA-F][0-9a-fA-F]* [^a] /d' \
225 -e 's/[0-9a-fA-F][0-9a-fA-F]* a \([^ ]*\)/global \1/' \
226 > $@
227endif
228
229# 1b. make an elf/macho object containing the offsets.
230$(PATH_TARGET)/tstAsmStructsAsm.o: \
231 $(VBOX_PATH_VMM_SRC)/testcase/tstAsmStructsAsm.asm \
232 $(PATH_TARGET)/tstAsmStructsAsm.mac \
233 $(VBOX_PATH_VMM_SRC)/testcase/Makefile.kmk \
234 | $(call DIRDEP,$(PATH_TARGET))
235 $(call MSG_COMPILE,tstAsmStructsasm,$<,$@,AS)
236ifndef DONT_USE_YASM
237 $(QUIET)$(TOOL_YASM_AS) \
238 $(addprefix -D, \
239 DO_GLOBALS \
240 $(DEFS) \
241 $(DEFS.$(BUILD_TYPE)) \
242 $(DEFS.$(BUILD_TARGET)) \
243 IN_RING3 \
244 $(DEFS.$(BUILD_TARGET_ARCH)) \
245 $(DEFS.$(BUILD_TARGET).$(BUILD_TARGET_ARCH)) \
246 ) \
247 -f $(if $(eq $(BUILD_TARGET),darwin),macho,elf -g stabs) \
248 $(foreach inc,$(INCS) $(PATH_TARGET),-I$(inc)/) -o $@ $<
249else
250 $(QUIET)$(TOOL_NASM_AS) \
251 $(addprefix -D, \
252 DO_GLOBALS \
253 $(DEFS) \
254 $(DEFS.$(BUILD_TYPE)) \
255 $(DEFS.$(BUILD_TARGET)) \
256 IN_RING3 \
257 $(DEFS.$(BUILD_TARGET_ARCH)) \
258 $(DEFS.$(BUILD_TARGET).$(BUILD_TARGET_ARCH)) \
259 ) \
260 -f $(if $(eq $(BUILD_TARGET),darwin),macho,elf) \
261 $(foreach inc,$(INCS) $(PATH_TARGET),-I$(inc)/) -o $@ $<
262endif
263
264# 2. use nm and sed to transform this into the header we want.
265$(PATH_TARGET)/tstAsmStructsHC.h: $(PATH_TARGET)/tstAsmStructsAsm.o
266 $(call MSG_GENERATE,tstVMStructSize,$@,$<)
267 $(QUIET)$(RM) -f $@ $@.dump $@.tmp
268 $(VBOX_NM) $< > $@.dump
269 $(QUIET)$(SED) -e '/STAMPROFILEADV/d' \
270 -e '/00[0-9a-fA-F]* [aA] [^_.]*\./!d' -e 's/\(00[0-9a-fA-F]*\) [aA] \([^.]*\)\.\(.*$$\)/ CHECK_OFF(\2, 0x0\1, \3);/' \
271 $@.dump > $@.tmp
272 $(QUIET)$(SED) -e '/VM_size$$/d' \
273 -e '/00[0-9a-fA-F]* [aA] [^_.]*_size$$/!d' -e 's/\(00[0-9a-fA-F]*\) [aA] \([^_.]*\)_size/ CHECK_SIZE(\2, 0x0\1);/' \
274 $@.dump >> $@.tmp
275 $(QUIET)$(MV) -f $@.tmp $@
276 $(QUIET)$(RM) -f $@.dump
277
278# 3. transform the HC header into a GC one by omitting some HC only structures.
279$(PATH_TARGET)/tstAsmStructsGC.h: $(PATH_TARGET)/tstAsmStructsHC.h
280 $(call MSG_GENERATE,tstVMStructSize,$@,$<)
281 $(QUIET)$(SED) -e '/VMMSWITCHERDEF/d' \
282 $^ > $@
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)$(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