Makefile.kmk revision 344115a50dfcaf97123d38b056161195a7e4e48c
# $Id$
## @file
# Sub-Makefile for the IPRT (IPRT).
#
#
# Copyright (C) 2006-2011 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.
#
# The contents of this file may alternatively be used under the terms
# of the Common Development and Distribution License Version 1.0
# (CDDL) only, as it comes in the "COPYING.CDDL" file of the
# VirtualBox OSE distribution, in which case the provisions of the
# CDDL are applicable instead of those of the GPL.
#
# You may elect to license modified versions of this file under the
# terms and conditions of either the GPL or the CDDL or both.
#
SUB_DEPTH = ../../..
include $(KBUILD_PATH)/subheader.kmk
ifdef VBOX_ONLY_ADDITIONS
#
# Only build the additions, sort out the legacy names first.
#
LIBRARIES += RuntimeGuestR3 RuntimeGuestR3Shared RuntimeGuestR3Mini
LIBRARIES.win.amd64 += RuntimeGuestR3-x86 RuntimeGuestR3Shared-x86
ifdef VBOX_WITH_ADDITION_DRIVERS
LIBRARIES += RuntimeGuestR0
#LIBRARIES.os2 += RuntimeGuestR0OS2Warp3
LIBRARIES.win.x86 += RuntimeGuestR0NT4
endif
else ifdef VBOX_ONLY_TESTSUITE
#
# Only build the testsuite.
#
LIBRARIES += RuntimeGuestR3 RuntimeGuestR3Shared RuntimeR3 RuntimeR0
LIBRARIES.solaris += RuntimeR0Stub
LIBRARIES.win += RuntimeR0Stub
else ifdef VBOX_ONLY_DOCS
#
# Build docs only - need just regular R3 runtime.
#
LIBRARIES += RuntimeR3
DLLS += VBoxRT
else ifdef VBOX_ONLY_EXTPACKS_USE_IMPLIBS
#
# Build docs only - need just regular R3 runtime.
#
LIBRARIES += RuntimeBldProg
LIBRARIES.solaris += RuntimeR0Stub RuntimeRCStub
LIBRARIES.win += RuntimeR0Stub RuntimeRCStub
include $(PATH_SUB_CURRENT)/tools/Makefile.kmk
else # !VBOX_ONLY_ADDITIONS && !VBOX_ONLY_TESTSUITE && !VBOX_ONLY_DOCS
#
# Normal build.
#
ifndef VBOX_ONLY_EXTPACKS
include $(PATH_SUB_CURRENT)/testcase/Makefile.kmk
endif
include $(PATH_SUB_CURRENT)/tools/Makefile.kmk
BLDPROGS += uniread
LIBRARIES += RuntimeR3 RuntimeBldProg RuntimeR0 RuntimeEFCPP RuntimeR3NoCRTGCC
LIBRARIES.solaris += RuntimeR0Stub
LIBRARIES.win += RuntimeR0Stub
ifdef VBOX_WITH_RAW_MODE
LIBRARIES += RuntimeRC
LIBRARIES.win += RuntimeRCStub
endif
ifdef VBOX_WITH_VBOXDRV
LIBRARIES += RuntimeR0Drv
endif
ifdef VBOX_WITH_ADDITIONS
LIBRARIES += RuntimeGuestR3 RuntimeGuestR3Shared RuntimeGuestR3Mini
LIBRARIES.win.amd64 += RuntimeGuestR3-x86 RuntimeGuestR3Shared-x86
ifdef VBOX_WITH_ADDITION_DRIVERS
LIBRARIES += RuntimeGuestR0
endif
#LIBRARIES.os2 += RuntimeGuestR0OS2Warp3
LIBRARIES.win.x86 += RuntimeGuestR0NT4
endif # VBOX_WITH_ADDITIONS
LIBRARIES.l4 += RuntimeR3L4 RuntimeLnxHostR3
DLLS += VBoxRT
endif
# Always build the ntdll import libraries on windows.
LIBRARIES.win += RuntimeR3NtDll-x86
if1of (amd64, $(KBUILD_TARGET_ARCH) $(KBUILD_HOST_ARCH))
LIBRARIES.win += RuntimeR3NtDll-amd64
endif
# Always build the import library.
IMPORT_LIBS += VBoxRTImp
# Where the generated stuff goes.
IPRT_OUT_DIR := $(PATH_TARGET)/Runtime
BLDDIRS += $(IPRT_OUT_DIR)
OTHER_CLEAN += \
$(IPRT_OUT_DIR)/errmsgdata.h \
$(IPRT_OUT_DIR)/errmsgcomdata.h \
$(IPRT_OUT_DIR)/errmsgvboxcomdata.h \
$(IPRT_OUT_DIR)/Doxyfile.iprt \
$(IPRT_OUT_DIR)/Doxyfile.iprt.dep \
$(IPRT_OUT_DIR)/docs.iprt
#
# Globals
#
VBOX_PATH_RUNTIME_SRC := $(PATH_SUB_CURRENT)
#
# Set the defines that buildconfig.cpp needs. Its used by several targets.
#
IPRT_BLDCFG_SCM_REV=$(VBOX_SVN_REV) \
IPRT_BLDCFG_VERSION_STRING=\"$(VBOX_VERSION_STRING)\" \
IPRT_BLDCFG_VERSION_MAJOR=$(VBOX_VERSION_MAJOR) \
IPRT_BLDCFG_VERSION_MINOR=$(VBOX_VERSION_MINOR) \
IPRT_BLDCFG_VERSION_BUILD=$(VBOX_VERSION_BUILD) \
IPRT_BLDCFG_TARGET=\"$(KBUILD_TARGET)\" \
IPRT_BLDCFG_TARGET_ARCH=\"$(KBUILD_TARGET_ARCH)\" \
IPRT_BLDCFG_TYPE=\"$(KBUILD_TYPE)\"
#
# Unicode Specification reader used to regenerate unidata.cpp.
#
uniread_TEMPLATE = VBOXBLDPROG
uniread_SOURCES = common/string/uniread.cpp
uniread_INCS = include
#
# Win64 assembly sources.
#
RuntimeWin64ASM_SOURCES = \
#
# Win32 assembly sources.
#
RuntimeWin32ASM_SOURCES = \
#
# NoCRT sources (minus math stuff).
#
if1of ($(KBUILD_TARGET_ARCH), amd64 x86)
RuntimeNoCrt_SOURCES = \
endif
#
# RuntimeR3 - Static Runtime for Ring-3 executables.
#
RuntimeR3_TEMPLATE = VBoxR3Static
RuntimeR3_SDKS = VBOX_LIBXML2 VBOX_OPENSSL VBOX_BOOST ## @todo why is BOOST and XML2 here? r3/xml.cpp is not in this lib...
RuntimeR3_SDKS.win = WINPSDK $(VBOX_WINDDK)
RuntimeR3_DEFS = IN_RT_R3 IN_SUP_R3 LDR_WITH_NATIVE LDR_WITH_ELF32 LDR_WITH_PE RT_WITH_VBOX RT_NO_GIP
#RuntimeR3_DEFS += RTMEM_WRAP_TO_EF_APIS
ifdef IPRT_WITH_KSTUFF
RuntimeR3_DEFS += LDR_WITH_KLDR
endif
ifdef VBOX_MAIN_RELEASE_LOG ## @todo (dmik): temporary, until RTThreadSelf/RTThreadAdopt are properly updated
RuntimeR3_DEFS += RTCRITSECT_STRICT
endif
ifdef IPRT_WITH_LZJB
RuntimeR3_DEFS += RTZIP_USE_LZJB
endif
ifdef IPRT_WITH_LZO
RuntimeR3_DEFS += RTZIP_USE_LZO
endif
ifn1of ($(KBUILD_TARGET), win)
RuntimeR3_DEFS += RT_WITH_ICONV_CACHE
endif
ifdef IPRT_WITH_FUTEX_BASED_SEMS
RuntimeR3_DEFS.linux += IPRT_WITH_FUTEX_BASED_SEMS
endif
RuntimeR3_INCS = \
include \
$(SDK_VBOX_ZLIB_INCS)
RuntimeR3_INCS += \
$(PATH_ROOT)/src/libs/liblzf-3.4
ifdef IPRT_WITH_KSTUFF
RuntimeR3_INCS += \
$(PATH_ROOT)/src/libs/kStuff/kStuff/include
endif
$(L4_INCDIR)
# RuntimeR3_INCS.solaris = \
RuntimeR3_SOURCES = \
#if1of ($(KBUILD_TARGET_ARCH),amd64 x86)
# RuntimeR3_SOURCES += common/time/timesupA.asm
#else
RuntimeR3_SOURCES += common/time/timesupref.cpp
#endif
ifdef IPRT_WITH_LZJB
RuntimeR3_SOURCES += common/misc/lzjb.c
endif
# Some versions of GCC might require this.
ifdef IPRT_WITH_KSTUFF
RuntimeR3_SOURCES += \
endif
# VBox specific stuff.
RuntimeR3_SOURCES += \
ifneq ($(KBUILD_TARGET),win)
RuntimeR3_SOURCES += \
endif
if1of ($(KBUILD_TARGET),freebsd linux netbsd openbsd solaris)
RuntimeR3_SOURCES += \
$(if $(VBOX_WITH_DBUS),VBox/dbus.cpp,)
endif
generic/semrw-$(if-expr defined(VBOX_WITH_LOCKLESS_SEMRW),lockless-,)generic.cpp \
RuntimeR3_SOURCES.win.amd64 = $(RuntimeWin64ASM_SOURCES)
RuntimeR3_SOURCES.win.x86 = $(RuntimeWin32ASM_SOURCES)
ifdef IPRT_WITH_FUTEX_BASED_SEMS
else
ifdef RT_NEW_LINUX_MUTEX_CODE
else
endif
endif
generic/semrw-$(if-expr defined(VBOX_WITH_LOCKLESS_SEMRW),lockless-,)generic.cpp \
generic/semrw-$(if-expr defined(VBOX_WITH_LOCKLESS_SEMRW),lockless-,)generic.cpp \
## @todo Make BSD sched, implement RTMP*.
## PORTME: Porters add their selection of platform specific files for Ring-3 here.
#
# L4 RuntimeR3 subtarget since L4 headers won't work with VBOXR3.
#
RuntimeR3L4_TEMPLATE = VBOXR3NP
RuntimeR3L4_DEFS = IN_RT_R3 IN_SUP_R3 LDR_WITH_NATIVE LDR_WITH_ELF LDR_WITH_PE
ifneq ($(KBUILD_TARGET_ARCH),amd64)
RuntimeR3L4_DEFS += __PIC__
endif
RuntimeR3L4_INCS = \
include \
$(L4_INCDIR)
RuntimeR3L4_SOURCES = \
generic/semrw-$(if-expr defined(VBOX_WITH_LOCKLESS_SEMRW),lockless-,)generic.cpp \
#
# RuntimeBldProg - Static Runtime for build programs.
#
# Note! This is a bit of hacky since kBuild doesn't support building libraries
# for build programs.
#
RuntimeBldProg_TEMPLATE := VBOXBLDPROG
RuntimeBldProg_EXTENDS := RuntimeR3
RuntimeBldProg_BLD_TRG := $(KBUILD_HOST)
RuntimeBldProg_BLD_TRG_ARCH := $(KBUILD_HOST_ARCH)
RuntimeBldProg_BLD_TRG_CPU := $(KBUILD_HOST_CPU)
#
# RuntimeGuestR3 - Guest Additions Runtime (static/exe).
# (The KBUILD_HOST inheritance here is for l4 cross building the linux
# additions, while .x86 is for cross building x86 while targeting amd64.)
#
RuntimeGuestR3_TEMPLATE := VBOXGUESTR3LIB
## @todo change this to EXTEND the RuntimeR3 target.
RuntimeGuestR3_DEFS := $(filter-out RTCRITSECT_STRICT RT_NO_GIP, $(RuntimeR3_DEFS))
RuntimeGuestR3_DEFS.$(KBUILD_TARGET) := $(RuntimeR3_DEFS.$(KBUILD_TARGET))
RuntimeGuestR3_DEFS.$(KBUILD_HOST) := $(RuntimeR3_DEFS.$(KBUILD_HOST))
RuntimeGuestR3_INCS := $(RuntimeR3_INCS)
RuntimeGuestR3_INCS.$(KBUILD_TARGET) := $(RuntimeR3_INCS.$(KBUILD_TARGET))
RuntimeGuestR3_INCS.$(KBUILD_HOST) := $(RuntimeR3_INCS.$(KBUILD_HOST))
RuntimeGuestR3_SOURCES := $(filter-out \
, $(RuntimeR3_SOURCES))
RuntimeGuestR3_SOURCES += \
RuntimeGuestR3_SOURCES.$(KBUILD_TARGET) := $(RuntimeR3_SOURCES.$(KBUILD_TARGET))
RuntimeGuestR3_SOURCES.$(KBUILD_HOST) := $(RuntimeR3_SOURCES.$(KBUILD_HOST))
RuntimeGuestR3_SOURCES.$(KBUILD_TARGET_ARCH) := $(RuntimeR3_SOURCES.$(KBUILD_TARGET_ARCH))
RuntimeGuestR3_SOURCES.$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH) := $(RuntimeR3_SOURCES.$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH))
RuntimeGuestR3_SOURCES.$(KBUILD_TARGET).x86 := $(RuntimeR3_SOURCES.$(KBUILD_TARGET).x86)
RuntimeGuestR3_SOURCES.$(KBUILD_TARGET).amd64:= $(RuntimeR3_SOURCES.$(KBUILD_TARGET).amd64)
RuntimeGuestR3_SOURCES.$(KBUILD_HOST).$(KBUILD_TARGET_ARCH) := $(RuntimeR3_SOURCES.$(KBUILD_HOST).$(KBUILD_TARGET_ARCH))
#
# RuntimeGuestR3-x86 - Same as RuntimeGuestR3, except that it's targeting x86.
#
RuntimeGuestR3-x86_EXTENDS := RuntimeGuestR3
RuntimeGuestR3-x86_BLD_TRG_ARCH := x86
#
# RuntimeGuestR3Shared - Guest Additions Runtime (static/dll).
#
RuntimeGuestR3Shared_TEMPLATE := VBOXGUESTR3DLL
RuntimeGuestR3Shared_EXTENDS := RuntimeGuestR3
RuntimeGuestR3Shared_INST = $(INST_ADDITIONS_LIB)
#
# RuntimeGuestR3Shared-x86 - Same as RuntimeGuestR3Shared, except that it's targeting x86.
#
RuntimeGuestR3Shared-x86_EXTENDS := RuntimeGuestR3Shared
RuntimeGuestR3Shared-x86_BLD_TRG_ARCH := x86
#
# RuntimeGuestR3Mini - Minimal Guest Additions Runtime which does not require
# initialization and can be linked into an .so. Intended
# for X11 drivers, GRADD and similar.
#
RuntimeGuestR3Mini_TEMPLATE := VBOXGUESTR3DLL
## @todo change this to EXTEND the RuntimeGuestR3 target.
RuntimeGuestR3Mini_INST := $(INST_ADDITIONS_LIB)
RuntimeGuestR3Mini_DEFS := \
$(filter-out RTCRITSECT_STRICT RT_NO_GIP RT_WITH_ICONV_CACHE, $(RuntimeR3_DEFS)) \
RT_MINI
RuntimeGuestR3Mini_DEFS.$(KBUILD_TARGET) := $(RuntimeR3_DEFS.$(KBUILD_TARGET))
RuntimeGuestR3Mini_DEFS.$(KBUILD_HOST) := $(RuntimeR3_DEFS.$(KBUILD_HOST))
RuntimeGuestR3Mini_INCS := $(RuntimeR3_INCS)
RuntimeGuestR3Mini_INCS.$(KBUILD_TARGET) := $(RuntimeR3_INCS.$(KBUILD_TARGET))
RuntimeGuestR3Mini_INCS.$(KBUILD_HOST) := $(RuntimeR3_INCS.$(KBUILD_HOST))
RuntimeGuestR3Mini_SOURCES = \
# VBox specific stuff.
RuntimeGuestR3Mini_SOURCES += \
#
# RuntimeLnxHostR3 Linux host program runtime
# (Only used when building L4.)
#
RuntimeLnxHostR3_TEMPLATE = VBOXLNXHOSTR3LIB
RuntimeLnxHostR3_DEFS = IN_RT_R3 IN_SUP_R3 RT_WITH_VBOX RT_NO_GIP
RuntimeLnxHostR3_SOURCES = \
$(RuntimeR3_SOURCES.linux.$(KBUILD_TARGET_ARCH)) \
$(RuntimeR3_SOURCES)
RuntimeLnxHostR3_INCS = \
$(RuntimeR3_INCS.linux.$(KBUILD_TARGET_ARCH)) \
$(RuntimeR3_INCS.linux) \
$(RuntimeR3_INCS)
#
# VBoxRT - Shared Object / DLL version.
#
VBoxRT_TEMPLATE = VBoxR3DllNoPic
VBoxRT_SDKS = VBOX_OPENSSL VBOX_LIBXML2 VBOX_BOOST
ifdef VBOX_WITH_LIBCURL
VBoxRT_SDKS += VBOX_LIBCURL
endif
VBoxRT_SDKS.win = WINPSDK $(VBOX_WINDDK) VBOX_NTDLL
if1of ($(KBUILD_TARGET)$(VBOX_WITH_HARDENING), darwin win)
VBoxRT_INST = $(INST_DLL) $(INST_TESTCASE)
endif
VBoxRT_DEFS = $(filter-out RT_NO_GIP,$(RuntimeR3_DEFS)) IN_SUP_R3 IN_SUP_R3
ifn1of ($(KBUILD_TARGET_ARCH), amd64 x86)
VBoxRT_DEFS += RT_NO_GIP
endif
VBoxRT_DEFS.$(KBUILD_TYPE) = $(RuntimeR3_DEFS.$(KBUILD_TYPE))
VBoxRT_SOURCES = \
$(filter-out common/checksum/crc32.cpp, $(RuntimeR3_SOURCES)) \
ifdef VBOX_WITH_LIBCURL
VBoxRT_SOURCES += common/misc/s3.cpp
endif
VBoxRT_SOURCES.$(KBUILD_TARGET) = $(RuntimeR3_SOURCES.$(KBUILD_TARGET))
VBoxRT_SOURCES.$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH) = $(RuntimeR3_SOURCES.$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH))
VBoxRT_SOURCES.$(KBUILD_TARGET_ARCH) = $(RuntimeR3_SOURCES.$(KBUILD_TARGET_ARCH))
VBoxRT_SOURCES.win += \
$(VBoxRT_0_OUTDIR)/VBoxRT.def
VBoxRT_SOURCES.linux += \
VBoxRT_INCS = $(RuntimeR3_INCS)
VBoxRT_INCS.$(KBUILD_TARGET) = $(RuntimeR3_INCS.$(KBUILD_TARGET))
VBoxRT_INCS.$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH) = $(RuntimeR3_INCS.$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH))
VBoxRT_LIBS = \
$(PATH_LIB)/VBox-liblzf$(VBOX_SUFF_LIB) \
$(SDK_VBOX_ZLIB_LIBS)
if1of ($(KBUILD_TARGET_ARCH), amd64 x86)
VBoxRT_LIBS += \
$(PATH_LIB)/SUPR3$(VBOX_SUFF_LIB)
endif
ifdef IPRT_WITH_KSTUFF
VBoxRT_LIBS += \
$(PATH_LIB)/VBox-kStuff$(VBOX_SUFF_LIB)
endif
ifndef SDK_VBOX_LIBXML2_LIBS
VBoxRT_LIBS += \
$(PATH_LIB)/VBox-libxml2$(VBOX_SUFF_LIB)
endif
ifndef SDK_VBOX_OPENSSL_LIBS
VBoxRT_LIBS += \
$(PATH_LIB)/VBox-libcrypto$(VBOX_SUFF_LIB)
endif
ifdef IPRT_WITH_LZO
VBoxRT_LIBS += lzo2
endif
crypt
iconv
iconv \
rt
kstat \
contract
ifn1of ($(KBUILD_TARGET_ARCH), sparc32 sparc64)
# SMBIOS not available on Solaris SPARC.
VBoxRT_LIBS.solaris += smbios
endif
VBoxRT_LIBS.win = \
$(PATH_SDK_$(VBOX_WINDDK)_LIB)/vccomsup.lib \
$(PATH_SDK_$(VBOX_WINDDK)_LIB)/wbemuuid.lib
VBoxRT_LDFLAGS.darwin = -framework IOKit -framework CoreFoundation -framework CoreServices -install_name $(VBOX_DYLD_EXECUTABLE_PATH)/VBoxRT.dylib
ifdef VBOX_USE_VCC80
VBoxRT_LDFLAGS.win = /MANIFEST
endif
-Wl,-whole-archive \
$(PATH_LIB)/RuntimeR3L4$(VBOX_SUFF_LIB) \
-Wl,-no-whole-archive
ifeq ($(KBUILD_TARGET),l4)
VBoxRT_LIBS += \
$(L4_LIBDIR)/libl4sys.a \
$(L4_LIBDIR)/libl4sys.p.a
endif
VBoxRT_LIBS.l4 = \
$(PATH_LIB)/RuntimeR3L4$(VBOX_SUFF_LIB)
if1of ($(DLLS), VBoxRT)
$$(VBoxRT_0_OUTDIR)/VBoxRT.def: \
$(PATH_SUB_CURRENT)/r3/win/VBoxRT-$$(if-expr $$(KBUILD_TARGET_ARCH) == amd64,win64,win32).def \
$(RM) -f -- $@
$(REDIRECT) -wto $@ -- $(CAT_EXT) $^
endif
#
# HACK ALERT! Make testcase run during build on SELinux boxes.
# Create a dummy DLL that ensure that VBoxRT is installed
# during the DLL pass and cleaned up later.
#
ifeq ($(KBUILD_TARGET),linux)
if1of (VBoxRT, $(DLLS))
ifneq ($(wildcard /usr/bin/chcon),)
VBoxRT_NOINST = true
DLLS += VBoxRTDummy
VBoxRTDummy_TEMPLATE = VBOXR3
VBoxRTDummy_NOINST = true
VBoxRTDummy_LIBS = $(PATH_BIN)/VBoxRT.so
VBoxRTDummy_CLEAN= $(PATH_BIN)/VBoxRT.so
BLDDIRS += $(PATH_BIN)
$(PATH_BIN)/VBoxRT.so: $$(VBoxRT_1_TARGET) | $$(dir $$@)
$(INSTALL) $< $@
chcon -t texrel_shlib_t $@ || true
VBoxRT:: VBoxRTDummy
endif # chcon present.
endif # building VBoxRT
endif # linux
#
# VBoxRTImp - Import library/hack.
#
ifeq ($(KBUILD_TARGET).$(KBUILD_TARGET_ARCH),win.amd64)
$(call VBOX_GENERATE_IMPORT_TARGET_FN,VBoxRTImp,VBoxRT,VBox/VBoxRTImp.def r3/win/VBoxRT-openssl-ose.def r3/win/VBoxRT-win64.def)
else ifeq ($(KBUILD_TARGET).$(KBUILD_TARGET_ARCH),win.x86)
$(call VBOX_GENERATE_IMPORT_TARGET_FN,VBoxRTImp,VBoxRT,VBox/VBoxRTImp.def r3/win/VBoxRT-openssl-ose.def r3/win/VBoxRT-win32.def)
else
$(call VBOX_GENERATE_IMPORT_TARGET_FN,VBoxRTImp,VBoxRT,VBox/VBoxRTImp.def r3/win/VBoxRT-openssl-ose.def)
endif
#
# RuntimeR3NoCRTGCC - CRT replacement lib for VBoxREM.
# This is used together with VBoxRT.
#
## @todo the *_alias.c stuff is busted, remove and use RT_WITH_NOCRT_ALIASES instead.
RuntimeR3NoCRTGCC_TEMPLATE = VBOXNOCRTGCC
RuntimeR3NoCRTGCC_LIBSUFF = $(VBOX_SUFF_LIB)
ifn1of ($(KBUILD_TARGET_ARCH), amd64 x86)
RuntimeR3NoCRTGCC_DEFS += RT_NO_GIP
endif
RuntimeR3NoCRTGCC_INCS = include
RuntimeR3NoCRTGCC_SOURCES = \
\
$(RuntimeNoCrt_SOURCES)
if1of ($(KBUILD_TARGET_ARCH), amd64 x86)
RuntimeR3NoCRTGCC_SOURCES += \
\
endif
#
# RuntimeR0 - Ring-0 library for VMMR0.
#
RuntimeR0_TEMPLATE = VBoxR0
RuntimeR0_DEFS = IN_RT_R0 RT_WITH_VBOX
ifn1of ($(KBUILD_TARGET_ARCH), amd64 x86)
RuntimeR0_DEFS += RT_NO_GIP
endif
RuntimeR0_INCS = include
RuntimeR0_SOURCES = \
\
$(RuntimeNoCrt_SOURCES)
if1of ($(KBUILD_TARGET), darwin solaris freebsd)
RuntimeR0_SOURCES += \
endif
#if1of ($(KBUILD_TARGET_ARCH),amd64 x86)
# RuntimeR0_SOURCES += common/time/timesupA.asm
#else
RuntimeR0_SOURCES += common/time/timesupref.cpp
#endif
RuntimeR0_SOURCES.win.amd64 = $(RuntimeWin64ASM_SOURCES)
RuntimeR0_SOURCES.win.x86 = $(RuntimeWin32ASM_SOURCES)
#
# RuntimeR0Stub - Ring-0 context startup stub for Windows and Solaris.
#
RuntimeR0Stub_TEMPLATE = $(if-expr "$(KBUILD_TARGET)" == "solaris",VBOXR0DRV,VBoxR0)
#
# RuntimeR0Drv - Ring-0 library for host drivers.
#
RuntimeR0Drv_TEMPLATE = VBOXR0DRV
RuntimeR0Drv_SDKS.win = $(VBOX_WINDDK) WINPSDKINCS
RuntimeR0Drv_DEFS = IN_RT_R0 RT_WITH_VBOX RT_WITHOUT_NOCRT_WRAPPERS RT_NO_EXPORT_SYMBOL
RuntimeR0Drv_DEFS.win = IN_SUP_R0
RuntimeR0Drv_DEFS.linux = MODULE KBUILD_MODNAME=KBUILD_STR\(vboxdrv\) KBUILD_BASENAME=KBUILD_STR\(vboxdrv\) IN_SUP_R0
RuntimeR0Drv_INCS := $(PATH_SUB_CURRENT) include
$(PATH_INS)/gen-sys-hdrs
RuntimeR0Drv_SOURCES = \
RuntimeR0Drv_SOURCES.win.amd64 = $(RuntimeWin64ASM_SOURCES)
RuntimeR0Drv_SOURCES.win.x86 = $(RuntimeWin32ASM_SOURCES)
\
\
# VBI is now compiled into IPRT
## PORTME: Porters create and add their selection of platform specific Ring-0 Driver files here.
$(PATH_INS)/gen-sys-hdrs/bus_if.h \
$(PATH_INS)/gen-sys-hdrs/device_if.h
#
# RuntimeGuestR0 - Guest driver runtime.
# This is almost the same as the RuntimeR0Drv, the main difference
# is in the backdoor logging and the lack of sup.h (which should be
# made irrelevant even for RuntimeR0Drv).
#
RuntimeGuestR0_TEMPLATE := VBOXGUESTR0LIB
RuntimeGuestR0_SOURCES := $(filter-out generic/RTLogWriteUser-generic.cpp, $(RuntimeR0Drv_SOURCES))
RuntimeGuestR0_SOURCES += \
RuntimeGuestR0_EXTENDS = RuntimeR0Drv
#
# RuntimeGuestR0NT4 - Win32 NT4 guest driver runtime.
#
RuntimeGuestR0NT4_EXTENDS = RuntimeGuestR0
RuntimeGuestR0NT4_EXTENDS_BY = appending
RuntimeGuestR0NT4_DEFS = IPRT_TARGET_NT4
ifdef VBOX_WITH_RAW_MODE
#
# RuntimeRC - Raw-mode context library.
#
RuntimeRC_TEMPLATE = VBoxRc
RuntimeRC_DEFS = IN_RT_RC RT_WITH_VBOX
RuntimeRC_INCS = include
RuntimeRC_SOURCES = \
\
$(RuntimeNoCrt_SOURCES)
#if1of ($(KBUILD_TARGET_ARCH),amd64 x86)
# RuntimeRC_SOURCES += common/time/timesupA.asm
#else
RuntimeRC_SOURCES += common/time/timesupref.cpp
#endif
RuntimeRC_SOURCES.win.x86 = $(RuntimeWin32ASM_SOURCES)
ifeq ($(VBOX_LDR_FMT32),lx)
RuntimeRC_SOURCES += os2/sys0.asm
endif
if1of ($(KBUILD_TARGET), darwin solaris freebsd)
RuntimeRC_SOURCES += \
endif
#
# RuntimeRCStub - Raw-mode context startup stub for Windows.
#
RuntimeRCStub_TEMPLATE = VBoxRc
endif # VBOX_WITH_RAW_MODE
#
# Static library for new & delete for the electric fence.
#
RuntimeEFCPP_TEMPLATE = $(VBoxRT_TEMPLATE)
RuntimeEFCPP_SDKS = $(RuntimeR3_SDKS)
RuntimeEFCPP_SDKS.$(KBUILD_TARGET) = $(RuntimeR3_SDKS.$(KBUILD_TARGET))
RuntimeEFCPP_DEFS = $(RuntimeR3_DEFS)
RuntimeEFCPP_DEFS.$(KBUILD_TARGET) = $(RuntimeR3_DEFS.$(KBUILD_TARGET))
RuntimeEFCPP_INCS = $(RuntimeR3_INCS)
RuntimeEFCPP_INCS.$(KBUILD_TARGET) = $(RuntimeR3_INCS.$(KBUILD_TARGET))
RuntimeEFCPP_SOURCES = r3/alloc-ef-cpp.cpp
#
# The NTDLL mini import library.
#
# Note! The reason for doing this is to avoid importing CRT symbols from the
# NTDLL. We do not wish to do this because:
# - Our compiler is usually a different one and we should use the
# matching CRT,
# - Older versions of NTDLL may not sport all the exports our w2k3 or
# later WINDDK ntdll.lib have and thus we may easily end up with
# images that does not load on older windows versions.
#
RuntimeR3NtDll-amd64_TEMPLATE = VBoxR3Dll
RuntimeR3NtDll-amd64_BLD_TRG_ARCH = amd64
RuntimeR3NtDll-amd64_ARFLAGS = /NODEFAULTLIB /MACHINE:amd64
RuntimeR3NtDll-amd64_SOURCES = \
RuntimeR3NtDll-x86_EXTENDS = RuntimeR3NtDll-amd64
RuntimeR3NtDll-x86_BLD_TRG_ARCH = x86
RuntimeR3NtDll-x86_ARFLAGS = /NODEFAULTLIB /MACHINE:x86
#
# errmsg.cpp depends on a generated header.
#
common/err/errmsg.cpp_DEPS = $(IPRT_OUT_DIR)/errmsgdata.h
common/err/errmsg.cpp_INCS = $(IPRT_OUT_DIR)
win/errmsgwin.cpp_DEPS = $(IPRT_OUT_DIR)/errmsgcomdata.h
win/errmsgwin.cpp_INCS = $(IPRT_OUT_DIR)
# Our COM errors only for R3 libraries on the host
define def_errmsgwin_deps
$(lib)_win/errmsgwin.cpp_DEPS = $(IPRT_OUT_DIR)/errmsgvboxcomdata.h
$(lib)_common/err/errmsgxpcom.cpp_INCS = $(IPRT_OUT_DIR)
$(lib)_common/err/errmsgxpcom.cpp_DEPS = $(IPRT_OUT_DIR)/errmsgvboxcomdata.h
endef
$(foreach lib,RuntimeR3 RuntimeBldProg VBoxRT RuntimeLnxHostR3,$(eval $(def_errmsgwin_deps)))
#
# Generate the status code data.
#
$(IPRT_OUT_DIR)/errmsgdata.h: \
$(VBOX_PATH_RUNTIME_SRC)/common/err/errmsg.sed \
$(PATH_ROOT)/include/iprt/err.h \
$(PATH_ROOT)/include/VBox/err.h \
| $$(dir $$@)
$(call MSG_GENERATE,,$@,$(filter %.h,$^))
$(QUIET)$(REDIRECT) -wo $@ -- $(SED) -f $< $(filter %.h,$^)
## @todo r=bird: rename this to indicate that it's not only COM errors, but all win32/64 errors.
$(IPRT_OUT_DIR)/errmsgcomdata.h: \
$(VBOX_PATH_RUNTIME_SRC)/common/err/errmsgcom.sed \
$$(PATH_SDK_WINPSDK_INC)/WinError.h \
| $$(dir $$@)
$(call MSG_GENERATE,,$@,$(filter %.h,$^))
$(QUIET)$(REDIRECT) -wo $@ -- $(SED) -f $< $(filter %.h,$^)
$(IPRT_OUT_DIR)/errmsgvboxcomdata.h: \
$(VBOX_PATH_RUNTIME_SRC)/VBox/errmsgvboxcom.xsl \
$(VBOX_XIDL_FILE_SRC) \
| $$(dir $$@)
$(call MSG_GENERATE,,$@,$(filter %.xidl,$^))
$(QUIET)$(VBOX_XSLTPROC) -o $@ $< $(filter %.xidl,$^)
if "$(KBUILD_TARGET)" == "freebsd"
#
# FreeBSDGeneratedKernelHeaders - Generate some kernel interface headers.
#
# These are used by:
# - The RTMp* API in IPRT.
# - VBoxGuest
#
# Note! We cannot give a output path to the awk program, it will always
# generate the header next to the source. So, we'll have to temporarily copy
# the source file to the destination directory to work.
#
VBOX_AWK := /usr/bin/awk
INSTALLS += FreeBSDGeneratedKernelHeaders
FreeBSDGeneratedKernelHeaders_INST = gen-sys-hdrs/
FreeBSDGeneratedKernelHeaders_SOURCES = \
$(FreeBSDGeneratedKernelHeaders_0_OUTDIR)/bus_if.h \
$(FreeBSDGeneratedKernelHeaders_0_OUTDIR)/device_if.h \
$(FreeBSDGeneratedKernelHeaders_0_OUTDIR)/pci_if.h
FreeBSDGeneratedKernelHeaders_CLEAN = $(FreeBSDGeneratedKernelHeaders_SOURCES)
$$(FreeBSDGeneratedKernelHeaders_0_OUTDIR)/bus_if.h: $(VBOX_FREEBSD_SRC)/kern/bus_if.m | $$(dir $$@)
$(call MSG_TOOL,awk,FreeBSDGeneratedKernelHeaders,$<,$@)
$(QUIET)$(CP) -f $< $(@D)/bus_if.m
$(QUIET)$(VBOX_AWK) -f $(VBOX_FREEBSD_SRC)/tools/makeobjops.awk $(@D)/bus_if.m -h -p
$(QUIET)$(RM) $(@D)/bus_if.m
$$(FreeBSDGeneratedKernelHeaders_0_OUTDIR)/device_if.h: $(VBOX_FREEBSD_SRC)/kern/device_if.m | $$(dir $$@)
$(call MSG_TOOL,awk,FreeBSDGeneratedKernelHeaders,$<,$@)
$(QUIET)$(CP) -f $< $(@D)/device_if.m
$(QUIET)$(VBOX_AWK) -f $(VBOX_FREEBSD_SRC)/tools/makeobjops.awk $(@D)/device_if.m -h -p
$(QUIET)$(RM) $(@D)/device_if.m
$$(FreeBSDGeneratedKernelHeaders_0_OUTDIR)/pci_if.h: $(VBOX_FREEBSD_SRC)/dev/pci/pci_if.m | $$(dir $$@)
$(call MSG_TOOL,awk,FreeBSDGeneratedKernelHeaders,$<,$@)
$(QUIET)$(CP) -f $< $(@D)/pci_if.m
$(QUIET)$(VBOX_AWK) -f $(VBOX_FREEBSD_SRC)/tools/makeobjops.awk $(@D)/pci_if.m -h -p
$(QUIET)$(RM) $(@D)/pci_if.m
endif # FreeBSD
#
# Aliases for .cpp.h files so we can more easily do syntax checking from the editor.
#
#
# Doxygen documentation.
#
IPRT_DOXYFILE_INPUT_DIRS = \
$(PATH_ROOT)/include/iprt \
$(PATH_ROOT)/include/iprt/cpp \
$(PATH_ROOT)/include/iprt/linux \
$(PATH_ROOT)/include/iprt/nocrt \
$(PATH_ROOT)/include/iprt/nocrt/x86 \
$(PATH_ROOT)/include/iprt/nocrt/amd64 \
$(PATH_ROOT)/include/iprt/nocrt/compiler \
$(VBOX_PATH_RUNTIME_SRC)/include/internal \
$(VBOX_PATH_RUNTIME_SRC)/common/alloc \
$(VBOX_PATH_RUNTIME_SRC)/common/asm \
$(VBOX_PATH_RUNTIME_SRC)/common/checksum \
$(VBOX_PATH_RUNTIME_SRC)/common/dbg \
$(VBOX_PATH_RUNTIME_SRC)/common/err \
$(VBOX_PATH_RUNTIME_SRC)/common/ldr \
$(VBOX_PATH_RUNTIME_SRC)/common/log \
$(VBOX_PATH_RUNTIME_SRC)/common/math \
$(VBOX_PATH_RUNTIME_SRC)/common/math/amd64 \
$(VBOX_PATH_RUNTIME_SRC)/common/math/gcc \
$(VBOX_PATH_RUNTIME_SRC)/common/math/x86 \
$(VBOX_PATH_RUNTIME_SRC)/common/misc \
$(VBOX_PATH_RUNTIME_SRC)/common/path \
$(VBOX_PATH_RUNTIME_SRC)/common/rand \
$(VBOX_PATH_RUNTIME_SRC)/common/string \
$(VBOX_PATH_RUNTIME_SRC)/common/table \
$(VBOX_PATH_RUNTIME_SRC)/common/time \
$(VBOX_PATH_RUNTIME_SRC)/VBox \
$(foreach dir, $(VBOX_PATH_RUNTIME_SRC) $(VBOX_PATH_RUNTIME_SRC)/r3 $(VBOX_PATH_RUNTIME_SRC)/r0drv,\
$(dir) \
$(dir)/darwin \
$(dir)/l4 \
$(dir)/linux \
$(dir)/nt \
$(dir)/os2 \
$(dir)/win \
$(dir)/win32 \
$(dir)/win64 \
$(dir)/generic \
)
# These must come first in order to make things look nice.
IPRT_DOXYFILE_INPUT_FIRST =\
$(PATH_ROOT)/include/iprt/cdefs.h \
$(PATH_ROOT)/include/iprt/types.h \
$(PATH_ROOT)/include/iprt/runtime.h \
$(PATH_ROOT)/include/iprt/param.h \
$(PATH_ROOT)/include/iprt/assert.h \
$(PATH_ROOT)/include/iprt/asm.h \
IPRT_DOXYFILE_INPUT := \
$(filter-out %.cpp.h, $(sort $(wildcard $(addsuffix /*.h, $(IPRT_DOXYFILE_INPUT_DIRS)))) ) \
$(foreach dir, $(IPRT_DOXYFILE_INPUT_DIRS), $(wildcard $(dir)/*.cpp $(dir)/.c $(dir)/.asm))
IPRT_DOXYFILE_INPUT := \
$(IPRT_DOXYFILE_INPUT_FIRST) \
$(filter-out $(IPRT_DOXYFILE_INPUT_FIRST), $(IPRT_DOXYFILE_INPUT))
IPRT_DOXYFILE_OUTPUT = $(PATH_OUT)/docs/iprt
BLDDIRS += $(IPRT_DOXYFILE_OUTPUT)
includedep $(IPRT_OUT_DIR)/Doxyfile.iprt.dep
# Generate the Doxyfile
$(IPRT_OUT_DIR)/Doxyfile.iprt: \
$(VBOX_PATH_RUNTIME_SRC)/Doxyfile \
$(VBOX_PATH_RUNTIME_SRC)/Makefile.kmk \
$(comp-vars IPRT_DOXYFILE_INPUT,DOXYGEN_INPUT_PREV,FORCE) \
$(comp-vars IPRT_DOXYFILE_OUTPUT,DOXYGEN_OUTPUT_PREV,FORCE) \
| $$(dir $$@)
$(RM) -f $@ $@.tmp $@.dep
$(CP) -f $(VBOX_PATH_RUNTIME_SRC)/Doxyfile $@.tmp
$(APPEND) $@.tmp
$(APPEND) $@.tmp "OUTPUT_DIRECTORY = $(IPRT_DOXYFILE_OUTPUT)"
$(APPEND) $@.tmp "WARN_LOGFILE = $(IPRT_DOXYFILE_OUTPUT)/errors"
$(APPEND) $@.tmp "INCLUDE_PATH = $(PATH_ROOT)/include include . common/table"
$(APPEND) $@.tmp "INCLUDE_FILE_PATTERNS = *.cpp.h"
$(APPEND) $@.tmp "PREDEFINED += $(ARCH_BITS_DEFS)"
$(APPEND) $@.tmp
$(APPEND) $@.tmp "INPUT = $(IPRT_DOXYFILE_INPUT)"
$(APPEND) $@.tmp
$(MV) -f $@.tmp $@
@$(APPEND) $@.dep "DOXYGEN_OUTPUT_PREV = $(IPRT_DOXYFILE_OUTPUT)"
@$(APPEND) $@.dep "DOXYGEN_INPUT_PREV = $(IPRT_DOXYFILE_INPUT)"
# Do the actual job.
$(IPRT_OUT_DIR)/docs.iprt: $(IPRT_OUT_DIR)/Doxyfile.iprt $$(IPRT_DOXYFILE_INPUT) | $(IPRT_DOXYFILE_OUTPUT)/
$(RM) -f $(wildcard $(IPRT_DOXYFILE_OUTPUT)/html/*) $(IPRT_OUT_DIR)/docs.iprt
doxygen $(IPRT_OUT_DIR)/Doxyfile.iprt
$(APPEND) $(IPRT_OUT_DIR)/docs.iprt
# aliases
if !defined(VBOX_ONLY_DOCS) && defined(VBOX_WITH_ALL_DOXYGEN_TARGETS)
docs: $(IPRT_OUT_DIR)/docs.iprt
endif
test-doxygen::
@echo test-$(comp-vars IPRT_DOXYFILE_OUTPUT,DOXYGEN_OUTPUT_PREV,FORCE)
@echo $(IPRT_DOXYFILE_OUTPUT)
@echo $(DOXYGEN_OUTPUT_PREV)
@echo $(IPRT_DOXYFILE_INPUT)
#
# Test mangling.
#
if1of ($(LIBRARIES),RuntimeR3 RuntimeR0 RuntimeR0Drv RuntimeRC)
test-mangling:: $(IPRT_OUT_DIR)/mangling.run
OTHERS += $(IPRT_OUT_DIR)/mangling.run
CLEANS += $(IPRT_OUT_DIR)/mangling.run
$(IPRT_OUT_DIR)/mangling.run: \
$$(RuntimeR3_1_TARGET) \
$$(RuntimeR0_1_TARGET) \
$$(RuntimeR0Drv_1_TARGET) \
$$(RuntimeRC_1_TARGET)
if1of ($(KBUILD_TARGET), win os2)
$(call MSG_L1,IPRT: skipped mangling test.)
else if $(intersects $(KBUILD_TARGET), linux) && "$(VBOX_GCC_fvisibility-hidden)"
$(call MSG_L1,IPRT: Testing mangling and visiblity...)
rcExit=0; \
for fn in ` readelf -Ws $^ \
| $(SED) \
-e '/^ *[[:digit:]]\+:/!d' \
-e 's/^ \+[[:digit:]]\+: \+[[:xdigit:]]\+ \+[[:digit:]]\+ \+//' \
-e '/^SECTION/d' \
-e '/^FILE/d' \
-e 's/^[[:alpha:]]\+ \+//' \
-e '/LOCAL/d' \
-e 's/^[[:alpha:]]\+ \+//' \
-e '/^HIDDEN/d' \
-e 's/^[[:alpha:]]\+ \+//' \
-e '/^UND/d' \
-e 's/^[[:digit:]]\+ \+//' \
\
-e '/^nocrt_/d' \
-e '/^memchr/d' \
-e '/^memcmp/d' \
-e '/^memcpy/d' \
-e '/^mempcpy/d' \
-e '/^memmove/d' \
-e '/^memset/d' \
-e '/^strchr/d' \
-e '/^strpbrk/d' \
-e '/^_Z7strpbrk/d' \
-e '/^strcmp/d' \
-e '/^strcpy/d' \
-e '/^strlen/d' \
-e '/^_Z[[:alpha:]]*[[:digit:]]\+RTC/d' \
\
-e '/^_ZNSt9bad_allocC1Ev/d' \
-e '/^_ZNSt9exceptionC2Ev/d' \
\
-e '/^_Z[[:digit:]]\+dbus/d' \
-e '/^_Z13RTDBusLoadLibv/d' \
\
-e '/^VBoxHost_/d'\
-e '/^VBoxGuest_/d'\
| sort -u \
`; \
do \
if $(SED) -ne '/\# *define '"$${fn}"' /q 1' $(PATH_ROOT)/include/iprt/mangling.h; then \
echo "mangling.h: Missing # define "$${fn}" RT_MANGLER("$${fn}")"; \
rcExit=1;\
fi \
done; \
exit $${rcExit}
else
$(call MSG_L1,IPRT: Testing mangling...)
rcExit=0; \
for fn in ` nm $^ \
| $(SED) -n \
-e 's/^[0-9a-f][0-9a-f]* //' \
-e '/^[TUDB] /!d' \
-e 's/^. //' \
\
-e '/^g_cchrt/d'\
-e '/^g_frt/d'\
-e '/^g_offrt/d'\
-e '/^g_pfnrt/d'\
-e '/^g_rt/d'\
-e '/^g_szrt/d'\
-e '/^g_ProcessSelf/d'\
-e '/^g_u64ProgramStart/d'\
-e '/^g_enmProcessPriority/d'\
-e '/^g_hDbgModStrCache/d'\
\
-e '/^RTDBusLoadLib/d' \
\
-e '/^RT/p' \
-e '/^g_/p' \
| sort -u \
`; \
do \
if $(SED) -ne '/\# *define '"$${fn}"' /q 1' $(PATH_ROOT)/include/iprt/mangling.h; then \
echo "mangling.h: Missing # define "$${fn}" RT_MANGLER("$${fn}")"; \
rcExit=1;\
fi \
done; \
exit $${rcExit}
endif
endif
$(QUIET)$(APPEND) -t $@
#
# Generate the rules (we're the to sub-makefile).
#
include $(KBUILD_PATH)/subfooter.kmk