VirtualBox

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

Last change on this file since 31868 was 30788, checked in by vboxsync, 14 years ago

include,Config.kmk: Made the headers syntax check cleanly on linux.amd64 w/ gcc v4.3.4.

  • 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 30788 2010-07-12 11:20:45Z 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/tcp.h \
45 iprt/localipc.h \
46 iprt/linux/sysfs.h \
47 iprt/socket.h
48
49# We omit a few headers which have platform specific issues or are templates.
50hdrs := $(filter-out \
51 VBox/VBoxGuest16.h \
52 VBox/VBoxGL2D.h \
53 VBox/WinNetConfig.h \
54 VBox/usblib-win.h \
55 VBox/usblib-solaris.h \
56 VBox/VDEPlug.h \
57 \
58 VBox/dbus-calls.h \
59 VBox/VDEPlugSymDefs.h \
60 VBox/VBoxKeyboard.h \
61 iprt/runtime-loader.h \
62 \
63 $(foreach os,$(filter-out $(KBUILD_TARGET),$(KBUILD_OSES)),iprt/$(os)/% VBox/$(os)/%) \
64 $(xforeach arch,$(KBUILD_ARCHES),iprt/nocrt/$(arch)/%) \
65 , $(wildcard VBox/*.h iprt/*.h iprt/*/*.h))
66
67# ring-3, ring-0 and raw-mode context specific exclusions.
68hdrs.r3 := $(filter-out , $(hdrs))
69hdrs.r0 := $(filter-out $(r3_cpp_hdrs) $(r3_only_hdrs), $(hdrs))
70hdrs.rc := $(filter-out \
71 VBox/VBoxGuestLib.h \
72 VBox/gvm.h \
73 iprt/thread.h \
74 iprt/mem.h \
75 iprt/alloc.h \
76 iprt/alloca.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