VirtualBox

source: vbox/trunk/include/Makefile.kmk@ 33826

Last change on this file since 33826 was 32336, checked in by vboxsync, 14 years ago

include/Makefile.kmk: alloca.h exclusion update.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 4.0 KB
Line 
1# $Id: Makefile.kmk 32336 2010-09-09 10:09:47Z vboxsync $
2## @file
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#
8# Copyright (C) 2006-2007 Oracle Corporation
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#
18
19DEPTH = ..
20include $(KBUILD_PATH)/header.kmk
21
22LIBRARIES = SyntaxVBoxIncludeR3 SyntaxVBoxIncludeR0 SyntaxVBoxIncludeRC
23
24# Omit headers that are using C++ features and upsets gcc.
25cpp_features_hdrs := \
26 VBox/hwaccm.h \
27 VBox/hwacc_vmx.h
28
29# Omit headers that are C++ and ring-3.
30r3_cpp_hdrs := \
31 VBox/dbggui.h \
32 VBox/settings.h \
33 $(wildcard iprt/*_cpp.h iprt/cpp/*.h )
34
35# Ring-3 only headers.
36r3_only_hdrs := \
37 VBox/vrdpapi.h \
38 VBox/vrdpusb.h \
39 VBox/VBoxHDD.h \
40 VBox/VBoxHDD-Plugin.h \
41 VBox/dbus.h \
42 VBox/uvm.h \
43 VBox/vscsi.h \
44 iprt/alloca.h \
45 iprt/tcp.h \
46 iprt/localipc.h \
47 iprt/linux/sysfs.h \
48 iprt/socket.h
49
50# We omit a few headers which have platform specific issues or are templates.
51hdrs := $(filter-out \
52 VBox/VBoxGuest16.h \
53 VBox/VBoxGL2D.h \
54 VBox/WinNetConfig.h \
55 VBox/usblib-win.h \
56 VBox/usblib-solaris.h \
57 VBox/VDEPlug.h \
58 \
59 VBox/dbus-calls.h \
60 VBox/VDEPlugSymDefs.h \
61 VBox/VBoxKeyboard.h \
62 iprt/runtime-loader.h \
63 \
64 $(foreach os,$(filter-out $(KBUILD_TARGET),$(KBUILD_OSES)),iprt/$(os)/% VBox/$(os)/%) \
65 $(xforeach arch,$(KBUILD_ARCHES),iprt/nocrt/$(arch)/%) \
66 , $(wildcard VBox/*.h iprt/*.h iprt/*/*.h))
67
68# ring-3, ring-0 and raw-mode context specific exclusions.
69hdrs.r3 := $(filter-out , $(hdrs))
70hdrs.r0 := $(filter-out $(r3_cpp_hdrs) $(r3_only_hdrs), $(hdrs))
71hdrs.rc := $(filter-out \
72 VBox/VBoxGuestLib.h \
73 VBox/gvm.h \
74 iprt/thread.h \
75 iprt/mem.h \
76 iprt/alloc.h \
77 $(r3_cpp_hdrs) \
78 $(r3_only_hdrs) \
79 , $(hdrs))
80
81SyntaxVBoxIncludeR3_TEMPLATE = VBOXMAINEXE
82SyntaxVBoxIncludeR3_DEFS = VBOX_WITH_HGCM
83SyntaxVBoxIncludeR3_CDEFS = VBOX_WITHOUT_UNNAMED_UNIONS
84SyntaxVBoxIncludeR3_SOURCES := \
85 $(addprefix $(PATH_TARGET)/,$(subst .h,-c.c, $(subst /,_,$(hdrs.r3)))) \
86 $(addprefix $(PATH_TARGET)/,$(subst .h,-cpp.cpp, $(subst /,_,$(hdrs.r3))))
87
88SyntaxVBoxIncludeR0_TEMPLATE = VBoxR0
89SyntaxVBoxIncludeR0_DEFS = VBOX_WITH_HGCM
90SyntaxVBoxIncludeR0_CDEFS = VBOX_WITHOUT_UNNAMED_UNIONS
91SyntaxVBoxIncludeR0_SOURCES := \
92 $(addprefix $(PATH_TARGET)/,$(subst .h,-c.c, $(subst /,_,$(hdrs.r0)))) \
93 $(addprefix $(PATH_TARGET)/,$(subst .h,-cpp.cpp, $(subst /,_,$(hdrs.r0))))
94
95SyntaxVBoxIncludeRC_TEMPLATE = VBoxRc
96SyntaxVBoxIncludeRC_DEFS = VBOX_WITH_HGCM
97SyntaxVBoxIncludeRC_CDEFS = VBOX_WITHOUT_UNNAMED_UNIONS
98SyntaxVBoxIncludeRC_SOURCES := \
99 $(addprefix $(PATH_TARGET)/,$(subst .h,-c.c, $(subst /,_,$(hdrs.rc)))) \
100 $(addprefix $(PATH_TARGET)/,$(subst .h,-cpp.cpp, $(subst /,_,$(hdrs.rc))))
101
102
103# Comment out the next line to simplify header correction.
104VBOX_ROOT_INCLUDE_MAKEFILE = $(PATH_ROOT)/include/Makefile.kmk
105
106include $(KBUILD_PATH)/footer.kmk
107
108
109define def_hdr
110$(eval flatname := $(subst /,_,$(basename $(hdr))))
111$$(PATH_TARGET)/$(flatname)-cpp.cpp: $$(PATH_TARGET)/
112 $(QUIET)$$(APPEND) -t -n $$@ '#include <$(hdr)>' 'int main(int argc, char **argv) {(void)argc; (void)argv; return 0;}'
113
114$$(PATH_TARGET)/$(flatname)-c.c: $(VBOX_ROOT_INCLUDE_MAKEFILE) | $$(PATH_TARGET)/
115ifn1of ($(hdr), $(r3_cpp_hdrs) $(cpp_features_hdrs) )
116 $(QUIET)$$(APPEND) -t -n $$@ '#include <$(hdr)>' 'int main(int argc, char **argv) {(void)argc; (void)argv; return 0;}'
117else
118 $(QUIET)$$(APPEND) -t -n $$@ 'int main(int argc, char **argv) {(void)argc; (void)argv; return 0;}'
119endif
120
121$(subst .h,.o,$(notdir $(hdr)))::
122 $$(MAKE) -f $(MAKEFILE) $(flatname)-c.o $(flatname)-cpp.o
123
124endef
125
126$(foreach hdr,$(hdrs), $(eval $(def_hdr)))
127
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette