summaryrefslogtreecommitdiffstats
path: root/src/VBox/HostDrivers/VBoxUSB/win/Makefile.kmk
blob: 32c22b53413870b217f135e0fab0689af659e630 (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
# $Id: Makefile.kmk $
## @file
# Sub-Makefile for the Windows USB drivers.
#

#
# Copyright (C) 2006-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.
#

SUB_DEPTH = ../../../../..
include $(KBUILD_PATH)/subheader.kmk

LIBRARIES.win += usbd
SYSMODS.win   += VBoxUSB VBoxUSBMon
PROGRAMS.win  += USBInstall USBUninstall USBTest
INSTALLS.win  += install-infs

#
# usbd
#
usbd_TEMPLATE       = VBOXR0DRV
usbd_SOURCES        = usbd/usbd.def

#
# VBoxUSB
#
VBoxUSB_TEMPLATE    = VBOXR0DRV
ifdef VBOX_SIGNING_MODE
 VBoxUSB_INSTTYPE   = none
 VBoxUSB_DEBUG_INSTTYPE = both
endif
VBoxUSB_SDKS        = ReorderCompilerIncs $(VBOX_WINDDK) $(VBOX_WINPSDK)INCS
VBoxUSB_DEFS        = IN_RT_R0 IN_SUP_R0 VBOX_DBG_LOG_NAME=\"USBDev\"
VBoxUSB_LDFLAGS.x86 = -Entry:DriverEntry@8
VBoxUSB_LDFLAGS.amd64 = -Entry:DriverEntry
VBoxUSB_SOURCES     = \
	dev/VBoxUsbDev.cpp \
	dev/VBoxUsbRt.cpp \
	dev/VBoxUsbPnP.cpp \
	dev/VBoxUsbPwr.cpp \
	cmn/VBoxUsbTool.cpp \
	cmn/VBoxDrvTool.cpp \
	dev/VBoxUsbDev.rc
VBoxUSB_LIBS        = \
	$(PATH_SDK_$(VBOX_WINDDK)_LIB)/ntoskrnl.lib \
	$(PATH_SDK_$(VBOX_WINDDK)_LIB)/hal.lib \
	$(PATH_STAGE_LIB)/RuntimeR0Drv$(VBOX_SUFF_LIB) \
	$(usbd_1_TARGET)

#
# VBoxUSBMon
#
VBoxUSBMon_TEMPLATE    = VBOXR0DRV
ifdef VBOX_SIGNING_MODE
 VBoxUSBMon_INSTTYPE = none
 VBoxUSBMon_DEBUG_INSTTYPE = both
endif
VBoxUSBMon_INCS       := $(PATH_SUB_CURRENT)/..
VBoxUSBMon_SDKS        = ReorderCompilerIncs $(VBOX_WINDDK) $(VBOX_WINPSDK)INCS
VBoxUSBMon_DEFS        = IN_RT_R0 IN_SUP_R0 i386=1 STD_CALL CONDITION_HANDLING=1 NT_INST=0 \
	WIN32=100 _NT1X_=100 WINNT=1 _WIN32_WINNT=0x0501 WINVER=0x0501 _WIN32_IE=0x0600 WIN32_LEAN_AND_MEAN=1 \
	VBOXUSBFILTERMGR_USB_SPINLOCK VBOX_DBG_LOG_NAME=\"USBMon\"
VBoxUSBMon_LDFLAGS.x86 = -Entry:DriverEntry@8
VBoxUSBMon_LDFLAGS.amd64 = -Entry:DriverEntry
ifdef VBOX_USBMON_WITH_FILTER_AUTOAPPLY
 VBoxUSBMon_DEFS      += VBOX_USBMON_WITH_FILTER_AUTOAPPLY
endif
VBoxUSBMon_SOURCES     = \
	mon/VBoxUsbMon.cpp  \
	mon/VBoxUsbFlt.cpp  \
	mon/VBoxUsbHook.cpp \
	cmn/VBoxUsbTool.cpp \
	cmn/VBoxDrvTool.cpp \
	../USBFilter.cpp \
	../VBoxUSBFilterMgr.cpp \
	mon/VBoxUsbMon.rc
VBoxUSBMon_LIBS        = \
	$(PATH_SDK_$(VBOX_WINDDK)_LIB)/ntoskrnl.lib \
	$(PATH_SDK_$(VBOX_WINDDK)_LIB)/hal.lib \
	$(PATH_STAGE_LIB)/RuntimeR0Drv$(VBOX_SUFF_LIB) \
	$(usbd_1_TARGET)
if1of ($(KBUILD_TYPE), debug)
VBoxUSBMon_DEFS      += LOG_ENABLED VBOX_USB_WITH_VERBOSE_LOGGING
endif

#
# USBInstall
#
USBInstall_TEMPLATE = VBOXR3EXE
USBInstall_DEFS     = IN_RT_R3
USBInstall_SDKS     = ReorderCompilerIncs $(VBOX_WINPSDK) $(VBOX_WINDDK) VBOX_NTDLL
USBInstall_CXXFLAGS = -Gz
USBInstall_CFLAGS   = -Gz
USBInstall_SOURCES  = \
	Install/USBInstall.cpp
USBInstall_LIBS = \
	$(PATH_SDK_$(VBOX_WINDDK)_LIB)/newdev.lib \
	$(LIB_RUNTIME) \
	$(PATH_STAGE_LIB)/SUPR3$(VBOX_SUFF_LIB) \
	$(PATH_STAGE_LIB)/VBoxDrvCfg$(VBOX_SUFF_LIB)


#
# USBUninstall
#
USBUninstall_TEMPLATE = VBOXR3EXE
USBUninstall_DEFS     = IN_RT_R3
USBUninstall_SDKS     = ReorderCompilerIncs $(VBOX_WINPSDK) $(VBOX_WINDDK) VBOX_NTDLL
USBUninstall_CXXFLAGS = -Gz
USBUninstall_CFLAGS   = -Gz
USBUninstall_SOURCES  = \
	Install/USBUninstall.cpp
USBUninstall_LIBS = \
	$(PATH_SDK_$(VBOX_WINDDK)_LIB)/newdev.lib \
	$(LIB_RUNTIME) \
	$(PATH_STAGE_LIB)/SUPR3$(VBOX_SUFF_LIB) \
	$(PATH_STAGE_LIB)/VBoxDrvCfg$(VBOX_SUFF_LIB)

#
# USBTest
#
USBTest_TEMPLATE = VBOXR3EXE
USBTest_DEFS     = IN_RT_R3
USBTest_SDKS     = ReorderCompilerIncs $(VBOX_WINPSDK) $(VBOX_WINDDK) VBOX_NTDLL
USBTest_CXXFLAGS = -Gz
USBTest_CFLAGS   = -Gz
USBTest_SOURCES  = \
	testcase/USBTest.cpp
USBTest_LIBS = \
	$(PATH_SDK_$(VBOX_WINDDK)_LIB)/newdev.lib \
	$(LIB_RUNTIME) \
	$(PATH_STAGE_LIB)/SUPR3$(VBOX_SUFF_LIB) \
	$(PATH_STAGE_LIB)/VBoxDrvCfg$(VBOX_SUFF_LIB)

#
# Install the INF files.
#
install-infs_TEMPLATE = VBoxR0DrvInfCat
install-infs_SOURCES = \
	$(PATH_TARGET)/VBoxUSBCat.dir/VBoxUSB.inf \
	$(PATH_TARGET)/VBoxUSBMonCat.dir/VBoxUSBMon.inf
install-infs_CLEAN = $(install-infs_SOURCES)
install-infs_BLDDIRS = \
	$(PATH_TARGET)/VBoxUSBCat.dir \
	$(PATH_TARGET)/VBoxUSBMonCat.dir

$(PATH_TARGET)/VBoxUSBCat.dir/VBoxUSB.inf: $(PATH_SUB_CURRENT)/dev/VBoxUSB.inf $(MAKEFILE_CURRENT) | $$(dir $$@)
	$(call MSG_GENERATE,install-infs,$@,$<)
	$(call VBOX_EDIT_INF_FN,$<,$@)

$(PATH_TARGET)/VBoxUSBMonCat.dir/VBoxUSBMon.inf: $(PATH_SUB_CURRENT)/mon/VBoxUSBMon.inf $(MAKEFILE_CURRENT) | $$(dir $$@)
	$(call MSG_GENERATE,install-infs,$@,$<)
	$(call VBOX_EDIT_INF_FN,$<,$@)

ifdef VBOX_SIGNING_MODE
install-infs_SOURCES += \
	$(PATH_TARGET)/VBoxUSBCat.dir/VBoxUSB.cat \
	$(PATH_TARGET)/VBoxUSBCat.dir/VBoxUSB.cat=>VBoxUSB-PreW10.cat \
	$(PATH_TARGET)/VBoxUSBCat.dir/VBoxUSB.sys \
	$(PATH_TARGET)/VBoxUSBMonCat.dir/VBoxUSBMon.cat \
	$(PATH_TARGET)/VBoxUSBMonCat.dir/VBoxUSBMon.cat=>VBoxUSBMon-PreW10.cat \
	$(PATH_TARGET)/VBoxUSBMonCat.dir/VBoxUSBMon.sys

$(PATH_TARGET)/VBoxUSBCat.dir/VBoxUSB.sys: $$(VBoxUSB_1_TARGET) | $$(dir $$@)
	$(INSTALL) -m 644 $< $(@D)

$(PATH_TARGET)/VBoxUSBCat.dir/VBoxUSB.cat: \
		$(PATH_TARGET)/VBoxUSBCat.dir/VBoxUSB.inf \
		$(PATH_TARGET)/VBoxUSBCat.dir/VBoxUSB.sys
	$(call MSG_TOOL,Inf2Cat,VBoxUSB-inf,$@,$<)
	$(call VBOX_MAKE_CAT_FN, $(@D),$@)

$(PATH_TARGET)/VBoxUSBMonCat.dir/VBoxUSBMon.sys: $$(VBoxUSBMon_1_TARGET) | $$(dir $$@)
	$(INSTALL) -m 644 $< $(@D)

$(PATH_TARGET)/VBoxUSBMonCat.dir/VBoxUSBMon.cat: \
		$(PATH_TARGET)/VBoxUSBMonCat.dir/VBoxUSBMon.inf \
		$(PATH_TARGET)/VBoxUSBMonCat.dir/VBoxUSBMon.sys
	$(call MSG_TOOL,Inf2Cat,VBoxUSBMon-inf,$@,$<)
	$(call VBOX_MAKE_CAT_FN, $(@D),$@)

endif # signing

# generate rules
include $(FILE_KBUILD_SUB_FOOTER)