Makefile.kmk revision 5c47137ffdbcb823e83b3cfc93bf8ccd3318bec3
09fe0b69d3d1e8c8041c9ce99ee77b8b44b5e3b1fielding# Sub-Makefile for the IPRT (IPRT).
09fe0b69d3d1e8c8041c9ce99ee77b8b44b5e3b1fielding# Copyright (C) 2006-2011 Oracle Corporation
09fe0b69d3d1e8c8041c9ce99ee77b8b44b5e3b1fielding# This file is part of VirtualBox Open Source Edition (OSE), as
09fe0b69d3d1e8c8041c9ce99ee77b8b44b5e3b1fielding# available from http://www.virtualbox.org. This file is free software;
09fe0b69d3d1e8c8041c9ce99ee77b8b44b5e3b1fielding# you can redistribute it and/or modify it under the terms of the GNU
09fe0b69d3d1e8c8041c9ce99ee77b8b44b5e3b1fielding# General Public License (GPL) as published by the Free Software
09fe0b69d3d1e8c8041c9ce99ee77b8b44b5e3b1fielding# Foundation, in version 2 as it comes in the "COPYING" file of the
09fe0b69d3d1e8c8041c9ce99ee77b8b44b5e3b1fielding# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
09fe0b69d3d1e8c8041c9ce99ee77b8b44b5e3b1fielding# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
09fe0b69d3d1e8c8041c9ce99ee77b8b44b5e3b1fielding# The contents of this file may alternatively be used under the terms
09fe0b69d3d1e8c8041c9ce99ee77b8b44b5e3b1fielding# of the Common Development and Distribution License Version 1.0
09fe0b69d3d1e8c8041c9ce99ee77b8b44b5e3b1fielding# (CDDL) only, as it comes in the "COPYING.CDDL" file of the
09fe0b69d3d1e8c8041c9ce99ee77b8b44b5e3b1fielding# VirtualBox OSE distribution, in which case the provisions of the
09fe0b69d3d1e8c8041c9ce99ee77b8b44b5e3b1fielding# CDDL are applicable instead of those of the GPL.
09fe0b69d3d1e8c8041c9ce99ee77b8b44b5e3b1fielding# You may elect to license modified versions of this file under the
09fe0b69d3d1e8c8041c9ce99ee77b8b44b5e3b1fielding# terms and conditions of either the GPL or the CDDL or both.
09fe0b69d3d1e8c8041c9ce99ee77b8b44b5e3b1fieldingSUB_DEPTH = ../../..
09fe0b69d3d1e8c8041c9ce99ee77b8b44b5e3b1fieldinginclude $(KBUILD_PATH)/subheader.kmk
09fe0b69d3d1e8c8041c9ce99ee77b8b44b5e3b1fieldingifdef VBOX_ONLY_ADDITIONS
09fe0b69d3d1e8c8041c9ce99ee77b8b44b5e3b1fielding # Only build the additions, sort out the legacy names first.
09fe0b69d3d1e8c8041c9ce99ee77b8b44b5e3b1fielding LIBRARIES += RuntimeGuestR3 RuntimeGuestR3Shared RuntimeGuestR3Mini
09fe0b69d3d1e8c8041c9ce99ee77b8b44b5e3b1fielding LIBRARIES.win.amd64 += RuntimeGuestR3-x86 RuntimeGuestR3Shared-x86
09fe0b69d3d1e8c8041c9ce99ee77b8b44b5e3b1fielding ifdef VBOX_WITH_ADDITION_DRIVERS
09fe0b69d3d1e8c8041c9ce99ee77b8b44b5e3b1fielding LIBRARIES += RuntimeGuestR0
09fe0b69d3d1e8c8041c9ce99ee77b8b44b5e3b1fielding #LIBRARIES.os2 += RuntimeGuestR0OS2Warp3
09fe0b69d3d1e8c8041c9ce99ee77b8b44b5e3b1fielding LIBRARIES.win.x86 += RuntimeGuestR0NT4
09fe0b69d3d1e8c8041c9ce99ee77b8b44b5e3b1fieldingelse ifdef VBOX_ONLY_TESTSUITE
09fe0b69d3d1e8c8041c9ce99ee77b8b44b5e3b1fielding # Only build the testsuite.
09fe0b69d3d1e8c8041c9ce99ee77b8b44b5e3b1fielding LIBRARIES += RuntimeGuestR3 RuntimeGuestR3Shared RuntimeR3 RuntimeR0
09fe0b69d3d1e8c8041c9ce99ee77b8b44b5e3b1fielding LIBRARIES.solaris += RuntimeR0Stub
09fe0b69d3d1e8c8041c9ce99ee77b8b44b5e3b1fielding LIBRARIES.win += RuntimeR0Stub
09fe0b69d3d1e8c8041c9ce99ee77b8b44b5e3b1fieldingelse ifdef VBOX_ONLY_DOCS
09fe0b69d3d1e8c8041c9ce99ee77b8b44b5e3b1fielding # Build docs only - need just regular R3 runtime.
09fe0b69d3d1e8c8041c9ce99ee77b8b44b5e3b1fielding LIBRARIES += RuntimeR3
LIBRARIES.solaris += RuntimeR0Stub
LIBRARIES.win += RuntimeR0Stub RuntimeRCStub
include $(PATH_SUB_CURRENT)/tools/Makefile.kmk
include $(PATH_SUB_CURRENT)/testcase/Makefile.kmk
include $(PATH_SUB_CURRENT)/tools/Makefile.kmk
LIBRARIES.solaris += RuntimeR0Stub
LIBRARIES.win += RuntimeR0Stub
LIBRARIES.win += RuntimeRCStub
LIBRARIES.win.amd64 += RuntimeGuestR3-x86 RuntimeGuestR3Shared-x86
#LIBRARIES.os2 += RuntimeGuestR0OS2Warp3
LIBRARIES.win.x86 += RuntimeGuestR0NT4
LIBRARIES.l4 += RuntimeR3L4 RuntimeLnxHostR3
LIBRARIES.win += RuntimeR3NtDll-x86
LIBRARIES.win += RuntimeR3NtDll-amd64
$(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
# Set the defines that buildconfig.cpp needs. Its used by several targets.
# Unicode Specification reader used to regenerate unidata.cpp.
uniread_SOURCES = common/string/uniread.cpp
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
ifdef VBOX_MAIN_RELEASE_LOG ## @todo (dmik): temporary, until RTThreadSelf/RTThreadAdopt are properly updated
RuntimeR3_DEFS.linux += IPRT_WITH_FUTEX_BASED_SEMS
$(PATH_ROOT)/src/libs/liblzf-3.4
$(PATH_ROOT)/src/libs/kStuff/kStuff/include
# RuntimeR3_INCS.solaris = \
# RuntimeR3_SOURCES += common/time/timesupA.asm
RuntimeR3_SOURCES += common/time/timesupref.cpp
RuntimeR3_SOURCES += common/misc/lzjb.c
$(if $(VBOX_WITH_DBUS),VBox/dbus.cpp,)
RuntimeR3_SOURCES.win.amd64 = $(RuntimeWin64ASM_SOURCES)
RuntimeR3_SOURCES.win.x86 = $(RuntimeWin32ASM_SOURCES)
# RuntimeGuestR3 - Guest Additions Runtime (static/exe).
RuntimeGuestR3_SOURCES.$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH) := $(RuntimeR3_SOURCES.$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH))
RuntimeGuestR3_SOURCES.$(KBUILD_HOST).$(KBUILD_TARGET_ARCH) := $(RuntimeR3_SOURCES.$(KBUILD_HOST).$(KBUILD_TARGET_ARCH))
# RuntimeGuestR3Shared - Guest Additions Runtime (static/dll).
$(RuntimeR3_SOURCES.linux.$(KBUILD_TARGET_ARCH)) \
$(RuntimeR3_INCS.linux.$(KBUILD_TARGET_ARCH)) \
$(RuntimeR3_INCS.linux) \
VBoxRT_SDKS.win = WINPSDK $(VBOX_WINDDK) VBOX_NTDLL
$(filter-out common/checksum/crc32.cpp, $(RuntimeR3_SOURCES)) \
VBoxRT_SOURCES += common/misc/s3.cpp
VBoxRT_SOURCES.$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH) = $(RuntimeR3_SOURCES.$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH))
VBoxRT_SOURCES.win += \
$(VBoxRT_0_OUTDIR)/VBoxRT.def
VBoxRT_SOURCES.linux += \
VBoxRT_INCS.$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH) = $(RuntimeR3_INCS.$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH))
VBoxRT_LIBS.solaris += smbios
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
VBoxRT_LDFLAGS.win = /MANIFEST
$(L4_LIBDIR)/libl4sys.a \
$(L4_LIBDIR)/libl4sys.p.a
VBoxRT_LIBS.l4 = \
$$(VBoxRT_0_OUTDIR)/VBoxRT.def: \
$(PATH_SUB_CURRENT)/r3/win/VBoxRT-$$(if-expr $$(KBUILD_TARGET_ARCH) == amd64,win64,win32).def \
ifneq ($(wildcard /usr/bin/chcon),)
VBoxRTDummy_LIBS = $(PATH_BIN)/VBoxRT.so
VBoxRTDummy_CLEAN= $(PATH_BIN)/VBoxRT.so
$(PATH_BIN)/VBoxRT.so: $$(VBoxRT_1_TARGET) | $$(dir $$@)
# 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)
$(call VBOX_GENERATE_IMPORT_TARGET_FN,VBoxRTImp,VBoxRT,VBox/VBoxRTImp.def r3/win/VBoxRT-openssl-ose.def)
## @todo the *_alias.c stuff is busted, remove and use RT_WITH_NOCRT_ALIASES instead.
# RuntimeR0_SOURCES += common/time/timesupA.asm
RuntimeR0_SOURCES += common/time/timesupref.cpp
RuntimeR0_SOURCES.win.amd64 = $(RuntimeWin64ASM_SOURCES)
RuntimeR0_SOURCES.win.x86 = $(RuntimeWin32ASM_SOURCES)
RuntimeR0Drv_SDKS.win = $(VBOX_WINDDK) WINPSDKINCS
RuntimeR0Drv_DEFS.win = IN_SUP_R0
RuntimeR0Drv_DEFS.linux = MODULE KBUILD_MODNAME=KBUILD_STR\(vboxdrv\) KBUILD_BASENAME=KBUILD_STR\(vboxdrv\) IN_SUP_R0
RuntimeR0Drv_SOURCES.win.amd64 = $(RuntimeWin64ASM_SOURCES)
RuntimeR0Drv_SOURCES.win.x86 = $(RuntimeWin32ASM_SOURCES)
$(PATH_INS)/gen-sys-hdrs/bus_if.h \
$(PATH_INS)/gen-sys-hdrs/device_if.h
# is in the backdoor logging and the lack of sup.h (which should be
RuntimeGuestR0_SOURCES := $(filter-out generic/RTLogWriteUser-generic.cpp, $(RuntimeR0Drv_SOURCES))
# RuntimeRC_SOURCES += common/time/timesupA.asm
RuntimeRC_SOURCES += common/time/timesupref.cpp
RuntimeRC_SOURCES.win.x86 = $(RuntimeWin32ASM_SOURCES)
RuntimeRC_SOURCES += os2/sys0.asm
RuntimeEFCPP_SOURCES = r3/alloc-ef-cpp.cpp
# later WINDDK ntdll.lib have and thus we may easily end up with
# errmsg.cpp depends on a generated header.
common/err/errmsg.cpp_INCS = $(IPRT_OUT_DIR)
win/errmsgwin.cpp_INCS = $(IPRT_OUT_DIR)
$(lib)_common/err/errmsgxpcom.cpp_INCS = $(IPRT_OUT_DIR)
$(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 \
$(IPRT_OUT_DIR)/errmsgcomdata.h: \
$(VBOX_PATH_RUNTIME_SRC)/common/err/errmsgcom.sed \
$$(PATH_SDK_WINPSDK_INC)/WinError.h \
$(IPRT_OUT_DIR)/errmsgvboxcomdata.h: \
$(VBOX_PATH_RUNTIME_SRC)/VBox/errmsgvboxcom.xsl \
VBOX_AWK := /usr/bin/awk
$(FreeBSDGeneratedKernelHeaders_0_OUTDIR)/bus_if.h \
$(FreeBSDGeneratedKernelHeaders_0_OUTDIR)/device_if.h \
$(FreeBSDGeneratedKernelHeaders_0_OUTDIR)/pci_if.h
$$(FreeBSDGeneratedKernelHeaders_0_OUTDIR)/bus_if.h: $(VBOX_FREEBSD_SRC)/kern/bus_if.m | $$(dir $$@)
$(QUIET)$(CP) -f $< $(@D)/bus_if.m
$(QUIET)$(RM) $(@D)/bus_if.m
$$(FreeBSDGeneratedKernelHeaders_0_OUTDIR)/device_if.h: $(VBOX_FREEBSD_SRC)/kern/device_if.m | $$(dir $$@)
$(QUIET)$(CP) -f $< $(@D)/device_if.m
$(QUIET)$(RM) $(@D)/device_if.m
$$(FreeBSDGeneratedKernelHeaders_0_OUTDIR)/pci_if.h: $(VBOX_FREEBSD_SRC)/dev/pci/pci_if.m | $$(dir $$@)
$(QUIET)$(CP) -f $< $(@D)/pci_if.m
$(QUIET)$(RM) $(@D)/pci_if.m
# Aliases for .cpp.h files so we can more easily do syntax checking from the editor.
$(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 \
$(foreach dir, $(VBOX_PATH_RUNTIME_SRC) $(VBOX_PATH_RUNTIME_SRC)/r3 $(VBOX_PATH_RUNTIME_SRC)/r0drv,\
$(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 \
$(filter-out %.cpp.h, $(sort $(wildcard $(addsuffix /*.h, $(IPRT_DOXYFILE_INPUT_DIRS)))) ) \
IPRT_DOXYFILE_OUTPUT = $(PATH_OUT)/docs/iprt
includedep $(IPRT_OUT_DIR)/Doxyfile.iprt.dep
$(IPRT_OUT_DIR)/Doxyfile.iprt: \
$(VBOX_PATH_RUNTIME_SRC)/Makefile.kmk \
$(APPEND) $@.tmp "INCLUDE_PATH = $(PATH_ROOT)/include include . common/table"
$(APPEND) $@.tmp "INCLUDE_FILE_PATTERNS = *.cpp.h"
$(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
docs: $(IPRT_OUT_DIR)/docs.iprt
test-mangling:: $(IPRT_OUT_DIR)/mangling.run
OTHERS += $(IPRT_OUT_DIR)/mangling.run
CLEANS += $(IPRT_OUT_DIR)/mangling.run
$(IPRT_OUT_DIR)/mangling.run: \
if $(SED) -ne '/\# *define '"$${fn}"' /q 1' $(PATH_ROOT)/include/iprt/mangling.h; then \
echo "mangling.h: Missing # define "$${fn}" RT_MANGLER("$${fn}")"; \
if $(SED) -ne '/\# *define '"$${fn}"' /q 1' $(PATH_ROOT)/include/iprt/mangling.h; then \
echo "mangling.h: Missing # define "$${fn}" RT_MANGLER("$${fn}")"; \
include $(KBUILD_PATH)/subfooter.kmk