summaryrefslogtreecommitdiffstats
path: root/src/VBox/ValidationKit/Config.kmk
blob: a1e5acb0a6b42b4e55097147015196f02e6d9a29 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
# $Id: Config.kmk $
## @file
# kBuild Configuration file for the VirtualBox Validation Kit.
#

#
# Copyright (C) 2010-2019 Oracle Corporation
#
# This file is part of VirtualBox Open Source Edition (OSE), as
# available from http://www.virtualbox.org. This file is free software;
# you can redistribute it and/or modify it under the terms of the GNU
# General Public License (GPL) as published by the Free Software
# Foundation, in version 2 as it comes in the "COPYING" file of the
# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
#
# The contents of this file may alternatively be used under the terms
# of the Common Development and Distribution License Version 1.0
# (CDDL) only, as it comes in the "COPYING.CDDL" file of the
# VirtualBox OSE distribution, in which case the provisions of the
# CDDL are applicable instead of those of the GPL.
#
# You may elect to license modified versions of this file under the
# terms and conditions of either the GPL or the CDDL or both.
#

VBOX_VALIDATIONKIT_CONFIG_KMK_INCLUDED = 1

# Include the top-level configure file.
ifndef VBOX_ROOT_CONFIG_KMK_INCLUDED
 include $(PATH_ROOT)/Config.kmk
endif

#
# Globals
#
VBOX_PATH_VALIDATIONKIT_SRC := $(PATH_ROOT)/src/VBox/ValidationKit


#
# Base template that drops the -static flag since we only want to use the
# static version of our own libraries and not the system libs.
#
TEMPLATE_VBoxValidationKitR3Base = VBox Validation Kit ring-3 program base, both guest and host.
TEMPLATE_VBoxValidationKitR3Base_EXTENDS = VBoxR3Static
ifn1of ($(KBUILD_TARGET), darwin solaris win)
 TEMPLATE_VBoxValidationKitR3Base_CFLAGS          = $(filter-out -static, $(TEMPLATE_VBoxR3Static_CFLAGS))
 TEMPLATE_VBoxValidationKitR3Base_CXXFLAGS        = $(filter-out -static, $(TEMPLATE_VBoxR3Static_CXXFLAGS))
 TEMPLATE_VBoxValidationKitR3Base_OBJCFLAGS       = $(filter-out -static, $(TEMPLATE_VBoxR3Static_OBJCFLAGS))
 TEMPLATE_VBoxValidationKitR3Base_LDFLAGS         = $(filter-out -static, $(TEMPLATE_VBoxR3Static_LDFLAGS))
endif
TEMPLATE_VBoxValidationKitR3Base_LIBS = $(TEMPLATE_VBoxR3Static_LIBS)
if1of ($(KBUILD_TARGET), linux)
 TEMPLATE_VBoxValidationKitR3Base_LIBS += supc++ crypt
 TEMPLATE_VBoxValidationKitR3Base_LDTOOL = $(subst GXX,GCC,$(TEMPLATE_VBoxR3Static_TOOL))
endif
TEMPLATE_VBoxValidationKitR3Base_LDFLAGS.darwin = $(TEMPLATE_VBoxR3Static_LDFLAGS.darwin) -framework IOKit

#
# Template for building ring-3 progams for the Validation Kit.
# These programs can run on any host or guest.
#
TEMPLATE_VBoxValidationKitR3 = VBox Validation Kit ring-3 program, both guest and host.
TEMPLATE_VBoxValidationKitR3_EXTENDS = VBoxValidationKitR3Base
TEMPLATE_VBoxValidationKitR3_EXTENDS_BY = appending
TEMPLATE_VBoxValidationKitR3_INST = $(INST_VALIDATIONKIT)$(KBUILD_TARGET)/$(KBUILD_TARGET_ARCH)/
TEMPLATE_VBoxValidationKitR3_SDKS.win = ReorderCompilerIncs $(VBOX_WINPSDK) $(VBOX_WINDDK) VBOX_NTDLL
TEMPLATE_VBoxValidationKitR3_DEFS = IN_RT_R3
TEMPLATE_VBoxValidationKitR3_LIBS.darwin = iconv
TEMPLATE_VBoxValidationKitR3_LIBS.freebsd = iconv
TEMPLATE_VBoxValidationKitR3_LIBS = \
	$(PATH_STAGE_LIB)/RuntimeR3$(VBOX_SUFF_LIB)
ifeq ($(KBUILD_TARGET),solaris)
 TEMPLATE_VBoxValidationKitR3_LIBS += \
	kstat \
	nsl \
	contract
 if1of ($(KBUILD_TARGET_ARCH), amd64 x86)
  TEMPLATE_VBoxValidationKitR3_LIBS += \
  	smbios
 endif
endif
ifneq ($(KBUILD_TARGET),win)
 TEMPLATE_VBoxValidationKitR3_LIBS += \
 	$(SDK_VBOX_ZLIB_LIBS)
endif

