VirtualBox

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

Last change on this file since 55966 was 51770, checked in by vboxsync, 10 years ago

Merged in iprt++ dev branch.

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