1 | # $Id: Makefile.kmk 96407 2022-08-22 17:43:14Z vboxsync $
|
---|
2 | ## @file
|
---|
3 | # Sub-Makefile for the Windows USB drivers.
|
---|
4 | #
|
---|
5 |
|
---|
6 | #
|
---|
7 | # Copyright (C) 2006-2022 Oracle and/or its affiliates.
|
---|
8 | #
|
---|
9 | # This file is part of VirtualBox base platform packages, as
|
---|
10 | # available from https://www.virtualbox.org.
|
---|
11 | #
|
---|
12 | # This program is free software; you can redistribute it and/or
|
---|
13 | # modify it under the terms of the GNU General Public License
|
---|
14 | # as published by the Free Software Foundation, in version 3 of the
|
---|
15 | # License.
|
---|
16 | #
|
---|
17 | # This program is distributed in the hope that it will be useful, but
|
---|
18 | # WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
19 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
20 | # General Public License for more details.
|
---|
21 | #
|
---|
22 | # You should have received a copy of the GNU General Public License
|
---|
23 | # along with this program; if not, see <https://www.gnu.org/licenses>.
|
---|
24 | #
|
---|
25 | # The contents of this file may alternatively be used under the terms
|
---|
26 | # of the Common Development and Distribution License Version 1.0
|
---|
27 | # (CDDL), a copy of it is provided in the "COPYING.CDDL" file included
|
---|
28 | # in the VirtualBox distribution, in which case the provisions of the
|
---|
29 | # CDDL are applicable instead of those of the GPL.
|
---|
30 | #
|
---|
31 | # You may elect to license modified versions of this file under the
|
---|
32 | # terms and conditions of either the GPL or the CDDL or both.
|
---|
33 | #
|
---|
34 | # SPDX-License-Identifier: GPL-3.0-only OR CDDL-1.0
|
---|
35 | #
|
---|
36 |
|
---|
37 | SUB_DEPTH = ../../../../..
|
---|
38 | include $(KBUILD_PATH)/subheader.kmk
|
---|
39 |
|
---|
40 | LIBRARIES.win += usbd
|
---|
41 | SYSMODS.win += VBoxUSB VBoxUSBMon
|
---|
42 | PROGRAMS.win += USBInstall USBUninstall USBTest
|
---|
43 | INSTALLS.win += install-infs
|
---|
44 |
|
---|
45 | #
|
---|
46 | # usbd
|
---|
47 | #
|
---|
48 | usbd_TEMPLATE = VBOXR0DRV
|
---|
49 | usbd_SOURCES = usbd/usbd.def
|
---|
50 |
|
---|
51 | #
|
---|
52 | # VBoxUSB
|
---|
53 | #
|
---|
54 | VBoxUSB_TEMPLATE = VBOXR0DRV
|
---|
55 | ifdef VBOX_SIGNING_MODE
|
---|
56 | VBoxUSB_INSTTYPE = none
|
---|
57 | VBoxUSB_DEBUG_INSTTYPE = both
|
---|
58 | endif
|
---|
59 | VBoxUSB_SDKS = ReorderCompilerIncs $(VBOX_WINDDK) $(VBOX_WINPSDK_INCS)
|
---|
60 | ifdef VBOX_WITH_AUTOMATIC_DEFS_QUOTING
|
---|
61 | VBoxUSB_DEFS := IN_RT_R0 IN_SUP_R0 VBOX_DBG_LOG_NAME="USBDev"
|
---|
62 | else
|
---|
63 | VBoxUSB_DEFS := IN_RT_R0 IN_SUP_R0 VBOX_DBG_LOG_NAME=\"USBDev\"
|
---|
64 | endif
|
---|
65 | VBoxUSB_LDFLAGS.x86 = -Entry:DriverEntry@8
|
---|
66 | VBoxUSB_LDFLAGS.amd64 = -Entry:DriverEntry
|
---|
67 | VBoxUSB_SOURCES = \
|
---|
68 | dev/VBoxUsbDev.cpp \
|
---|
69 | dev/VBoxUsbRt.cpp \
|
---|
70 | dev/VBoxUsbPnP.cpp \
|
---|
71 | dev/VBoxUsbPwr.cpp \
|
---|
72 | cmn/VBoxUsbTool.cpp \
|
---|
73 | cmn/VBoxDrvTool.cpp \
|
---|
74 | dev/VBoxUsbDev.rc
|
---|
75 | VBoxUSB_LIBS = \
|
---|
76 | $(PATH_SDK_$(VBOX_WINDDK)_LIB)/ntoskrnl.lib \
|
---|
77 | $(PATH_SDK_$(VBOX_WINDDK)_LIB)/hal.lib \
|
---|
78 | $(PATH_STAGE_LIB)/RuntimeR0Drv$(VBOX_SUFF_LIB) \
|
---|
79 | $(usbd_1_TARGET)
|
---|
80 |
|
---|
81 | #
|
---|
82 | # VBoxUSBMon
|
---|
83 | #
|
---|
84 | VBoxUSBMon_TEMPLATE = VBOXR0DRV
|
---|
85 | ifdef VBOX_SIGNING_MODE
|
---|
86 | VBoxUSBMon_INSTTYPE = none
|
---|
87 | VBoxUSBMon_DEBUG_INSTTYPE = both
|
---|
88 | endif
|
---|
89 | VBoxUSBMon_INCS := $(PATH_SUB_CURRENT)/..
|
---|
90 | VBoxUSBMon_SDKS = ReorderCompilerIncs $(VBOX_WINDDK) $(VBOX_WINPSDK_INCS)
|
---|
91 | VBoxUSBMon_DEFS = IN_RT_R0 IN_SUP_R0 NTDDI_WINNT=_NTDDI_VISTA VBOXUSBFILTERMGR_USB_SPINLOCK
|
---|
92 | ifdef VBOX_WITH_AUTOMATIC_DEFS_QUOTING
|
---|
93 | VBoxUSBMon_DEFS += VBOX_DBG_LOG_NAME="USBMon"
|
---|
94 | else
|
---|
95 | VBoxUSBMon_DEFS += VBOX_DBG_LOG_NAME=\"USBMon\"
|
---|
96 | endif
|
---|
97 | VBoxUSBMon_LDFLAGS.x86 = -Entry:DriverEntry@8
|
---|
98 | VBoxUSBMon_LDFLAGS.amd64 = -Entry:DriverEntry
|
---|
99 | ifdef VBOX_USBMON_WITH_FILTER_AUTOAPPLY
|
---|
100 | VBoxUSBMon_DEFS += VBOX_USBMON_WITH_FILTER_AUTOAPPLY
|
---|
101 | endif
|
---|
102 | VBoxUSBMon_SOURCES = \
|
---|
103 | mon/VBoxUsbMon.cpp \
|
---|
104 | mon/VBoxUsbFlt.cpp \
|
---|
105 | mon/VBoxUsbHook.cpp \
|
---|
106 | cmn/VBoxUsbTool.cpp \
|
---|
107 | cmn/VBoxDrvTool.cpp \
|
---|
108 | ../USBFilter.cpp \
|
---|
109 | ../VBoxUSBFilterMgr.cpp \
|
---|
110 | mon/VBoxUsbMon.rc
|
---|
111 | VBoxUSBMon_LIBS = \
|
---|
112 | $(PATH_SDK_$(VBOX_WINDDK)_LIB)/ntoskrnl.lib \
|
---|
113 | $(PATH_SDK_$(VBOX_WINDDK)_LIB)/hal.lib \
|
---|
114 | $(PATH_STAGE_LIB)/RuntimeR0Drv$(VBOX_SUFF_LIB) \
|
---|
115 | $(usbd_1_TARGET)
|
---|
116 | if1of ($(KBUILD_TYPE), debug)
|
---|
117 | VBoxUSBMon_DEFS += LOG_ENABLED VBOX_USB_WITH_VERBOSE_LOGGING
|
---|
118 | endif
|
---|
119 |
|
---|
120 | #
|
---|
121 | # Template for USBInstalls and friends.
|
---|
122 | #
|
---|
123 | TEMPLATE_VBoxUsbR3 = Template for USBInstalls, USBUninstall and USBTest
|
---|
124 | TEMPLATE_VBoxUsbR3_EXTENDS = VBoxR3Static
|
---|
125 | TEMPLATE_VBoxUsbR3_SDKS = $(TEMPLATE_VBoxR3Static_SDKS) ReorderCompilerIncs $(VBOX_WINPSDK) $(VBOX_WINDDK) VBOX_WIN_NEWDEV
|
---|
126 | TEMPLATE_VBoxUsbR3_CXXFLAGS = $(TEMPLATE_VBoxR3Static_CXXFLAGS) -Gz
|
---|
127 | TEMPLATE_VBoxUsbR3_CFLAGS = $(TEMPLATE_VBoxR3Static_CFLAGS) -Gz
|
---|
128 | TEMPLATE_VBoxUsbR3_LIBS = $(TEMPLATE_VBoxR3Static_LIBS) \
|
---|
129 | $(PATH_STAGE_LIB)/VBoxDrvCfg$(VBOX_SUFF_LIB)
|
---|
130 |
|
---|
131 | #
|
---|
132 | # USBInstall
|
---|
133 | #
|
---|
134 | USBInstall_TEMPLATE = VBoxUsbR3
|
---|
135 | USBInstall_SOURCES = Install/USBInstall.cpp
|
---|
136 |
|
---|
137 | #
|
---|
138 | # USBUninstall
|
---|
139 | #
|
---|
140 | USBUninstall_TEMPLATE = VBoxUsbR3
|
---|
141 | USBUninstall_SOURCES = Install/USBUninstall.cpp
|
---|
142 |
|
---|
143 | #
|
---|
144 | # USBTest
|
---|
145 | #
|
---|
146 | USBTest_TEMPLATE = VBoxUsbR3
|
---|
147 | USBTest_DEFS = IN_USBLIB
|
---|
148 | USBTest_SOURCES = \
|
---|
149 | testcase/USBTest.cpp \
|
---|
150 | ../USBFilter.cpp
|
---|
151 |
|
---|
152 | #
|
---|
153 | # Install the INF files.
|
---|
154 | #
|
---|
155 | install-infs_TEMPLATE = VBoxR0DrvInfCat
|
---|
156 | install-infs_SOURCES = \
|
---|
157 | $(PATH_TARGET)/VBoxUSBCat.dir/VBoxUSB.inf \
|
---|
158 | $(PATH_TARGET)/VBoxUSBMonCat.dir/VBoxUSBMon.inf
|
---|
159 | install-infs_CLEAN = $(install-infs_SOURCES)
|
---|
160 | install-infs_BLDDIRS = \
|
---|
161 | $(PATH_TARGET)/VBoxUSBCat.dir \
|
---|
162 | $(PATH_TARGET)/VBoxUSBMonCat.dir
|
---|
163 |
|
---|
164 | $(PATH_TARGET)/VBoxUSBCat.dir/VBoxUSB.inf: $(PATH_SUB_CURRENT)/dev/VBoxUSB.inf $(MAKEFILE_CURRENT) | $$(dir $$@)
|
---|
165 | $(call MSG_GENERATE,install-infs,$@,$<)
|
---|
166 | $(call VBOX_EDIT_INF_FN,$<,$@)
|
---|
167 |
|
---|
168 | $(PATH_TARGET)/VBoxUSBMonCat.dir/VBoxUSBMon.inf: $(PATH_SUB_CURRENT)/mon/VBoxUSBMon.inf $(MAKEFILE_CURRENT) | $$(dir $$@)
|
---|
169 | $(call MSG_GENERATE,install-infs,$@,$<)
|
---|
170 | $(call VBOX_EDIT_INF_FN,$<,$@)
|
---|
171 |
|
---|
172 | ifdef VBOX_SIGNING_MODE
|
---|
173 | install-infs_SOURCES += \
|
---|
174 | $(PATH_TARGET)/VBoxUSBCat.dir/VBoxUSB.cat \
|
---|
175 | $(PATH_TARGET)/VBoxUSBCat.dir/VBoxUSB.cat=>VBoxUSB-PreW10.cat \
|
---|
176 | $(PATH_TARGET)/VBoxUSBCat.dir/VBoxUSB.sys \
|
---|
177 | $(PATH_TARGET)/VBoxUSBMonCat.dir/VBoxUSBMon.cat \
|
---|
178 | $(PATH_TARGET)/VBoxUSBMonCat.dir/VBoxUSBMon.cat=>VBoxUSBMon-PreW10.cat \
|
---|
179 | $(PATH_TARGET)/VBoxUSBMonCat.dir/VBoxUSBMon.sys
|
---|
180 |
|
---|
181 | $(PATH_TARGET)/VBoxUSBCat.dir/VBoxUSB.sys: $$(VBoxUSB_1_TARGET) | $$(dir $$@)
|
---|
182 | $(INSTALL) -m 644 $< $(@D)
|
---|
183 |
|
---|
184 | $(PATH_TARGET)/VBoxUSBCat.dir/VBoxUSB.cat: \
|
---|
185 | $(PATH_TARGET)/VBoxUSBCat.dir/VBoxUSB.inf \
|
---|
186 | $(PATH_TARGET)/VBoxUSBCat.dir/VBoxUSB.sys
|
---|
187 | $(call MSG_TOOL,Inf2Cat,VBoxUSB-inf,$@,$<)
|
---|
188 | $(call VBOX_MAKE_CAT_FN, $(@D),$@)
|
---|
189 |
|
---|
190 | $(PATH_TARGET)/VBoxUSBMonCat.dir/VBoxUSBMon.sys: $$(VBoxUSBMon_1_TARGET) | $$(dir $$@)
|
---|
191 | $(INSTALL) -m 644 $< $(@D)
|
---|
192 |
|
---|
193 | $(PATH_TARGET)/VBoxUSBMonCat.dir/VBoxUSBMon.cat: \
|
---|
194 | $(PATH_TARGET)/VBoxUSBMonCat.dir/VBoxUSBMon.inf \
|
---|
195 | $(PATH_TARGET)/VBoxUSBMonCat.dir/VBoxUSBMon.sys
|
---|
196 | $(call MSG_TOOL,Inf2Cat,VBoxUSBMon-inf,$@,$<)
|
---|
197 | $(call VBOX_MAKE_CAT_FN, $(@D),$@)
|
---|
198 |
|
---|
199 | endif # signing
|
---|
200 |
|
---|
201 | # generate rules
|
---|
202 | include $(FILE_KBUILD_SUB_FOOTER)
|
---|
203 |
|
---|