# Make VCC100 output work on NT3.x, NT4, W2K, XP and W2K3.
TEMPLATE_VBoxValidationKitR3_LIBS.win.x86 = \
       $(PATH_TOOL_$(TEMPLATE_VBoxValidationKitR3_TOOL.win.x86)_LIB)/oldnames.lib \
       $(PATH_TOOL_$(TEMPLATE_VBoxValidationKitR3_TOOL.win.x86)_LIB)/libcmt$(VBOX_VCC_CRT_TYPE).lib \
       $(PATH_TOOL_$(TEMPLATE_VBoxValidationKitR3_TOOL.win.x86)_LIB)/libcpmt$(VBOX_VCC_CRT_TYPE).lib \
	$(PATH_STAGE_LIB)/RuntimeR3VccTricks$(VBOX_SUFF_LIB)
TEMPLATE_VBoxValidationKitR3_LDFLAGS.win.x86 = \
  	-Include:_vcc100_shell32_fakes_cpp \
	-Include:_vcc100_shell32_fakes_asm \
	-Section:.bss,RW!K
ifeq ($(KBUILD_TARGET).$(KBUILD_TARGET_ARCH),win.x86)
 TEMPLATE_VBoxValidationKitR3_POST_CMDS = $(if $(eq $(tool_do),LINK_LIBRARY),,$(VBOX_PE_SET_VERSION) $(out)$$(NLTAB))$(TEMPLATE_VBoxValidationKitR3Base_POST_CMDS)$$(NLTAB)
endif
TEMPLATE_VBoxValidationKitR3_LNK_DEPS.win.x86  = $(if $(eq $(tool_do),LINK_LIBRARY),,$(VBOX_PE_SET_VERSION))

#TODO: TEMPLATE_VBoxValidationKitR3_EXTENDS = VBOXGUESTR3EXE

TEMPLATE_VBoxValidationKitR3_USES += vboximportchecker
TEMPLATE_VBoxValidationKitR3_VBOX_IMPORT_CHECKER.win.x86   = nt31
TEMPLATE_VBoxValidationKitR3_VBOX_IMPORT_CHECKER.win.amd64 = xp64


#
# Template for building ring-3 programs for the Validation Kit.
# These programs can run on the host and may take advantage of the support
# driver when installed.
#
TEMPLATE_VBoxValidationKitR3Host = VBox Validation Kit ring-3 program, mainly host.
TEMPLATE_VBoxValidationKitR3Host_EXTENDS = VBoxValidationKitR3Base
TEMPLATE_VBoxValidationKitR3Host_EXTENDS_BY = appending
TEMPLATE_VBoxValidationKitR3Host_INST = $(INST_VALIDATIONKIT)$(KBUILD_TARGET)/$(KBUILD_TARGET_ARCH)/
TEMPLATE_VBoxValidationKitR3Host_SDKS.win = ReorderCompilerIncs $(VBOX_WINPSDK) $(VBOX_WINDDK) VBOX_NTDLL
TEMPLATE_VBoxValidationKitR3Host_DEFS = IN_RT_R3 IN_SUP_R3
TEMPLATE_VBoxValidationKitR3Host_LIBS.darwin = iconv
TEMPLATE_VBoxValidationKitR3Host_LIBS.freebsd = iconv
TEMPLATE_VBoxValidationKitR3Host_LIBS = \
	$(PATH_STAGE_LIB)/RuntimeR3$(VBOX_SUFF_LIB) \
	$(PATH_STAGE_LIB)/SUPR3Static$(VBOX_SUFF_LIB) \
	$(PATH_STAGE_LIB)/RuntimeR3$(VBOX_SUFF_LIB)
ifeq ($(KBUILD_TARGET),solaris)
 TEMPLATE_VBoxValidationKitR3Host_LIBS += \
	kstat \
	nsl \
	contract
 if1of ($(KBUILD_TARGET_ARCH), amd64 x86)
  TEMPLATE_VBoxValidationKitR3Host_LIBS += \
  	smbios
 endif
endif

#
# Template for building agnostic ring-0 host modules for the Validation Kit.
#
TEMPLATE_VBoxValidationKitR0 = VBox Validation Kit agnostic ring-0 host module.
TEMPLATE_VBoxValidationKitR0_EXTENDS = VBoxR0
TEMPLATE_VBoxValidationKitR0_EXTENDS_BY = appending
TEMPLATE_VBoxValidationKitR0_INST = $(INST_VALIDATIONKIT)$(KBUILD_TARGET)/$(KBUILD_TARGET_ARCH)/
TEMPLATE_VBoxValidationKitR0_DEFS = IN_RT_R0
TEMPLATE_VBoxValidationKitR0_LIBS = \
	$(PATH_STAGE_LIB)/RuntimeR0$(VBOX_SUFF_LIB)
if1of ($(KBUILD_TARGET),os2 win)
 TEMPLATE_VBoxValidationKitR0_LIBS += \
 	$(PATH_STAGE_LIB)/SUPR0$(VBOX_SUFF_LIB)
endif

#
# List of python sources that should be linted and unittested.
#
VBOX_VALIDATIONKIT_PYTHON_SOURCES     :=
VBOX_VALIDATIONKIT_PYLINT_TARGETS     :=
VBOX_VALIDATIONKIT_PYUNITTEST_EXCLUDE :=

