VirtualBox

source: vbox/trunk/src/VBox/HostDrivers/Support/Makefile.kmk@ 2478

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

[Mm]akefile -> Makefile.kmk

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