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