1 | # $Id: Makefile.kmk 104659 2024-05-16 09:54:44Z vboxsync $
|
---|
2 | ## @file
|
---|
3 | # Sub-Makefile for the Windows USB drivers.
|
---|
4 | #
|
---|
5 |
|
---|
6 | #
|
---|
7 | # Copyright (C) 2006-2023 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 | ifdef VBOX_WITH_VBOXDRV
|
---|
42 | SYSMODS.win += VBoxUSB VBoxUSBMon
|
---|
43 | INSTALLS.win += install-infs
|
---|
44 | endif
|
---|
45 | PROGRAMS.win += USBInstall USBUninstall USBTest
|
---|
46 |
|
---|
47 | #
|
---|
48 | # usbd
|
---|
49 | #
|
---|
50 | usbd_TEMPLATE = VBoxR0Drv
|
---|
51 | usbd_SOURCES = usbd/usbd.def
|
---|
52 |
|
---|
53 | #
|
---|
54 | # VBoxUSB
|
---|
55 | #
|
---|
56 | VBoxUSB_TEMPLATE = VBoxR0Drv
|
---|
57 | ifdef VBOX_SIGNING_MODE
|
---|
58 | VBoxUSB_INSTTYPE = none
|
---|
59 | VBoxUSB_DEBUG_INSTTYPE = both
|
---|
60 | endif
|
---|
61 | VBoxUSB_SDKS = ReorderCompilerIncs $(VBOX_WINDDK) $(VBOX_WINPSDK_INCS)
|
---|
62 | ifdef VBOX_WITH_AUTOMATIC_DEFS_QUOTING
|
---|
63 | VBoxUSB_DEFS := IN_RT_R0 IN_SUP_R0 VBOX_DBG_LOG_NAME="USBDev"
|
---|
64 | else
|
---|
65 | VBoxUSB_DEFS := IN_RT_R0 IN_SUP_R0 VBOX_DBG_LOG_NAME=\"USBDev\"
|
---|
66 | endif
|
---|
67 | VBoxUSB_LDFLAGS.x86 = -Entry:DriverEntry@8
|
---|
68 | VBoxUSB_LDFLAGS.amd64 = -Entry:DriverEntry
|
---|
69 | VBoxUSB_SOURCES = \
|
---|
70 | dev/VBoxUsbDev.cpp \
|
---|
71 | dev/VBoxUsbRt.cpp \
|
---|
72 | dev/VBoxUsbPnP.cpp \
|
---|
73 | dev/VBoxUsbPwr.cpp \
|
---|
74 | cmn/VBoxUsbTool.cpp \
|
---|
75 | cmn/VBoxDrvTool.cpp \
|
---|
76 | dev/VBoxUsbDev.rc
|
---|
77 | VBoxUSB_LIBS = \
|
---|
78 | $(PATH_SDK_$(VBOX_WINDDK)_LIB)/ntoskrnl.lib \
|
---|
79 | $(PATH_SDK_$(VBOX_WINDDK)_LIB)/hal.lib \
|
---|
80 | $(PATH_STAGE_LIB)/RuntimeR0Drv$(VBOX_SUFF_LIB) \
|
---|
81 | $(usbd_1_TARGET)
|
---|
82 |
|
---|
83 | #
|
---|
84 | # VBoxUSBMon
|
---|
85 | #
|
---|
86 | VBoxUSBMon_TEMPLATE = VBoxR0Drv
|
---|
87 | ifdef VBOX_SIGNING_MODE
|
---|
88 | VBoxUSBMon_INSTTYPE = none
|
---|
89 | VBoxUSBMon_DEBUG_INSTTYPE = both
|
---|
90 | endif
|
---|
91 | VBoxUSBMon_INCS := $(PATH_SUB_CURRENT)/..
|
---|
92 | VBoxUSBMon_SDKS = ReorderCompilerIncs $(VBOX_WINDDK) $(VBOX_WINPSDK_INCS)
|
---|
93 | VBoxUSBMon_DEFS = IN_RT_R0 IN_SUP_R0 NTDDI_WINNT=_NTDDI_VISTA VBOXUSBFILTERMGR_USB_SPINLOCK
|
---|
94 | ifdef VBOX_WITH_AUTOMATIC_DEFS_QUOTING
|
---|
95 | VBoxUSBMon_DEFS += VBOX_DBG_LOG_NAME="USBMon"
|
---|
96 | else
|
---|
97 | VBoxUSBMon_DEFS += VBOX_DBG_LOG_NAME=\"USBMon\"
|
---|
98 | endif
|
---|
99 | VBoxUSBMon_LDFLAGS.x86 = -Entry:DriverEntry@8
|
---|
100 | VBoxUSBMon_LDFLAGS.amd64 = -Entry:DriverEntry
|
---|
101 | ifdef VBOX_USBMON_WITH_FILTER_AUTOAPPLY
|
---|
102 | VBoxUSBMon_DEFS += VBOX_USBMON_WITH_FILTER_AUTOAPPLY
|
---|
103 | endif
|
---|
104 | VBoxUSBMon_SOURCES = \
|
---|
105 | mon/VBoxUsbMon.cpp \
|
---|
106 | mon/VBoxUsbFlt.cpp \
|
---|
107 | mon/VBoxUsbHook.cpp \
|
---|
108 | cmn/VBoxUsbTool.cpp \
|
---|
109 | cmn/VBoxDrvTool.cpp \
|
---|
110 | ../USBFilter.cpp \
|
---|
111 | ../VBoxUSBFilterMgr.cpp \
|
---|
112 | mon/VBoxUsbMon.rc
|
---|
113 | VBoxUSBMon_LIBS = \
|
---|
114 | $(PATH_SDK_$(VBOX_WINDDK)_LIB)/ntoskrnl.lib \
|
---|
115 | $(PATH_SDK_$(VBOX_WINDDK)_LIB)/hal.lib \
|
---|
116 | $(PATH_STAGE_LIB)/RuntimeR0Drv$(VBOX_SUFF_LIB) \
|
---|
117 | $(usbd_1_TARGET)
|
---|
118 | if1of ($(KBUILD_TYPE), debug)
|
---|
119 | VBoxUSBMon_DEFS += LOG_ENABLED VBOX_USB_WITH_VERBOSE_LOGGING
|
---|
120 | endif
|
---|
121 |
|
---|
122 | #
|
---|
123 | # Template for USBInstalls and friends.
|
---|
124 | #
|
---|
125 | TEMPLATE_VBoxUsbR3 = Template for USBInstalls, USBUninstall and USBTest
|
---|
126 | TEMPLATE_VBoxUsbR3_EXTENDS = VBoxR3Exe
|
---|
127 | TEMPLATE_VBoxUsbR3_SDKS = $(TEMPLATE_VBoxR3Exe_SDKS) ReorderCompilerIncs $(VBOX_WINPSDK) $(VBOX_WINDDK) VBoxWinNewDevLib
|
---|
128 | TEMPLATE_VBoxUsbR3_CXXFLAGS = $(TEMPLATE_VBoxR3Exe_CXXFLAGS) -Gz
|
---|
129 | TEMPLATE_VBoxUsbR3_CFLAGS = $(TEMPLATE_VBoxR3Exe_CFLAGS) -Gz
|
---|
130 | TEMPLATE_VBoxUsbR3_LIBS = $(TEMPLATE_VBoxR3Exe_LIBS) \
|
---|
131 | $(PATH_STAGE_LIB)/VBoxDrvCfgExe$(VBOX_SUFF_LIB) \
|
---|
132 | $(LIB_RUNTIME)
|
---|
133 |
|
---|
134 | #
|
---|
135 | # USBInstall
|
---|
136 | #
|
---|
137 | USBInstall_TEMPLATE = VBoxUsbR3
|
---|
138 | USBInstall_SOURCES = Install/USBInstall.cpp
|
---|
139 |
|
---|
140 | #
|
---|
141 | # USBUninstall
|
---|
142 | #
|
---|
143 | USBUninstall_TEMPLATE = VBoxUsbR3
|
---|
144 | USBUninstall_SOURCES = Install/USBUninstall.cpp
|
---|
145 |
|
---|
146 | #
|
---|
147 | # USBTest
|
---|
148 | #
|
---|
149 | USBTest_TEMPLATE = VBoxUsbR3
|
---|
150 | USBTest_DEFS = IN_USBLIB
|
---|
151 | USBTest_SOURCES = \
|
---|
152 | testcase/USBTest.cpp \
|
---|
153 | ../USBFilter.cpp
|
---|
154 |
|
---|
155 | #
|
---|
156 | # Install the INF files.
|
---|
157 | #
|
---|
158 | install-infs_TEMPLATE = VBoxR0DrvInfCat
|
---|
159 | install-infs_SOURCES = \
|
---|
160 | $(PATH_TARGET)/VBoxUSBCat.dir/VBoxUSB.inf \
|
---|
161 | $(PATH_TARGET)/VBoxUSBMonCat.dir/VBoxUSBMon.inf
|
---|
162 | install-infs_CLEAN = $(install-infs_SOURCES)
|
---|
163 | install-infs_BLDDIRS = \
|
---|
164 | $(PATH_TARGET)/VBoxUSBCat.dir \
|
---|
165 | $(PATH_TARGET)/VBoxUSBMonCat.dir
|
---|
166 |
|
---|
167 | $(PATH_TARGET)/VBoxUSBCat.dir/VBoxUSB.inf: $(PATH_SUB_CURRENT)/dev/VBoxUSB.inf $(MAKEFILE_CURRENT) | $$(dir $$@)
|
---|
168 | $(call MSG_GENERATE,install-infs,$@,$<)
|
---|
169 | $(call VBOX_EDIT_INF_FN,$<,$@)
|
---|
170 |
|
---|
171 | $(PATH_TARGET)/VBoxUSBMonCat.dir/VBoxUSBMon.inf: $(PATH_SUB_CURRENT)/mon/VBoxUSBMon.inf $(MAKEFILE_CURRENT) | $$(dir $$@)
|
---|
172 | $(call MSG_GENERATE,install-infs,$@,$<)
|
---|
173 | $(call VBOX_EDIT_INF_FN,$<,$@)
|
---|
174 |
|
---|
175 | ifdef VBOX_SIGNING_MODE
|
---|
176 | install-infs_SOURCES += \
|
---|
177 | $(PATH_TARGET)/VBoxUSBCat.dir/VBoxUSB.cat \
|
---|
178 | $(PATH_TARGET)/VBoxUSBCat.dir/VBoxUSB.cat=>VBoxUSB-PreW10.cat \
|
---|
179 | $(PATH_TARGET)/VBoxUSBCat.dir/VBoxUSB.sys \
|
---|
180 | $(PATH_TARGET)/VBoxUSBMonCat.dir/VBoxUSBMon.cat \
|
---|
181 | $(PATH_TARGET)/VBoxUSBMonCat.dir/VBoxUSBMon.cat=>VBoxUSBMon-PreW10.cat \
|
---|
182 | $(PATH_TARGET)/VBoxUSBMonCat.dir/VBoxUSBMon.sys
|
---|
183 |
|
---|
184 | $(PATH_TARGET)/VBoxUSBCat.dir/VBoxUSB.sys: $$(VBoxUSB_1_TARGET) | $$(dir $$@)
|
---|
185 | $(INSTALL) -m 644 $< $(@D)
|
---|
186 |
|
---|
187 | $(PATH_TARGET)/VBoxUSBCat.dir/VBoxUSB.cat: \
|
---|
188 | $(PATH_TARGET)/VBoxUSBCat.dir/VBoxUSB.inf \
|
---|
189 | $(PATH_TARGET)/VBoxUSBCat.dir/VBoxUSB.sys
|
---|
190 | $(call MSG_TOOL,Inf2Cat,VBoxUSB-inf,$@,$<)
|
---|
191 | $(call VBOX_MAKE_CAT_FN, $(@D),$@)
|
---|
192 |
|
---|
193 | $(PATH_TARGET)/VBoxUSBMonCat.dir/VBoxUSBMon.sys: $$(VBoxUSBMon_1_TARGET) | $$(dir $$@)
|
---|
194 | $(INSTALL) -m 644 $< $(@D)
|
---|
195 |
|
---|
196 | $(PATH_TARGET)/VBoxUSBMonCat.dir/VBoxUSBMon.cat: \
|
---|
197 | $(PATH_TARGET)/VBoxUSBMonCat.dir/VBoxUSBMon.inf \
|
---|
198 | $(PATH_TARGET)/VBoxUSBMonCat.dir/VBoxUSBMon.sys
|
---|
199 | $(call MSG_TOOL,Inf2Cat,VBoxUSBMon-inf,$@,$<)
|
---|
200 | $(call VBOX_MAKE_CAT_FN, $(@D),$@)
|
---|
201 |
|
---|
202 | endif # signing
|
---|
203 |
|
---|
204 | # generate rules
|
---|
205 | include $(FILE_KBUILD_SUB_FOOTER)
|
---|
206 |
|
---|