VirtualBox

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

Last change on this file since 2689 was 2689, checked in by vboxsync, 17 years ago

A simplified approach.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 6.8 KB
Line 
1# $Id: Makefile.kmk 2689 2007-05-17 03:07:32Z 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
40INSTALLS.linux = vboxmod-bin vboxmod-sh
41
42#
43# Include sub-makefile(s).
44#
45include $(PATH_SUB_CURRENT)/testcase/Makefile.kmk
46
47#
48# Populate FILES_VBOXDRV_NOBIN and FILES_VBOXDRV_BIN
49#
50include $(PATH_SUB_CURRENT)/linux/files_vboxdrv
51
52vboxmod-bin_INST = bin/src/
53vboxmod-bin_MODE = a+r,u+w
54vboxmod-bin_SOURCES = $(subst ",,$(FILES_VBOXDRV_NOBIN)) #"
55
56vboxmod-sh_INST = bin/src/
57vboxmod-sh_MODE = a+rx,u+w
58vboxmod-sh_SOURCES = $(subst ",,$(FILES_VBOXDRV_BIN)) #"
59
60#
61# The Ring-3 Support Library (this is linked into the IPRT dll, VBoxRT).
62#
63ifneq ($(filter l4%,$(BUILD_TARGET) $(BUILD_TARGET_SUB)),)
64# L4 has trouble with -pedantic. It also make trouble when inlining is not enabled.
65SUPR3_TEMPLATE = VBOXR3NP
66else
67SUPR3_TEMPLATE = VBOXR3
68endif
69SUPR3_DEFS = IN_SUP_R3 IN_RT_R3
70SUPR3_INCS := $(PATH_SUB_CURRENT)
71SUPR3_INCS.l4 = $(L4_INCDIR)
72ifneq ($(BUILD_TARGET),win) ## @todo rename win32 -> win!
73SUPR3_SOURCES = \
74 SUPLib.cpp \
75 $(BUILD_TARGET)/SUPLib-$(BUILD_TARGET).cpp
76else
77SUPR3_SOURCES = \
78 SUPLib.cpp \
79 win32/SUPLib-win32.cpp
80endif
81
82#
83# SUPR0 - The Ring-0 Import / Thunk library.
84#
85SUPR0_TEMPLATE = VBOXR0
86ifeq ($(VBOX_LDR_FMT),pe)
87SUPR0_SOURCES += SUPR0.def
88endif
89ifeq ($(VBOX_LDR_FMT),lx)
90SUPR0_SOURCES += $(PATH_TARGET)/SUPR0.def
91$(PATH_TARGET)/SUPR0.def: $(PATH_SUB_CURRENT)/SUPR0.def | $(call DIRDEP,$(PATH_TARGET))
92 $(SED) -e 's/^[ \t][ \t]*\([gA-Z]\)/ _\1/' -e 's/[ \t]DATA[ \t]*/ /' $< > $@.tmp
93 $(MV) -f $@.tmp $@
94endif
95
96
97#
98# VBoxDrv.sys - The Windows driver.
99#
100ifeq ($(BUILD_TARGET),win)
101VBoxDrv_TEMPLATE = VBOXR0DRV
102VBoxDrv_DEFS = IN_RT_R0 IN_SUP_R0
103VBoxDrv_SDKS = W2K3DDK WINPSDKINCS
104VBoxDrv_INCS := $(PATH_SUB_CURRENT)
105VBoxDrv_SOURCES = \
106 SUPDRVShared.c
107VBoxDrv_SOURCES.x86 = \
108 win32/SUPDrv-win32.cpp \
109 win32/SUPDrvA-win32.asm
110VBoxDrv_SOURCES.amd64 = \
111 win64/SUPDrv-win64.cpp \
112 win64/SUPDrvA-win64.asm
113VBoxDrv_LDFLAGS.x86 = -Entry:DriverEntry@8
114VBoxDrv_LDFLAGS.amd64 = -Entry:DriverEntry
115VBoxDrv_LIBS = \
116 $(PATH_SDK_W2K3DDK_LIB)/ntoskrnl.lib \
117 $(PATH_SDK_W2K3DDK_LIB)/hal.lib \
118 $(PATH_LIB)/RuntimeR0Drv$(VBOX_SUFF_LIB)
119
120
121INSTALLS += VBoxDrv-inf
122VBoxDrv-inf_INST = $(INST_BIN)
123VBoxDrv-inf_MODE = a+r,u+w
124VBoxDrv-inf_SOURCES = \
125 $(PATH_TARGET)/VBoxDrvCat.dir/VBoxDrv.inf
126VBoxDrv-inf_CLEAN = \
127 $(PATH_TARGET)/VBoxDrvCat.dir/VBoxDrv.inf
128VBoxDrv-inf_BLDDIRS = $(PATH_TARGET)/VBoxDrvCat.dir
129
130$(PATH_TARGET)/VBoxDrvCat.dir/VBoxDrv.inf: $(PATH_SUB_CURRENT)/win32/VBoxDrv.inf $(MAKEFILE_CURRENT) | $$(call DIRDEP,$$(@D))
131 $(call MSG_GENERATE,VBoxDrv-inf,$@,$<)
132 $(call VBOX_EDIT_INF_FN,$<,$@)
133
134 ifdef VBOX_SIGNING_MODE
135VBoxDrv-inf_SOURCES += \
136 $(PATH_TARGET)/VBoxDrvCat.dir/VBoxDrv.cat
137VBoxDrv-inf_CLEAN += \
138 $(PATH_TARGET)/VBoxDrvCat.dir/VBoxDrv.cat \
139 $(PATH_TARGET)/VBoxDrvCat.dir/VBoxDrv.sys
140
141$(PATH_TARGET)/VBoxDrvCat.dir/VBoxDrv.cat: $(PATH_TARGET)/VBoxDrvCat.dir/VBoxDrv.inf $$(TARGET_VBoxDrv)
142 $(call MSG_TOOL,Inf2Cat,VBoxDrv-inf,$@,$<)
143 $(INSTALL) -m 644 $(TARGET_VBoxDrv) $(@D)
144 $(call VBOX_MAKE_CAT_FN, $(@D),$@)
145 endif # signing
146endif # win
147
148
149#
150# vboxdrv.ko - The Linux Kernel Module.
151#
152ifeq ($(BUILD_TARGET),linux)
153vboxdrv_TEMPLATE = VBOXR0DRV
154vboxdrv_DEFS = KBUILD_MODNAME=KBUILD_STR\(vboxdrv\) KBUILD_BASENAME=KBUILD_STR\(vboxdrv\) MODULE IN_RT_R0 IN_SUP_R0 CONFIG_VBOXDRV_AS_MISC
155vboxdrv_INCS := $(PATH_SUB_CURRENT)
156vboxdrv_LIBS = $(PATH_LIB)/RuntimeR0Drv$(VBOX_SUFF_LIB)
157vboxdrv_LIBS.debug = $(vboxdrv_LIBS) $(VBOX_GCC_LIBGCC)
158vboxdrv_SOURCES = \
159 $(BUILD_TARGET)/SUPDrv-$(BUILD_TARGET).c \
160 SUPDRVShared.c
161ifndef VBOX_LINUX_VERSION_2_4
162vboxdrv_SOURCES += \
163 $(BUILD_TARGET)/SUPDrv-$(BUILD_TARGET).mod.c
164endif
165endif # real linux
166
167
168#
169# VBoxDrv.kext - The Darwin Kernel Extension.
170#
171ifeq ($(BUILD_TARGET),darwin)
172VBoxDrv_TEMPLATE = VBOXR0DRV
173VBoxDrv_DEFS = IN_RT_R0 IN_SUP_R0 USE_NEW_OS_INTERFACE
174VBoxDrv_DEFS += DEBUG_DARWIN_GIP
175VBoxDrv_INCS := $(PATH_SUB_CURRENT)
176VBoxDrv_LIBS = $(PATH_LIB)/RuntimeR0Drv$(VBOX_SUFF_LIB)
177VBoxDrv_LDFLAGS = -v -Wl,-whyload -Wl,-v -Wl,-whatsloaded
178VBoxDrv_INST = $(INST_VBOXDRV)Contents/MacOS/
179VBoxDrv_SOURCES = \
180 SUPDRVShared.c \
181 $(BUILD_TARGET)/SUPDrv-$(BUILD_TARGET).cpp
182
183INSTALLS += VBoxDrv.kext
184VBoxDrv.kext_INST = $(INST_VBOXDRV)Contents/
185VBoxDrv.kext_SOURCES = \
186 $(PATH_TARGET)/Info.plist
187
188$(PATH_TARGET)/Info.plist: $(PATH_SUB_CURRENT)/darwin/Info.plist $(VBOX_VERSION_MK) | $(call DIRDEP,$(PATH_TARGET))
189 $(call MSG_GENERATE,VBoxDrv,$@,$<)
190 $(xQUIET)$(RM) -f $@
191 $(xQUIET)$(SED) \
192 -e 's/@VBOX_VERSION_STRING@/$(VBOX_VERSION_STRING)/g' \
193 -e 's/@VBOX_VERSION_MAJOR@/$(VBOX_VERSION_MAJOR)/g' \
194 -e 's/@VBOX_VERSION_MINOR@/$(VBOX_VERSION_MINOR)/g' \
195 -e 's/@VBOX_VERSION_BUILD@/$(VBOX_VERSION_BUILD)/g' \
196 $< > $@
197
198INSTALLS += Scripts
199Scripts_INST = $(INST_DIST)
200Scripts_SOURCES = \
201 darwin/load.sh
202
203endif
204
205
206#
207# VBoxDrv.sys - The OS/2 driver.
208#
209ifeq ($(BUILD_TARGET),os2)
210VBoxDrv_TEMPLATE = VBOXR0DRV
211VBoxDrv_DEFS = IN_RT_R0 IN_SUP_R0 USE_NEW_OS_INTERFACE
212VBoxDrv_INCS := $(PATH_SUB_CURRENT)
213#VBoxDrv_LDFLAGS = -s -t -v
214VBoxDrv_SOURCES = \
215 os2/SUPDrvA-os2.asm \
216 os2/SUPDrv-os2.def
217VBoxDrv_LIBS = \
218 $(TARGET_VBoxDrvLib) \
219 $(PATH_LIB)/RuntimeR0Drv$(VBOX_SUFF_LIB) \
220 $(VBOX_GCC_LIBGCC) \
221 end
222
223# temp hack to ensure that SUPDrvA-os2.asm is first in the link.
224LIBRARIES += VBoxDrvLib
225VBoxDrvLib_TEMPLATE = VBOXR0DRV
226VBoxDrvLib_NOINST = 1
227VBoxDrvLib_DEFS = IN_RT_R0 IN_SUP_R0 USE_NEW_OS_INTERFACE
228VBoxDrvLib_INCS := \
229 $(PATH_SUB_CURRENT) \
230 $(PATH_TARGET) \
231 $(PATH_ROOT)/src/VBox/Runtime/include
232VBoxDrvLib_SOURCES = \
233 os2/SUPDrv-os2.cpp \
234 SUPDRVShared.c
235endif
236
237include $(PATH_KBUILD)/subfooter.kmk
238
Note: See TracBrowser for help on using the repository browser.

© 2023 Oracle
ContactPrivacy policyTerms of Use