1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150
|
# $Id: Makefile.kmk $
## @file
# Some hacks to allow syntax and prerequisite include checking of headers.
# This makefile doesn't and shouldn't build successfully.
#
#
# Copyright (C) 2006-2012 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.
#
DEPTH = ..
include $(KBUILD_PATH)/header.kmk
LIBRARIES = SyntaxVBoxIncludeR3 SyntaxVBoxIncludeR0 SyntaxVBoxIncludeRC
# Omit headers that are using C++ features and upsets gcc.
cpp_features_hdrs := \
VBox/vmm/hm.h \
VBox/vmm/hm_vmx.h \
VBox/HostServices/GuestControlSvc.h \
VBox/VBoxCrHgsmi.h \
VBox/VBoxUhgsmi.h
# Omit headers that are C++ and ring-3.
r3_cpp_hdrs := \
VBox/dbggui.h \
VBox/settings.h \
VBox/com/Guid.h \
VBox/HostServices/GuestPropertySvc.h \
$(wildcard iprt/*_cpp.h iprt/cpp/*.h VBox/com/*.h )
# Ring-3 only headers.
r3_only_hdrs := \
VBox/vrdpapi.h \
VBox/vrdpusb.h \
VBox/VBoxHDD.h \
VBox/VBoxHDD-Plugin.h \
VBox/VBoxCrHgsmi.h \
VBox/VBoxUhgsmi.h \
VBox/dbus.h \
VBox/vd.h \
VBox/vd-plugin.h \
VBox/vd-cache-plugin.h \
VBox/vmm/uvm.h \
VBox/vscsi.h \
$(wildcard VBox/ExtPack/*.h ) \
iprt/alloca.h \
iprt/tcp.h \
iprt/localipc.h \
iprt/linux/sysfs.h \
iprt/socket.h
# We omit a few headers which have platform specific issues or are templates.
hdrs := $(filter-out \
VBox/HostServices/glext.h \
VBox/HostServices/glxext.h \
VBox/HostServices/wglext.h \
VBox/VBoxGuest16.h \
VBox/VBoxGL2D.h \
VBox/WinNetConfig.h \
VBox/usblib-win.h \
VBox/usblib-solaris.h \
VBox/VDEPlug.h \
$(if-expr "$(KBUILD_TARGET)" != "win", \
VBox/VBoxDrvCfg-win.h \
VBox/VBoxNetCfg-win.h \
,) \
\
VBox/dbus-calls.h \
VBox/VDEPlugSymDefs.h \
VBox/VBoxKeyboard.h \
iprt/runtime-loader.h \
iprt/mangling.h \
\
$(foreach os,$(filter-out $(KBUILD_TARGET),$(KBUILD_OSES)),iprt/$(os)/% VBox/$(os)/%) \
$(xforeach arch,$(KBUILD_ARCHES),iprt/nocrt/$(arch)/%) \
, $(wildcard VBox/*.h VBox/*/*.h iprt/*.h iprt/*/*.h))
# ring-3, ring-0 and raw-mode context specific exclusions.
hdrs.r3 := $(filter-out , $(hdrs))
hdrs-c.r3 := $(filter-out $(cpp_features_hdrs) $(r3_cpp_hdrs), $(hdrs.r3))
hdrs.r0 := $(filter-out $(r3_cpp_hdrs) $(r3_only_hdrs), $(hdrs))
hdrs-c.r0 := $(filter-out $(cpp_features_hdrs), $(hdrs.r0))
hdrs.rc := $(filter-out \
VBox/VBoxGuestLib.h \
VBox/vmm/gvm.h \
iprt/thread.h \
iprt/mem.h \
iprt/memsafer.h \
iprt/alloc.h \
$(r3_cpp_hdrs) \
$(r3_only_hdrs) \
, $(hdrs))
hdrs-c.rc := $(filter-out $(cpp_features_hdrs), $(hdrs.rc))
SyntaxVBoxIncludeR3_TEMPLATE = VBOXMAINEXE
SyntaxVBoxIncludeR3_DEFS = VBOX_WITH_HGCM
SyntaxVBoxIncludeR3_CDEFS = VBOX_WITHOUT_UNNAMED_UNIONS
SyntaxVBoxIncludeR3_SOURCES := \
$(addprefix $(PATH_TARGET)/,$(subst .h,-c.c, $(subst /,_,$(hdrs-c.r3)))) \
$(addprefix $(PATH_TARGET)/,$(subst .h,-cpp.cpp, $(subst /,_,$(hdrs.r3))))
SyntaxVBoxIncludeR0_TEMPLATE = VBoxR0
SyntaxVBoxIncludeR0_DEFS = VBOX_WITH_HGCM
SyntaxVBoxIncludeR0_CDEFS = VBOX_WITHOUT_UNNAMED_UNIONS
SyntaxVBoxIncludeR0_SOURCES := \
$(addprefix $(PATH_TARGET)/,$(subst .h,-c.c, $(subst /,_,$(hdrs-c.r0)))) \
$(addprefix $(PATH_TARGET)/,$(subst .h,-cpp.cpp, $(subst /,_,$(hdrs.r0))))
SyntaxVBoxIncludeRC_TEMPLATE = VBoxRc
SyntaxVBoxIncludeRC_DEFS = VBOX_WITH_HGCM
SyntaxVBoxIncludeRC_CDEFS = VBOX_WITHOUT_UNNAMED_UNIONS
SyntaxVBoxIncludeRC_SOURCES := \
$(addprefix $(PATH_TARGET)/,$(subst .h,-c.c, $(subst /,_,$(hdrs-c.rc)))) \
$(addprefix $(PATH_TARGET)/,$(subst .h,-cpp.cpp, $(subst /,_,$(hdrs.rc))))
# Comment out the next line to simplify header correction.
VBOX_ROOT_INCLUDE_MAKEFILE = $(PATH_ROOT)/include/Makefile.kmk
include $(FILE_KBUILD_FOOTER)
define def_hdr
$(eval flatname := $(subst /,_,$(basename $(hdr))))
$$(PATH_TARGET)/$(flatname)-cpp.cpp: $(VBOX_ROOT_INCLUDE_MAKEFILE) | $$(PATH_TARGET)/
$(QUIET)$$(APPEND) -t -n $$@ '#include <$(hdr)>' 'int main(int argc, char **argv) {(void)argc; (void)argv; return 0;}'
$$(PATH_TARGET)/$(flatname)-c.c: $(VBOX_ROOT_INCLUDE_MAKEFILE) | $$(PATH_TARGET)/
$(QUIET)$$(APPEND) -t -n $$@ '#include <$(hdr)>' 'int main(int argc, char **argv) {(void)argc; (void)argv; return 0;}'
$(subst .h,.o,$(notdir $(hdr)))::
if1of ($(hdr), $(r3_cpp_hdrs) $(cpp_features_hdrs))
$$(MAKE) -f $(MAKEFILE) $(flatname)-cpp.o
else
$$(MAKE) -f $(MAKEFILE) $(flatname)-c.o $(flatname)-cpp.o
endif
endef
$(foreach hdr,$(hdrs), $(eval $(def_hdr)))
|