VirtualBox

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

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

Copy internal/magics.h

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 9.6 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_PATH = ..
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_INCS = $(VBOX_PATH_SUPPORT)
188VBoxDrv_LIBS = $(PATH_LIB)/RuntimeR0Drv$(VBOX_SUFF_LIB)
189VBoxDrv_LDFLAGS = -v -Wl,-whyload -Wl,-v -Wl,-whatsloaded
190VBoxDrv_INST = $(INST_VBOXDRV)Contents/MacOS/
191VBoxDrv_SOURCES = \
192 $(VBOX_PATH_SUPPORT)/SUPDRVShared.c \
193 $(VBOX_PATH_SUPPORT)/$(BUILD_TARGET)/SUPDrv-$(BUILD_TARGET).cpp
194
195INSTALLS += VBoxDrv.kext
196VBoxDrv.kext_INST = $(INST_VBOXDRV)Contents/
197VBoxDrv.kext_SOURCES = \
198 $(PATH_TARGET)/Info.plist
199
200$(PATH_TARGET)/Info.plist: $(VBOX_PATH_SUPPORT)/darwin/Info.plist $(VBOX_VERSION_MK) | $(call DIRDEP,$(PATH_TARGET))
201 $(call MSG_L1,Generating $@)
202 $(xQUIET)$(RM) -f $@
203 $(xQUIET)$(SED) \
204 -e 's/@VBOX_VERSION_STRING@/$(VBOX_VERSION_STRING)/g' \
205 -e 's/@VBOX_VERSION_MAJOR@/$(VBOX_VERSION_MAJOR)/g' \
206 -e 's/@VBOX_VERSION_MINOR@/$(VBOX_VERSION_MINOR)/g' \
207 -e 's/@VBOX_VERSION_BUILD@/$(VBOX_VERSION_BUILD)/g' \
208 $< > $@
209
210INSTALLS += Scripts
211Scripts_INST = $(INST_DIST)
212Scripts_SOURCES = \
213 $(VBOX_PATH_SUPPORT)/darwin/load.sh
214
215endif
216
217
218#
219# VBoxDrv.sys - The OS/2 driver.
220#
221ifeq ($(BUILD_TARGET),os2)
222VBoxDrv_TEMPLATE = VBOXR0DRV
223VBoxDrv_DEFS = IN_RT_R0 IN_SUP_R0 USE_NEW_OS_INTERFACE
224VBoxDrv_INCS = $(VBOX_PATH_SUPPORT)
225#VBoxDrv_LDFLAGS = -s -t -v
226VBoxDrv_SOURCES = \
227 $(VBOX_PATH_SUPPORT)/os2/SUPDrvA-os2.asm \
228 $(VBOX_PATH_SUPPORT)/os2/SUPDrv-os2.def
229VBoxDrv_LIBS = \
230 $(TARGET_VBoxDrvLib) \
231 $(PATH_LIB)/RuntimeR0Drv$(VBOX_SUFF_LIB) \
232 $(VBOX_GCC_LIBGCC) \
233 end
234
235# temp hack to ensure that SUPDrvA-os2.asm is first in the link.
236LIBRARIES += VBoxDrvLib
237VBoxDrvLib_TEMPLATE = VBOXR0DRV
238VBoxDrvLib_NOINST = 1
239VBoxDrvLib_DEFS = IN_RT_R0 IN_SUP_R0 USE_NEW_OS_INTERFACE
240VBoxDrvLib_INCS = $(VBOX_PATH_SUPPORT) $(PATH_TARGET) $(PATH_ROOT)/src/VBox/Runtime/include
241VBoxDrvLib_SOURCES = \
242 $(VBOX_PATH_SUPPORT)/os2/SUPDrv-os2.cpp \
243 $(VBOX_PATH_SUPPORT)/SUPDRVShared.c
244endif
245
246
247#
248# Generate rules for exporting the linux sources.
249#
250define def_export_rule
251$(eval dst := $(word 1,$(subst =, ,$(pair))))
252$(eval src := $(word 2,$(subst =, ,$(pair))))
253$(PATH_BIN)/src/$(dst): $(src)
254 $$(call MSG_L1,Installing $$@)
255 $$(QUIET)$$(MKDIR) -p $$(@D)
256 $$(QUIET)$$(CP) $$< $$@
257
258symlinked/$(dst):
259 $$(call MSG_L1,Symlink $$@)
260 $$(QUIET)$$(MKDIR) -p $$(@D)
261 $$(QUIET)ln -sfn $(abspath $(src)) $$@
262
263endef
264# generate rules
265$(foreach pair,$(EXPORT_FILE_PAIRS),$(eval $(def_export_rule)))
266
267
268#
269# Rule for creating a symlinked setup.
270#
271symlinked: $(subst $(PATH_BIN)/src/,symlinked/, $(OTHERS))
272 $(ECHO) done
273
274
275include $(PATH_KBUILD)/subfooter.kmk
276
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