VirtualBox

source: vbox/trunk/src/VBox/HostDrivers/Support/Makefile@ 2366

Last change on this file since 2366 was 2366, checked in by vboxsync, 18 years ago

use kBuild-provided msg macros

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 9.7 KB
Line 
1#
2# Sub-Makefile for the support library and the drivers/modules/kexts it uses.
3#
4
5#
6# Copyright (C) 2006 InnoTek Systemberatung GmbH
7#
8# This file is part of VirtualBox Open Source Edition (OSE), as
9# available from http://www.virtualbox.org. This file is free software;
10# you can redistribute it and/or modify it under the terms of the GNU
11# General Public License as published by the Free Software Foundation,
12# in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
13# distribution. VirtualBox OSE is distributed in the hope that it will
14# be useful, but WITHOUT ANY WARRANTY of any kind.
15#
16# If you received this file as part of a commercial VirtualBox
17# distribution, then only the terms of your commercial VirtualBox
18# license agreement apply instead of the previous paragraph.
19#
20
21DEPTH ?= ../../../..
22SUB_DEPTH = ..
23include $(PATH_KBUILD)/subheader.kmk
24
25#
26# Targets
27#
28LIBRARIES += SUPR3
29ifneq ($(filter-out darwin,$(BUILD_TARGET)),)
30LIBRARIES += SUPR0
31endif
32ifdef VBOX_WITH_VBOXDRV
33SYSMODS.darwin += VBoxDrv
34SYSMODS.linux += vboxdrv
35SYSMODS.win += VBoxDrv
36SYSMODS.os2 += VBoxDrv
37endif
38
39
40#
41# Include sub-makefile(s).
42#
43include $(VBOX_PATH_SUPPORT)/testcase/Makefile
44
45
46ifeq ($(BUILD_TARGET),linux)
47## @todo change this to use a INSTALLS target.
48EXPORT_FILE_PAIRS = \
49 include/iprt/alloc.h=$(PATH_ROOT)/include/iprt/alloc.h \
50 include/iprt/asm.h=$(PATH_ROOT)/include/iprt/asm.h \
51 include/iprt/assert.h=$(PATH_ROOT)/include/iprt/assert.h \
52 include/iprt/cdefs.h=$(PATH_ROOT)/include/iprt/cdefs.h \
53 include/iprt/err.h=$(PATH_ROOT)/include/iprt/err.h \
54 include/iprt/heap.h=$(PATH_ROOT)/include/iprt/heap.h \
55 include/iprt/initterm.h=$(PATH_ROOT)/include/iprt/initterm.h \
56 include/iprt/log.h=$(PATH_ROOT)/include/iprt/log.h \
57 include/iprt/mem.h=$(PATH_ROOT)/include/iprt/mem.h \
58 include/iprt/param.h=$(PATH_ROOT)/include/iprt/param.h \
59 include/iprt/process.h=$(PATH_ROOT)/include/iprt/process.h \
60 include/iprt/semaphore.h=$(PATH_ROOT)/include/iprt/semaphore.h \
61 include/iprt/spinlock.h=$(PATH_ROOT)/include/iprt/spinlock.h \
62 include/iprt/stdarg.h=$(PATH_ROOT)/include/iprt/stdarg.h \
63 include/iprt/stdint.h=$(PATH_ROOT)/include/iprt/stdint.h \
64 include/iprt/string.h=$(PATH_ROOT)/include/iprt/string.h \
65 include/iprt/thread.h=$(PATH_ROOT)/include/iprt/thread.h \
66 include/iprt/types.h=$(PATH_ROOT)/include/iprt/types.h \
67 include/iprt/avl.h=$(PATH_ROOT)/include/iprt/avl.h \
68 include/VBox/cdefs.h=$(PATH_ROOT)/include/VBox/cdefs.h \
69 include/VBox/log.h=$(PATH_ROOT)/include/VBox/log.h \
70 include/VBox/sup.h=$(PATH_ROOT)/include/VBox/sup.h \
71 include/VBox/types.h=$(PATH_ROOT)/include/VBox/types.h \
72 include/internal/initterm.h=$(PATH_ROOT)/src/VBox/Runtime/include/internal/initterm.h \
73 include/internal/thread.h=$(PATH_ROOT)/src/VBox/Runtime/include/internal/thread.h \
74 include/internal/magics.h=$(PATH_ROOT)/src/VBox/Runtime/include/internal/magics.h \
75 linux/SUPDrv-linux.c=$(VBOX_PATH_SUPPORT)/linux/SUPDrv-linux.c \
76 Makefile=$(VBOX_PATH_SUPPORT)/linux/Makefile \
77 build_in_tmp=$(VBOX_PATH_SUPPORT)/linux/build_in_tmp \
78 alloc/heapsimple.c=$(PATH_ROOT)/src/VBox/Runtime/alloc/heapsimple.cpp \
79 r0drv/alloc-r0drv.c=$(PATH_ROOT)/src/VBox/Runtime/r0drv/alloc-r0drv.cpp \
80 r0drv/alloc-r0drv.h=$(PATH_ROOT)/src/VBox/Runtime/r0drv/alloc-r0drv.h \
81 r0drv/initterm-r0drv.c=$(PATH_ROOT)/src/VBox/Runtime/r0drv/initterm-r0drv.cpp \
82 r0drv/linux/alloc-r0drv-linux.c=$(PATH_ROOT)/src/VBox/Runtime/r0drv/linux/alloc-r0drv-linux.c \
83 r0drv/linux/initterm-r0drv-linux.c=$(PATH_ROOT)/src/VBox/Runtime/r0drv/linux/initterm-r0drv-linux.c \
84 r0drv/linux/process-r0drv-linux.c=$(PATH_ROOT)/src/VBox/Runtime/r0drv/linux/process-r0drv-linux.c \
85 r0drv/linux/semaphore-r0drv-linux.c=$(PATH_ROOT)/src/VBox/Runtime/r0drv/linux/semaphore-r0drv-linux.c \
86 r0drv/linux/spinlock-r0drv-linux.c=$(PATH_ROOT)/src/VBox/Runtime/r0drv/linux/spinlock-r0drv-linux.c \
87 r0drv/linux/string.h=$(PATH_ROOT)/src/VBox/Runtime/r0drv/linux/string.h \
88 r0drv/linux/thread-r0drv-linux.c=$(PATH_ROOT)/src/VBox/Runtime/r0drv/linux/thread-r0drv-linux.c \
89 r0drv/linux/the-linux-kernel.h=$(PATH_ROOT)/src/VBox/Runtime/r0drv/linux/the-linux-kernel.h \
90 version-generated.h=$(PATH_OUT)/version-generated.h \
91 SUPDRV.h=$(VBOX_PATH_SUPPORT)/SUPDRV.h \
92 SUPDRVIOC.h=$(VBOX_PATH_SUPPORT)/SUPDRVIOC.h \
93 SUPDRVShared.c=$(VBOX_PATH_SUPPORT)/SUPDRVShared.c
94OTHERS := $(foreach pair,$(EXPORT_FILE_PAIRS),$(PATH_BIN)/src/$(firstword $(subst =, ,$(pair))))
95OTHER_CLEAN = $(OTHERS)
96endif # real linux
97
98
99
100#
101# The Ring-3 Support Library (this is linked into the IPRT dll, VBoxRT).
102#
103ifneq ($(filter l4%,$(BUILD_TARGET) $(BUILD_TARGET_SUB)),)
104# L4 has trouble with -pedantic. It also make trouble when inlining is not enabled.
105SUPR3_TEMPLATE = VBOXR3NP
106else
107SUPR3_TEMPLATE = VBOXR3
108endif
109SUPR3_DEFS = IN_SUP_R3 IN_RT_R3
110SUPR3_INCS = $(VBOX_PATH_SUPPORT)
111SUPR3_INCS.l4 = $(L4_INCDIR)
112ifneq ($(BUILD_TARGET),win) ## @todo rename win32 -> win!
113SUPR3_SOURCES = \
114 $(VBOX_PATH_SUPPORT)/SUPLib.cpp \
115 $(VBOX_PATH_SUPPORT)/$(BUILD_TARGET)/SUPLib-$(BUILD_TARGET).cpp
116else
117SUPR3_SOURCES = \
118 $(VBOX_PATH_SUPPORT)/SUPLib.cpp \
119 $(VBOX_PATH_SUPPORT)/win32/SUPLib-win32.cpp
120endif
121
122#
123# SUPR0 - The Ring-0 Import / Thunk library.
124#
125SUPR0_TEMPLATE = VBOXR0
126ifeq ($(VBOX_LDR_FMT),pe)
127SUPR0_SOURCES += $(VBOX_PATH_SUPPORT)/SUPR0.def
128endif
129ifeq ($(VBOX_LDR_FMT),lx)
130SUPR0_SOURCES += $(PATH_TARGET)/SUPR0.def
131$(PATH_TARGET)/SUPR0.def: $(VBOX_PATH_SUPPORT)/SUPR0.def | $(call DIRDEP,$(PATH_TARGET))
132 $(SED) -e 's/^[ \t][ \t]*\([gA-Z]\)/ _\1/' -e 's/[ \t]DATA[ \t]*/ /' $< > $@.tmp
133 $(MV) -f $@.tmp $@
134endif
135
136
137#
138# VBoxDrv.sys - The Windows driver.
139#
140ifeq ($(BUILD_TARGET),win)
141VBoxDrv_TEMPLATE = VBOXR0DRV
142VBoxDrv_DEFS = IN_RT_R0 IN_SUP_R0
143VBoxDrv_SDKS = W2K3DDK WINPSDKINCS
144VBoxDrv_INCS = $(VBOX_PATH_SUPPORT)
145VBoxDrv_SOURCES = \
146 $(VBOX_PATH_SUPPORT)/SUPDRVShared.c
147VBoxDrv_SOURCES.x86 = \
148 $(VBOX_PATH_SUPPORT)/win32/SUPDrv-win32.cpp \
149 $(VBOX_PATH_SUPPORT)/win32/SUPDrvA-win32.asm
150VBoxDrv_SOURCES.amd64 = \
151 $(VBOX_PATH_SUPPORT)/win64/SUPDrv-win64.cpp \
152 $(VBOX_PATH_SUPPORT)/win64/SUPDrvA-win64.asm
153VBoxDrv_LDFLAGS.x86 = -Entry:DriverEntry@8
154VBoxDrv_LDFLAGS.amd64 = -Entry:DriverEntry
155VBoxDrv_LIBS = \
156 $(PATH_SDK_W2K3DDK_LIB)/ntoskrnl.lib \
157 $(PATH_SDK_W2K3DDK_LIB)/hal.lib \
158 $(PATH_LIB)/RuntimeR0Drv$(VBOX_SUFF_LIB)
159endif
160
161
162#
163# vboxdrv.ko - The Linux Kernel Module.
164#
165ifeq ($(BUILD_TARGET),linux)
166vboxdrv_TEMPLATE = VBOXR0DRV
167vboxdrv_DEFS = KBUILD_MODNAME=KBUILD_STR\(vboxdrv\) KBUILD_BASENAME=KBUILD_STR\(vboxdrv\) MODULE IN_RT_R0 IN_SUP_R0 CONFIG_VBOXDRV_AS_MISC
168vboxdrv_INCS = $(VBOX_PATH_SUPPORT)
169vboxdrv_LIBS = $(PATH_LIB)/RuntimeR0Drv$(VBOX_SUFF_LIB)
170vboxdrv_LIBS.debug = $(vboxdrv_LIBS) $(VBOX_GCC_LIBGCC)
171vboxdrv_SOURCES = \
172 $(VBOX_PATH_SUPPORT)/$(BUILD_TARGET)/SUPDrv-$(BUILD_TARGET).c \
173 $(VBOX_PATH_SUPPORT)/SUPDRVShared.c
174ifndef VBOX_LINUX_VERSION_2_4
175vboxdrv_SOURCES += \
176 $(VBOX_PATH_SUPPORT)/$(BUILD_TARGET)/SUPDrv-$(BUILD_TARGET).mod.c
177endif
178endif # real linux
179
180
181#
182# VBoxDrv.kext - The Darwin Kernel Extension.
183#
184ifeq ($(BUILD_TARGET),darwin)
185VBoxDrv_TEMPLATE = VBOXR0DRV
186VBoxDrv_DEFS = IN_RT_R0 IN_SUP_R0 USE_NEW_OS_INTERFACE
187VBoxDrv_DEFS += DEBUG_DARWIN_GIP
188VBoxDrv_INCS = $(VBOX_PATH_SUPPORT)
189VBoxDrv_LIBS = $(PATH_LIB)/RuntimeR0Drv$(VBOX_SUFF_LIB)
190VBoxDrv_LDFLAGS = -v -Wl,-whyload -Wl,-v -Wl,-whatsloaded
191VBoxDrv_INST = $(INST_VBOXDRV)Contents/MacOS/
192VBoxDrv_SOURCES = \
193 $(VBOX_PATH_SUPPORT)/SUPDRVShared.c \
194 $(VBOX_PATH_SUPPORT)/$(BUILD_TARGET)/SUPDrv-$(BUILD_TARGET).cpp
195
196INSTALLS += VBoxDrv.kext
197VBoxDrv.kext_INST = $(INST_VBOXDRV)Contents/
198VBoxDrv.kext_SOURCES = \
199 $(PATH_TARGET)/Info.plist
200
201$(PATH_TARGET)/Info.plist: $(VBOX_PATH_SUPPORT)/darwin/Info.plist $(VBOX_VERSION_MK) | $(call DIRDEP,$(PATH_TARGET))
202 $(call MSG_L1,Generating $@)
203 $(xQUIET)$(RM) -f $@
204 $(xQUIET)$(SED) \
205 -e 's/@VBOX_VERSION_STRING@/$(VBOX_VERSION_STRING)/g' \
206 -e 's/@VBOX_VERSION_MAJOR@/$(VBOX_VERSION_MAJOR)/g' \
207 -e 's/@VBOX_VERSION_MINOR@/$(VBOX_VERSION_MINOR)/g' \
208 -e 's/@VBOX_VERSION_BUILD@/$(VBOX_VERSION_BUILD)/g' \
209 $< > $@
210
211INSTALLS += Scripts
212Scripts_INST = $(INST_DIST)
213Scripts_SOURCES = \
214 $(VBOX_PATH_SUPPORT)/darwin/load.sh
215
216endif
217
218
219#
220# VBoxDrv.sys - The OS/2 driver.
221#
222ifeq ($(BUILD_TARGET),os2)
223VBoxDrv_TEMPLATE = VBOXR0DRV
224VBoxDrv_DEFS = IN_RT_R0 IN_SUP_R0 USE_NEW_OS_INTERFACE
225VBoxDrv_INCS = $(VBOX_PATH_SUPPORT)
226#VBoxDrv_LDFLAGS = -s -t -v
227VBoxDrv_SOURCES = \
228 $(VBOX_PATH_SUPPORT)/os2/SUPDrvA-os2.asm \
229 $(VBOX_PATH_SUPPORT)/os2/SUPDrv-os2.def
230VBoxDrv_LIBS = \
231 $(TARGET_VBoxDrvLib) \
232 $(PATH_LIB)/RuntimeR0Drv$(VBOX_SUFF_LIB) \
233 $(VBOX_GCC_LIBGCC) \
234 end
235
236# temp hack to ensure that SUPDrvA-os2.asm is first in the link.
237LIBRARIES += VBoxDrvLib
238VBoxDrvLib_TEMPLATE = VBOXR0DRV
239VBoxDrvLib_NOINST = 1
240VBoxDrvLib_DEFS = IN_RT_R0 IN_SUP_R0 USE_NEW_OS_INTERFACE
241VBoxDrvLib_INCS = $(VBOX_PATH_SUPPORT) $(PATH_TARGET) $(PATH_ROOT)/src/VBox/Runtime/include
242VBoxDrvLib_SOURCES = \
243 $(VBOX_PATH_SUPPORT)/os2/SUPDrv-os2.cpp \
244 $(VBOX_PATH_SUPPORT)/SUPDRVShared.c
245endif
246
247
248#
249# Generate rules for exporting the linux sources.
250#
251define def_export_rule
252$(eval dst := $(word 1,$(subst =, ,$(pair))))
253$(eval src := $(word 2,$(subst =, ,$(pair))))
254$(PATH_BIN)/src/$(dst): $(src)
255 $$(call MSG_INST_TRG,VBOXDRV,$$<,$$@)
256 $$(QUIET)$$(MKDIR) -p $$(@D)
257 $$(QUIET)$$(CP) $$< $$@
258
259symlinked/$(dst):
260 $$(call MSG_INST_SYM,$$<,$$@)
261 $$(QUIET)$$(MKDIR) -p $$(@D)
262 $$(QUIET)ln -sfn $(abspath $(src)) $$@
263
264endef
265# generate rules
266$(foreach pair,$(EXPORT_FILE_PAIRS),$(eval $(def_export_rule)))
267
268
269#
270# Rule for creating a symlinked setup.
271#
272symlinked: $(subst $(PATH_BIN)/src/,symlinked/, $(OTHERS))
273 $(ECHO) done
274
275
276include $(PATH_KBUILD)/subfooter.kmk
277
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