ifdef VBOX_WITH_PYLINT
 TESTING +=
endif

#
# Process python sources.
#
if1of ($(KBUILD_TARGET), win os2)
 VBOX_PYTHONPATH_VALIDATIONKIT = $(PYTHONPATH);$(VBOX_PATH_VALIDATIONKIT_SRC);$(VBOX_PATH_VALIDATIONKIT_SRC)/testboxscript;$(VBOX_PATH_VALIDATIONKIT_SRC)/testmanager:$(VBOX_PATH_VALIDATIONKIT_SRC)/../VMM/VMMAll
else
 VBOX_PYTHONPATH_VALIDATIONKIT = $(PYTHONPATH):$(VBOX_PATH_VALIDATIONKIT_SRC):$(VBOX_PATH_VALIDATIONKIT_SRC)/testboxscript:$(VBOX_PATH_VALIDATIONKIT_SRC)/testmanager;$(VBOX_PATH_VALIDATIONKIT_SRC)/../VMM/VMMAll
endif
BLDDIRS += $(PATH_TARGET)/pylint $(PATH_TARGET)/pyunittest

define def_vbox_validationkit_py_check
$(eval name:=$(basename $(notdir $(py))))

pylint::   $(name)-py-phony.o
$(name).o: $(name)-py-phony.o
$(PATH_TARGET)/pylint/$(name).o $(name)-py-phony.o:: $(py) | $(PATH_TARGET)/pylint/
ifdef VBOX_WITH_PYLINT
	$(QUIET2)$(call MSG_L1,Subjecting $(py) to pylint...)
	$(QUIET)$(REDIRECT) -C "$(dir $(py))" -E LC_ALL=C -E PYTHONPATH="$(VBOX_PYTHONPATH_VALIDATIONKIT)" -- \
		$(VBOX_PYLINT) --rcfile=$(VBOX_PATH_VALIDATIONKIT_SRC)/pylintrc $$(VBOX_PYLINT_FLAGS) $$($(py)_VBOX_PYLINT_FLAGS) ./$(notdir $(py))
endif
	$(QUIET)$(APPEND) -t "$(PATH_TARGET)/pylint/$(name).o"

ifn1of ($(py),$(VBOX_VALIDATIONKIT_PYUNITTEST_EXCLUDE))
pyunittest:: $(name)-pyunittest.o
$(PATH_TARGET)/pyunittest/$(name).o $(name)-pyunittest.o:: $(py) | $(PATH_TARGET)/pyunittest/
	$(QUIET2)$(call MSG_L1,Unittesting Python source $(py)...)
	$(QUIET)$(REDIRECT) -E LC_ALL=C -E PYTHONPATH="$(VBOX_PYTHONPATH_VALIDATIONKIT)" -C $(dir $(py)) \
		-- $(VBOX_BLD_PYTHON) -m unittest -v $(notdir $(basename $(py)))
	$(QUIET)$(APPEND) -t "$(PATH_TARGET)/pyunittest/$(name).o"
VBOX_VALIDATIONKIT_PYUNITTEST_TARGETS += $(PATH_TARGET)/pyunittest/$(name).o

TESTING += $(name)-pyunittest.o
endif
TESTING += $(name)-py-phony.o
VBOX_VALIDATIONKIT_PYLINT_TARGETS     += $(PATH_TARGET)/pylint/$(name).o
endef # def_vbox_validationkit_py_check


define def_vbox_validationkit_process_python_sources
$(if-expr $(words $(_SUB_MAKEFILE_STACK)) <= 0 || "$1" == "FORCE", \
	$(foreach py, $(VBOX_VALIDATIONKIT_PYTHON_SOURCES), $(eval $(def_vbox_validationkit_py_check))),)
endef



#
# http://www.jshint.com
#
VBOX_JSHINT       ?= jshint
VBOX_JSHINT_FLAGS := --config $(VBOX_PATH_VALIDATIONKIT_SRC)/jshintrc.js --verbose
ifndef VBOX_WITH_JSHINT
 VBOX_WITH_JSHINT := $(which $(VBOX_JSHINT))
endif

#
# List of javascript sources that should be checked and linted.
#
VBOX_VALIDATIONKIT_JS_SOURCES :=

define def_vbox_validationkit_js_check
$(eval name:=$(basename $(notdir $(js))))
$(name).o $(name).obj:: # $(PATH_SUB_CURRENT)/$(js)
	-$(REDIRECT) -E LC_ALL=C  -C $(dir $(js)) -- $$(VBOX_JSHINT) ./$(notdir $(js)) $$(VBOX_JSHINT_FLAGS)
jslint:: $(name).o
endef

define def_vbox_validationkit_process_js_sources
$(if-expr $(words $(_SUB_MAKEFILE_STACK)) <= 0, \
	$(foreach js, $(VBOX_VALIDATIONKIT_JS_SOURCES), $(eval $(def_vbox_validationkit_js_check))),)
endef