Makefile.kmk revision fc9431d0d0cb8e19c7df04e077efdbe3ac173431
# $Id$
## @file
# Top-level makefile for the VirtualBox Guest Additions.
#
#
# Copyright (C) 2006-2010 Oracle Corporation
#
# This file is part of VirtualBox Open Source Edition (OSE), as
# available from http://www.virtualbox.org. This file is free software;
# you can redistribute it and/or modify it under the terms of the GNU
# General Public License (GPL) as published by the Free Software
# Foundation, in version 2 as it comes in the "COPYING" file of the
# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
#
SUB_DEPTH = ../../..
include $(KBUILD_PATH)/subheader.kmk
#
# Globals
#
VBOX_PATH_ADDITIONS_SRC := $(PATH_SUB_CURRENT)
#
# Cross building of the additions is generally done by remote building
# by means of smbfs, cifs, VBOX_ONLY_ADDITIONS=1 and setting KBUILD_TARGET
# and KBUILD_TARGET_ARCH to the desired target and architecture.
#
# Limited support for cross building the windows additions using wine
# is provided. There are a couple of issues with the approach (lack of
# signing, no VC++ 8 support, ++) that makes it unsuitable for releases.
#
#
# Note! VBOX_WITH_ADDITIONS is checked for by our parent makefile.
#
# Note! VBOX_WITH_X11_ADDITIONS is set in Config.kmk
#
# Note! The additions build box will set the VBOX_WITH_ADDITIONS_ISO.win.x86
# variables before invoking us from the root makefile.
#
# ==> All we have to worry about is what to do on the target we're on.
#
VBOX_WITH_ADDITIONS_ISO.$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH) = 1
# Include sub-makefiles.
include $(PATH_SUB_CURRENT)/common/Makefile.kmk
ifndef VBOX_ONLY_TESTSUITE
ifdef VBOX_WITH_X11_ADDITIONS
include $(PATH_SUB_CURRENT)/x11/Makefile.kmk
endif
ifeq ($(KBUILD_TARGET),freebsd)
include $(PATH_SUB_CURRENT)/freebsd/Makefile.kmk
endif
ifeq ($(KBUILD_TARGET),linux)
include $(PATH_SUB_CURRENT)/linux/Makefile.kmk
endif
#ifeq ($(KBUILD_TARGET),os2)
# include $(PATH_SUB_CURRENT)/os2/Makefile.kmk
#endif
ifeq ($(KBUILD_TARGET),solaris)
include $(PATH_SUB_CURRENT)/solaris/Makefile.kmk
endif
ifeq ($(KBUILD_TARGET),win)
include $(PATH_SUB_CURRENT)/WINNT/Makefile.kmk
endif
ifeq ($(KBUILD_TARGET),darwin)
include $(PATH_SUB_CURRENT)/darwin/Makefile.kmk
endif
ifeq ($(KBUILD_TARGET),linux)
INSTALLS += LnxAddIso-scripts
LnxAddIso-scripts_INST = bin/additions
LnxAddIso-scripts_MODE = a+rx,u+w
LnxAddIso-scripts_SOURCES = \
$(LnxAddIso-scripts_0_OUTDIR)/runasroot.sh \
$(LnxAddIso-scripts_0_OUTDIR)/autorun.sh
LnxAddIso-scripts_CLEAN = \
$(LnxAddIso-scripts_0_OUTDIR)/runasroot.sh \
$(LnxAddIso-scripts_0_OUTDIR)/autorun.sh
$$(LnxAddIso-scripts_0_OUTDIR)/runasroot.sh: \
$(PATH_SUB_CURRENT)/../Installer/linux/runasroot.sh \
$(PATH_SUB_CURRENT)/../Installer/linux/sh-utils.sh \
| $$(dir $$@)
$(QUIET)$(SED) \
-e '/#include sh-utils.sh/ {' \
-e "r $(PATH_ROOT)/src/VBox/Installer/linux/sh-utils.sh" \
-e 'd' \
-e '}' \
--output $@ \
$<
$$(LnxAddIso-scripts_0_OUTDIR)/autorun.sh: \
$(PATH_SUB_CURRENT)/linux/installer/autorun.sh \
$(PATH_SUB_CURRENT)/../Installer/linux/sh-utils.sh \
| $$(dir $$@)
$(QUIET)$(SED) \
-e '/#include sh-utils.sh/ {' \
-e "r $(PATH_ROOT)/src/VBox/Installer/linux/sh-utils.sh" \
-e 'd' \
-e '}' \
--output $@ \
$<
endif # KBUILD_TARGET == linux
ifeq ($(KBUILD_TARGET),win)
#
# Inf2Cat requires all the files referenced in the .inf file
# to be present in the directory, so we have to do this from here,
# since VBoxGuest.sys is being built from the common sources.
#
INSTALLS += VBoxGuest-inf
VBoxGuest-inf_INST = $(INST_ADDITIONS)
VBoxGuest-inf_MODE = a+r,u+w
VBoxGuest-inf_SOURCES = \
$(PATH_TARGET)/VBoxGuestCat.dir/VBoxGuest.inf
ifdef VBOX_SIGN_ADDITIONS
VBoxGuest-inf_SOURCES += \
$(PATH_TARGET)/VBoxGuestCat.dir/VBoxGuest.cat \
$(PATH_TARGET)/VBoxGuestCat.dir/VBoxGuest.sys \
$(PATH_TARGET)/VBoxGuestCat.dir/VBoxControl.exe \
$(PATH_TARGET)/VBoxGuestCat.dir/VBoxTray.exe
endif # signing
VBoxGuest-inf_CLEAN = $(VBoxGuest-inf_SOURCES)
VBoxGuest-inf_BLDDIRS = \
$(PATH_TARGET)/VBoxGuestCat.dir
$(PATH_TARGET)/VBoxGuestCat.dir/VBoxGuest.inf: $(PATH_SUB_CURRENT)/common/VBoxGuest/win/VBoxGuest.inf $(MAKEFILE_CURRENT) | $$(dir $$@)
$(call MSG_GENERATE,VBoxGuest-inf,$@,$<)
$(call VBOX_EDIT_INF_FN,$<,$@)
$(PATH_TARGET)/VBoxGuestCat.dir/VBoxGuest.sys: $$(TARGET_VBoxGuest) | $$(dir $$@)
$(INSTALL) -m 644 $< $(@D)
$(PATH_TARGET)/VBoxGuestCat.dir/VBoxControl.exe: $$(TARGET_VBoxControl) | $$(dir $$@)
$(INSTALL) -m 755 $< $(@D)
$(PATH_TARGET)/VBoxGuestCat.dir/VBoxTray.exe: $$(TARGET_VBoxTray) | $$(dir $$@)
$(INSTALL) -m 755 $< $(@D)
$(PATH_TARGET)/VBoxGuestCat.dir/VBoxGuest.cat: \
$(PATH_TARGET)/VBoxGuestCat.dir/VBoxGuest.inf \
$(PATH_TARGET)/VBoxGuestCat.dir/VBoxGuest.sys \
$(PATH_TARGET)/VBoxGuestCat.dir/VBoxControl.exe \
$(PATH_TARGET)/VBoxGuestCat.dir/VBoxTray.exe
$(call MSG_TOOL,Inf2Cat,VBoxGuest-inf,$@,$<)
$(call VBOX_MAKE_CAT_FN, $(@D),$@)
endif # KBUILD_TARGET == win
# The packing target rule, but only if we're on the local build box.
# (VBOX_WITHOUT_ADDITIONS_ISO is used by the additions build box, see the root makefile.)
ifndef VBOX_WITHOUT_ADDITIONS_ISO
PACKING += $(PATH_BIN)/additions/VBoxGuestAdditions.iso
endif
endif # !VBOX_ONLY_TESTSUITE
include $(KBUILD_PATH)/subfooter.kmk
#
# File per-OS/arch file specs for the additions iso (alphabetical order).
#
# We test for the VBOX_WITH_ADDITIONS_ISO.os.arch so that we don't have to
# do the $(if )'ing down where the GUESTADDITIONS_FILESPEC.os.arch down
# in the dependency list and mkisofs command.
#
endif
endif
32Bit/OS2/libc063.dll=$(VBOX_PATH_ADDITIONS_SRC)/os2/Bin/libc063.dll \
32Bit/OS2/readme.txt=$(VBOX_PATH_ADDITIONS_SRC)/os2/Bin/readme.txt \
else ifdef VBOX_WITH_OS2_ADDITIONS_BIN
32Bit/OS2/VBoxGuest.sys=$(VBOX_PATH_ADDITIONS_SRC)/os2/Bin/VBoxGuest.sys \
32Bit/OS2/VBoxService.exe=$(VBOX_PATH_ADDITIONS_SRC)/os2/Bin/VBoxService.exe \
32Bit/OS2/gengradd.dll=$(VBOX_PATH_ADDITIONS_SRC)/os2/Bin/gengradd.dll \
32Bit/OS2/libc063.dll=$(VBOX_PATH_ADDITIONS_SRC)/os2/Bin/libc063.dll \
32Bit/OS2/readme.txt=$(VBOX_PATH_ADDITIONS_SRC)/os2/Bin/readme.txt \
32Bit/OS2/vboxmouse.sys=$(VBOX_PATH_ADDITIONS_SRC)/os2/Bin/vboxmouse.sys
endif
ifdef VBOX_WITH_COMBINED_LINUX_GUEST_PACKAGE
VBOX_LNX_ADD_AMD64_RUN_PKG=VBoxLinuxAdditions.run
else
VBOX_LNX_ADD_AMD64_RUN_PKG=VBoxLinuxAdditions-amd64.run
endif
$(VBOX_LNX_ADD_AMD64_RUN_PKG)=$(VBOX_PATH_ADDITIONS.linux.amd64)/VBoxLinuxAdditions.run
endif
## @todo 64-bit additions: rename this package, update docs (?) and tests (?). create wrapper? create gnome/kde autorun app (xplatform) ?
ifdef VBOX_WITH_COMBINED_LINUX_GUEST_PACKAGE
VBOX_LNX_ADD_X86_RUN_PKG=VBoxLinuxAdditions.run
else
VBOX_LNX_ADD_X86_RUN_PKG=VBoxLinuxAdditions-x86.run
endif
$(VBOX_LNX_ADD_X86_RUN_PKG)=$(VBOX_PATH_ADDITIONS.linux.x86)/VBoxLinuxAdditions.run \
endif
endif
endif
ifdef VBOX_WITH_COMBINED_SOLARIS_GUEST_PACKAGE
# Build combined 32bit and 64bit solaris additions, not just a single arch.
# This assumes that the 32bit build directory contains the combined additions
# for 32bit and 64bit solaris. This just modifies variables set above.
endif
endif
AUTORUN.INF=$(VBOX_PATH_ADDITIONS_SRC)/WINNT/Installer/ISO/AUTORUN.INF \
32Bit/Readme.txt=$(VBOX_PATH_ADDITIONS_SRC)/WINNT/Installer/ISO/ReadmeDrivers.txt \
64Bit/Readme.txt=$(VBOX_PATH_ADDITIONS_SRC)/WINNT/Installer/ISO/ReadmeDrivers.txt
endif # win.x86
# or dmg?
endif
endif
#
# Build the Guest Additions ISO image.
#
ifndef VBOX_WITHOUT_ADDITIONS_ISO
$(VBOX_PATH_ADDITIONS_ISO)/VBoxGuestAdditions.iso: \
$(filter-out %=deleteme=,\
$(subst =,=deleteme= ,\
)\
) \
$(VBOX_SVN_REV_KMK) \
$(VBOX_PATH_ADDITIONS_SRC)/Makefile.kmk
$(call MSG_TOOL,mkisofs,,$@)
$(QUIET)$(MKDIR) -p $(@D)
@# use iso-level 3 which is the most ISO conforming level with least restrictions; iso-level 4 maps to iso-level 2
@# with some extra restrictions removal (not conforming to ISO9660) which some platforms like Solaris 10 does not like.
$(VBOX_MKISOFS) -rational-rock -joliet -iso-level 3 \
-volid "VBOXADDITIONS_$(VBOX_VERSION_STRING)_$(VBOX_SVN_REV)" -l -graft-points -o $@ \
# Alias for creating the iso.
.PHONY: additions-iso
additions-iso: $(VBOX_PATH_ADDITIONS_ISO)/VBoxGuestAdditions.iso
endif