VirtualBox

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

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

Darwin hacking.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 8.5 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
36endif
37
38
39#
40# Include sub-makefile(s).
41#
42include $(VBOX_PATH_SUPPORT)/testcase/Makefile
43
44
45ifeq ($(BUILD_TARGET),linux)
46## @todo change this to use a INSTALLS target.
47EXPORT_FILE_PAIRS = \
48 include/iprt/alloc.h=$(PATH_ROOT)/include/iprt/alloc.h \
49 include/iprt/asm.h=$(PATH_ROOT)/include/iprt/asm.h \
50 include/iprt/assert.h=$(PATH_ROOT)/include/iprt/assert.h \
51 include/iprt/cdefs.h=$(PATH_ROOT)/include/iprt/cdefs.h \
52 include/iprt/err.h=$(PATH_ROOT)/include/iprt/err.h \
53 include/iprt/heap.h=$(PATH_ROOT)/include/iprt/heap.h \
54 include/iprt/initterm.h=$(PATH_ROOT)/include/iprt/initterm.h \
55 include/iprt/log.h=$(PATH_ROOT)/include/iprt/log.h \
56 include/iprt/mem.h=$(PATH_ROOT)/include/iprt/mem.h \
57 include/iprt/param.h=$(PATH_ROOT)/include/iprt/param.h \
58 include/iprt/process.h=$(PATH_ROOT)/include/iprt/process.h \
59 include/iprt/semaphore.h=$(PATH_ROOT)/include/iprt/semaphore.h \
60 include/iprt/spinlock.h=$(PATH_ROOT)/include/iprt/spinlock.h \
61 include/iprt/stdarg.h=$(PATH_ROOT)/include/iprt/stdarg.h \
62 include/iprt/stdint.h=$(PATH_ROOT)/include/iprt/stdint.h \
63 include/iprt/string.h=$(PATH_ROOT)/include/iprt/string.h \
64 include/iprt/thread.h=$(PATH_ROOT)/include/iprt/thread.h \
65 include/iprt/types.h=$(PATH_ROOT)/include/iprt/types.h \
66 include/iprt/avl.h=$(PATH_ROOT)/include/iprt/avl.h \
67 include/VBox/cdefs.h=$(PATH_ROOT)/include/VBox/cdefs.h \
68 include/VBox/log.h=$(PATH_ROOT)/include/VBox/log.h \
69 include/VBox/sup.h=$(PATH_ROOT)/include/VBox/sup.h \
70 include/VBox/types.h=$(PATH_ROOT)/include/VBox/types.h \
71 include/internal/initterm.h=$(PATH_ROOT)/src/VBox/Runtime/include/internal/initterm.h \
72 include/internal/thread.h=$(PATH_ROOT)/src/VBox/Runtime/include/internal/thread.h \
73 linux/SUPDrv-linux.c=$(VBOX_PATH_SUPPORT)/linux/SUPDrv-linux.c \
74 Makefile=$(VBOX_PATH_SUPPORT)/linux/Makefile \
75 alloc/heapsimple.c=$(PATH_ROOT)/src/VBox/Runtime/alloc/heapsimple.cpp \
76 r0drv/alloc-r0drv.c=$(PATH_ROOT)/src/VBox/Runtime/r0drv/alloc-r0drv.cpp \
77 r0drv/alloc-r0drv.h=$(PATH_ROOT)/src/VBox/Runtime/r0drv/alloc-r0drv.h \
78 r0drv/initterm-r0drv.c=$(PATH_ROOT)/src/VBox/Runtime/r0drv/initterm-r0drv.cpp \
79 r0drv/linux/alloc-r0drv-linux.c=$(PATH_ROOT)/src/VBox/Runtime/r0drv/linux/alloc-r0drv-linux.c \
80 r0drv/linux/initterm-r0drv-linux.c=$(PATH_ROOT)/src/VBox/Runtime/r0drv/linux/initterm-r0drv-linux.c \
81 r0drv/linux/process-r0drv-linux.c=$(PATH_ROOT)/src/VBox/Runtime/r0drv/linux/process-r0drv-linux.c \
82 r0drv/linux/semaphore-r0drv-linux.c=$(PATH_ROOT)/src/VBox/Runtime/r0drv/linux/semaphore-r0drv-linux.c \
83 r0drv/linux/spinlock-r0drv-linux.c=$(PATH_ROOT)/src/VBox/Runtime/r0drv/linux/spinlock-r0drv-linux.c \
84 r0drv/linux/string.h=$(PATH_ROOT)/src/VBox/Runtime/r0drv/linux/string.h \
85 r0drv/linux/thread-r0drv-linux.c=$(PATH_ROOT)/src/VBox/Runtime/r0drv/linux/thread-r0drv-linux.c \
86 r0drv/linux/the-linux-kernel.h=$(PATH_ROOT)/src/VBox/Runtime/r0drv/linux/the-linux-kernel.h \
87 SUPDRV.h=$(VBOX_PATH_SUPPORT)/SUPDRV.h \
88 SUPDRVIOC.h=$(VBOX_PATH_SUPPORT)/SUPDRVIOC.h \
89 SUPDRVShared.c=$(VBOX_PATH_SUPPORT)/SUPDRVShared.c
90OTHERS := $(foreach pair,$(EXPORT_FILE_PAIRS),$(PATH_BIN)/src/$(firstword $(subst =, ,$(pair))))
91OTHER_CLEAN = $(OTHERS)
92endif # real linux
93
94
95
96#
97# The Ring-3 Support Library (this is linked into the IPRT dll, VBoxRT).
98#
99ifneq ($(filter l4%,$(BUILD_TARGET) $(BUILD_TARGET_SUB)),)
100# L4 has trouble with -pedantic. It also make trouble when inlining is not enabled.
101SUPR3_TEMPLATE = VBOXR3NP
102else
103SUPR3_TEMPLATE = VBOXR3
104endif
105SUPR3_DEFS = IN_SUP_R3 IN_RT_R3
106SUPR3_INCS = $(VBOX_PATH_SUPPORT)
107SUPR3_INCS.l4 = $(L4_INCDIR)
108ifneq ($(BUILD_TARGET),win) ## @todo rename win32 -> win!
109SUPR3_SOURCES = \
110 $(VBOX_PATH_SUPPORT)/SUPLib.cpp \
111 $(VBOX_PATH_SUPPORT)/$(BUILD_TARGET)/SUPLib-$(BUILD_TARGET).cpp
112else
113SUPR3_SOURCES = \
114 $(VBOX_PATH_SUPPORT)/SUPLib.cpp \
115 $(VBOX_PATH_SUPPORT)/win32/SUPLib-win32.cpp
116endif
117
118#
119# SUPR0 - The Ring-0 Import / Thunk library.
120#
121SUPR0_TEMPLATE = VBOXR0
122ifeq ($(VBOX_LDR_FMT),pe)
123SUPR0_SOURCES += $(VBOX_PATH_SUPPORT)/SUPR0.def
124endif
125ifeq ($(VBOX_LDR_FMT),lx)
126SUPR0_SOURCES += $(PATH_TARGET)/SUPR0.def
127$(PATH_TARGET)/SUPR0.def: $(VBOX_PATH_SUPPORT)/SUPR0.def | $(call DIRDEP,$(PATH_TARGET))
128 $(SED) -e 's/^[ \t][ \t]*\([gA-Z]\)/ _\1/' -e 's/[ \t]DATA[ \t]*/ /' $< > $@.tmp
129 $(MV) -f $@.tmp $@
130endif
131
132
133#
134# VBoxDrv.sys - The Windows driver.
135#
136ifeq ($(BUILD_TARGET),win)
137VBoxDrv_TEMPLATE = VBOXR0DRV
138VBoxDrv_DEFS = IN_RT_R0 IN_SUP_R0
139VBoxDrv_SDKS = W2K3DDK WINPSDKINCS
140VBoxDrv_INCS = $(VBOX_PATH_SUPPORT)
141VBoxDrv_SOURCES = \
142 $(VBOX_PATH_SUPPORT)/SUPDRVShared.c
143VBoxDrv_SOURCES.x86 = \
144 $(VBOX_PATH_SUPPORT)/win32/SUPDrv-win32.cpp \
145 $(VBOX_PATH_SUPPORT)/win32/SUPDrvA-win32.asm
146VBoxDrv_SOURCES.amd64 = \
147 $(VBOX_PATH_SUPPORT)/win64/SUPDrv-win64.cpp \
148 $(VBOX_PATH_SUPPORT)/win64/SUPDrvA-win64.asm
149VBoxDrv_LDFLAGS.x86 = -Entry:DriverEntry@8
150VBoxDrv_LDFLAGS.amd64 = -Entry:DriverEntry
151VBoxDrv_LIBS = \
152 $(PATH_SDK_W2K3DDK_LIB)/ntoskrnl.lib \
153 $(PATH_SDK_W2K3DDK_LIB)/hal.lib \
154 $(PATH_LIB)/RuntimeR0Drv$(VBOX_SUFF_LIB)
155endif
156
157
158#
159# vboxdrv.ko - The Linux Kernel Module.
160#
161ifeq ($(BUILD_TARGET),linux)
162vboxdrv_TEMPLATE = VBOXR0DRV
163vboxdrv_DEFS = KBUILD_MODNAME=KBUILD_STR\(vboxdrv\) KBUILD_BASENAME=KBUILD_STR\(vboxdrv\) MODULE IN_RT_R0 IN_SUP_R0 CONFIG_VBOXDRV_AS_MISC
164vboxdrv_INCS = $(VBOX_PATH_SUPPORT)
165vboxdrv_LIBS = $(PATH_LIB)/RuntimeR0Drv$(VBOX_SUFF_LIB)
166vboxdrv_LIBS.debug = $(vboxdrv_LIBS) $(VBOX_GCC_LIBGCC)
167vboxdrv_SOURCES = \
168 $(VBOX_PATH_SUPPORT)/$(BUILD_TARGET)/SUPDrv-$(BUILD_TARGET).c \
169 $(VBOX_PATH_SUPPORT)/SUPDRVShared.c
170ifndef VBOX_LINUX_VERSION_2_4
171vboxdrv_SOURCES += \
172 $(VBOX_PATH_SUPPORT)/$(BUILD_TARGET)/SUPDrv-$(BUILD_TARGET).mod.c
173endif
174endif # real linux
175
176
177#
178# VBoxDrv.kext - The Darwin Kernel Extension.
179#
180ifeq ($(BUILD_TARGET),darwin)
181VBoxDrv_TEMPLATE = VBOXR0DRV
182VBoxDrv_DEFS = IN_RT_R0 IN_SUP_R0 USE_NEW_OS_INTERFACE
183VBoxDrv_INCS = $(VBOX_PATH_SUPPORT)
184VBoxDrv_LIBS = $(PATH_LIB)/RuntimeR0Drv$(VBOX_SUFF_LIB)
185VBoxDrv_LDFLAGS = -v -Wl,-whyload -Wl,-v -Wl,-whatsloaded
186VBoxDrv_INST = $(INST_VBOXDRV)Contents/MacOS/
187VBoxDrv_SOURCES = \
188 $(VBOX_PATH_SUPPORT)/SUPDRVShared.c \
189 $(VBOX_PATH_SUPPORT)/$(BUILD_TARGET)/SUPDrv-$(BUILD_TARGET).cpp
190
191INSTALLS += VBoxDrv.kext
192VBoxDrv.kext_INST = $(INST_VBOXDRV)Contents/
193VBoxDrv.kext_SOURCES = \
194 $(PATH_TARGET)/Info.plist
195
196$(PATH_TARGET)/Info.plist: $(VBOX_PATH_SUPPORT)/darwin/Info.plist $(VBOX_VERSION_MK) | $(call DIRDEP,$(PATH_TARGET))
197 $(call MSG_L1,Generating $@)
198 $(xQUIET)$(RM) -f $@
199 $(xQUIET)$(SED) \
200 -e 's/@VBOX_VERSION_MAJOR@/$(VBOX_VERSION_MAJOR)/g' \
201 -e 's/@VBOX_VERSION_MINOR@/$(VBOX_VERSION_MINOR)/g' \
202 -e 's/@VBOX_VERSION_BUILD@/$(VBOX_VERSION_BUILD)/g' \
203 $< > $@
204
205INSTALLS += Scripts
206Scripts_INST = $(INST_DIST)
207Scripts_SOURCES = \
208 $(VBOX_PATH_SUPPORT)/darwin/load.sh
209
210endif
211
212
213#
214# Generate rules for exporting the linux sources.
215#
216define def_export_rule
217$(eval dst := $(word 1,$(subst =, ,$(pair))))
218$(eval src := $(word 2,$(subst =, ,$(pair))))
219$(PATH_BIN)/src/$(dst): $(src)
220 $$(call MSG_L1,Installing $$@)
221 $$(QUIET)$$(MKDIR) -p $$(@D)
222 $$(QUIET)$$(CP) $$< $$@
223
224symlinked/$(dst):
225 $$(call MSG_L1,Symlink $$@)
226 $$(QUIET)$$(MKDIR) -p $$(@D)
227 $$(QUIET)ln -sfn $(abspath $(src)) $$@
228
229endef
230# generate rules
231$(foreach pair,$(EXPORT_FILE_PAIRS),$(eval $(def_export_rule)))
232
233
234#
235# Rule for creating a symlinked setup.
236#
237symlinked: $(subst $(PATH_BIN)/src/,symlinked/, $(OTHERS))
238 $(ECHO) done
239
240
241include $(PATH_KBUILD)/subfooter.kmk
242
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