VirtualBox

source: vbox/trunk/src/VBox/HostDrivers/VBoxNetAdp/Makefile.kmk@ 23526

Last change on this file since 23526 was 23526, checked in by vboxsync, 15 years ago

HostDrivers/FreeBSD: Use the same method to build the kernel drivers as Linux.

To build the kernel drivers go into out/freebsd.{amd64,x86}/{release,debug}/bin/src
after the build and execute make. make load will load the kernel drivers.
The old way is only used for syntax checking and the resulting modules may not even load anymore.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 5.9 KB
Line 
1# $Id: Makefile.kmk 23526 2009-10-03 17:55:49Z vboxsync $
2## @file
3# Sub-Makefile for the Network Adapter Driver (VBoxNetAdp).
4#
5
6#
7# Copyright (C) 2009 Sun Microsystems, Inc.
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 (GPL) as published by the Free Software
13# Foundation, in version 2 as it comes in the "COPYING" file of the
14# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
15# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
16#
17# Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
18# Clara, CA 95054 USA or visit http://www.sun.com if you need
19# additional information or have any questions.
20#
21
22SUB_DEPTH = ../../../..
23include $(KBUILD_PATH)/subheader.kmk
24
25
26if1of ($(KBUILD_TARGET), solaris darwin linux freebsd)
27#
28# VBoxNetAdp - Virtual Network Adapter
29# Note! On Solaris the name has to be <= 8 chars long.
30#
31 ifdef VBOX_WITH_VBOXDRV
32SYSMODS += VBoxNetAdp
33VBoxNetAdp_TEMPLATE = VBOXR0DRV
34VBoxNetAdp_INST = $(INST_VBOXNETADP)$(if $(eq $(KBUILD_TARGET),darwin),Contents/MacOS/)
35VBoxNetAdp_NAME.solaris = vboxnet
36VBoxNetAdp_NAME.linux = vboxnetadp
37VBoxNetAdp_NAME.freebsd = vboxnetadp
38VBoxNetAdp_NOINST.linux = true
39VBoxNetAdp_DEPS.solaris += $(VBOX_SVN_REV_KMK)
40VBoxNetAdp_DEFS = IN_RT_R0 VBOX_SVN_REV=$(VBOX_SVN_REV) IN_SUP_STATIC
41VBoxNetAdp_DEFS.linux = KBUILD_MODNAME=KBUILD_STR\(vboxnetadp\) KBUILD_BASENAME=KBUILD_STR\(vboxnetadp\) MODULE
42VBoxNetAdp_LDFLAGS.darwin = -v -Wl,-whyload -Wl,-v -Wl,-whatsloaded
43VBoxNetAdp_LDFLAGS.solaris += -N misc/gld -N drv/vboxdrv
44VBoxNetAdp_INCS.linux := \
45 $(PATH_ROOT)/src/VBox/Runtime/r0drv/linux
46VBoxNetAdp_INCS = \
47 .
48VBoxNetAdp_SOURCES.darwin = \
49 darwin/VBoxNetAdp-darwin.cpp \
50 VBoxNetAdp.c
51VBoxNetAdp_SOURCES.solaris = \
52 solaris/VBoxNetAdp-solaris.c
53VBoxNetAdp_SOURCES.linux = \
54 linux/VBoxNetAdp-linux.c \
55 VBoxNetAdp.c
56VBoxNetAdp_SOURCES.freebsd = \
57 freebsd/VBoxNetAdp-freebsd.c \
58 VBoxNetAdp.c
59VBoxNetAdp_SOURCES =
60#VBoxNetAdp_SOURCES = \
61# VBoxNetAdp.c
62VBoxNetAdp_LIBS += \
63 $(PATH_LIB)/SUPR0IdcClient$(VBOX_SUFF_LIB)
64 endif
65endif
66
67#
68# Darwin extras.
69#
70ifeq ($(KBUILD_TARGET),darwin)
71INSTALLS += VBoxNetAdp.kext
72VBoxNetAdp.kext_INST = $(INST_VBOXNETADP)Contents/
73VBoxNetAdp.kext_SOURCES = \
74 $(PATH_VBoxNetAdp.kext)/Info.plist
75VBoxNetAdp.kext_CLEAN = \
76 $(PATH_VBoxNetAdp.kext)/Info.plist
77
78$$(PATH_VBoxNetAdp.kext)/Info.plist: $(PATH_SUB_CURRENT)/darwin/Info.plist $(VBOX_VERSION_MK) | $$(dir $$@)
79 $(call MSG_GENERATE,VBoxNetAdp,$@,$<)
80 $(xQUIET)$(RM) -f $@
81 $(xQUIET)$(SED) \
82 -e 's/@VBOX_VERSION_STRING@/$(VBOX_VERSION_STRING)/g' \
83 -e 's/@VBOX_VERSION_MAJOR@/$(VBOX_VERSION_MAJOR)/g' \
84 -e 's/@VBOX_VERSION_MINOR@/$(VBOX_VERSION_MINOR)/g' \
85 -e 's/@VBOX_VERSION_BUILD@/$(VBOX_VERSION_BUILD)/g' \
86 --output $@ \
87 $<
88
89INSTALLS.darwin += Scripts-darwin-adp
90Scripts-darwin-adp_INST = $(INST_DIST)
91Scripts-darwin-adp_SOURCES = \
92 darwin/loadnetadp.sh
93endif # darwin
94
95ifeq ($(KBUILD_TARGET),linux)
96 #
97 # Install source files for compliation on Linux.
98 # files_vboxnetadp defines VBOX_VBOXNETADP_SOURCES.
99 #
100 include $(PATH_SUB_CURRENT)/linux/files_vboxnetadp
101 INSTALLS += VBoxNetAdp-src VBoxNetAdp-sh
102 VBoxNetAdp-src_INST = bin/src/vboxnetadp/
103 VBoxNetAdp-src_MODE = a+r,u+w
104 VBoxNetAdp-src_SOURCES = $(subst ",,$(VBOX_VBOXNETADP_SOURCES)) #"
105 VBoxNetAdp-src_SOURCES+= \
106 $(if $(VBOX_OSE),,\
107 $(PATH_VBoxNetAdp-src)/dkms.conf) \
108 $(PATH_VBoxNetAdp-src)/Makefile
109 VBoxNetAdp-src_CLEAN = \
110 $(PATH_VBoxNetAdp-src)/dkms.conf \
111 $(PATH_VBoxNetAdp-src)/Makefile \
112 $(PATH_TARGET)/VBoxNetAdp-src-1.dep
113
114 VBoxNetAdp-sh_INST = bin/src/vboxnetadp/
115 VBoxNetAdp-sh_MODE = a+rx,u+w
116 VBoxNetAdp-sh_SOURCES = \
117 $(PATH_VBoxNetAdp-sh)/build_in_tmp \
118 $(if $(VBOX_OSE),,\
119 $(PATH_ROOT)/src/VBox/HostDrivers/linux/do_Module.symvers)
120 VBoxNetAdp-sh_CLEAN = $(PATH_VBoxNetAdp-sh)/build_in_tmp
121
122
123includedep $(PATH_TARGET)/VBoxNetAdp-src-1.dep
124$$(PATH_VBoxNetAdp-src)/Makefile: \
125 $(PATH_SUB_CURRENT)/linux/Makefile \
126 $$(if $$(eq $$(VBoxNetAdp/linux/Makefile_VBOX_HARDENED),$$(VBOX_WITH_HARDENING)),,FORCE) \
127 | $$(dir $$@)
128ifndef VBOX_WITH_HARDENING
129 $(QUIET)$(SED) -e "s;-DVBOX_WITH_HARDENING;;g" --output $@ $<
130else
131 $(QUIET)$(CP) -f $< $@
132endif
133 %$(QUIET2)$(RM) -f -- $(PATH_TARGET)/VBoxNetAdp-src-1.dep
134 %$(QUIET2)$(APPEND) '$(PATH_TARGET)/VBoxNetAdp-src-1.dep' 'VBoxNetAdp/linux/Makefile_VBOX_HARDENED=$(VBOX_WITH_HARDENING)'
135
136## Scripts needed for building the kernel modules
137
138$$(PATH_VBoxNetAdp-sh)/build_in_tmp: \
139 $(PATH_ROOT)/src/VBox/HostDrivers/linux/build_in_tmp \
140 $(VBOX_VERSION_STAMP) \
141 | $$(dir $$@)
142 $(call MSG_TOOL,Creating,,$@)
143 $(QUIET)$(SED) -e "s;_VERSION_;${VBOX_VERSION_STRING};g; s;_MODULE_;vboxnetadp;g" --output $@ $<
144 $(QUIET)chmod 0755 $@
145
146$$(PATH_VBoxNetAdp-src)/dkms.conf: \
147 $(PATH_SUB_CURRENT)/linux/dkms.conf \
148 $(VBOX_VERSION_STAMP) \
149 | $$(dir $$@)
150 $(call MSG_TOOL,Creating,,$@)
151 $(QUIET)$(SED) -e "s;_VERSION_;${VBOX_VERSION_STRING};g" --output $@ $<
152
153endif # linux
154
155ifeq ($(KBUILD_TARGET),freebsd)
156 #
157 # Install source files for compliation on FreeBSD.
158 # files_vboxnetadp defines VBOX_VBOXNETADP_SOURCES.
159 #
160 include $(PATH_SUB_CURRENT)/freebsd/files_vboxnetadp
161 INSTALLS += VBoxNetAdp-src
162 VBoxNetAdp-src_INST = bin/src/vboxnetadp/
163 VBoxNetAdp-src_MODE = a+r,u+w
164 VBoxNetAdp-src_SOURCES = $(subst ",,$(VBOX_VBOXNETADP_SOURCES)) #"
165 VBoxNetAdp-src_SOURCES+= \
166 $(PATH_VBoxNetAdp-src)/Makefile
167 VBoxNetAdp-src_CLEAN = \
168 $(PATH_VBoxNetAdp-src)/Makefile \
169
170$$(PATH_VBoxNetAdp-src)/Makefile: \
171 $(PATH_SUB_CURRENT)/freebsd/Makefile \
172 $$(if $$(eq $$(VBoxNetAdp/freebsd/Makefile_VBOX_HARDENED),$$(VBOX_WITH_HARDENING)),,FORCE) \
173 | $$(dir $$@)
174ifndef VBOX_WITH_HARDENING
175 $(QUIET)$(SED) -e "s;-DVBOX_WITH_HARDENING;;g" --output $@ $<
176else
177 $(QUIET)$(CP) -f $< $@
178endif
179
180endif # freebsd
181
182include $(KBUILD_PATH)/subfooter.kmk
183
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