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