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 |
|
---|
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 |
|
---|
29 | # Omit headers that are C++ and ring-3.
|
---|
30 | r3_cpp_hdrs := \
|
---|
31 | VBox/dbggui.h \
|
---|
32 | VBox/settings.h \
|
---|
33 | $(wildcard iprt/*_cpp.h iprt/cpp/*.h )
|
---|
34 |
|
---|
35 | # Ring-3 only headers.
|
---|
36 | r3_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.
|
---|
51 | hdrs := $(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.
|
---|
69 | hdrs.r3 := $(filter-out , $(hdrs))
|
---|
70 | hdrs.r0 := $(filter-out $(r3_cpp_hdrs) $(r3_only_hdrs), $(hdrs))
|
---|
71 | hdrs.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 |
|
---|
81 | SyntaxVBoxIncludeR3_TEMPLATE = VBOXMAINEXE
|
---|
82 | SyntaxVBoxIncludeR3_DEFS = VBOX_WITH_HGCM
|
---|
83 | SyntaxVBoxIncludeR3_CDEFS = VBOX_WITHOUT_UNNAMED_UNIONS
|
---|
84 | SyntaxVBoxIncludeR3_SOURCES := \
|
---|
85 | $(addprefix $(PATH_TARGET)/,$(subst .h,-c.c, $(subst /,_,$(hdrs.r3)))) \
|
---|
86 | $(addprefix $(PATH_TARGET)/,$(subst .h,-cpp.cpp, $(subst /,_,$(hdrs.r3))))
|
---|
87 |
|
---|
88 | SyntaxVBoxIncludeR0_TEMPLATE = VBoxR0
|
---|
89 | SyntaxVBoxIncludeR0_DEFS = VBOX_WITH_HGCM
|
---|
90 | SyntaxVBoxIncludeR0_CDEFS = VBOX_WITHOUT_UNNAMED_UNIONS
|
---|
91 | SyntaxVBoxIncludeR0_SOURCES := \
|
---|
92 | $(addprefix $(PATH_TARGET)/,$(subst .h,-c.c, $(subst /,_,$(hdrs.r0)))) \
|
---|
93 | $(addprefix $(PATH_TARGET)/,$(subst .h,-cpp.cpp, $(subst /,_,$(hdrs.r0))))
|
---|
94 |
|
---|
95 | SyntaxVBoxIncludeRC_TEMPLATE = VBoxRc
|
---|
96 | SyntaxVBoxIncludeRC_DEFS = VBOX_WITH_HGCM
|
---|
97 | SyntaxVBoxIncludeRC_CDEFS = VBOX_WITHOUT_UNNAMED_UNIONS
|
---|
98 | SyntaxVBoxIncludeRC_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.
|
---|
104 | VBOX_ROOT_INCLUDE_MAKEFILE = $(PATH_ROOT)/include/Makefile.kmk
|
---|
105 |
|
---|
106 | include $(KBUILD_PATH)/footer.kmk
|
---|
107 |
|
---|
108 |
|
---|
109 | define 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)/
|
---|
115 | ifn1of ($(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;}'
|
---|
117 | else
|
---|
118 | $(QUIET)$$(APPEND) -t -n $$@ 'int main(int argc, char **argv) {(void)argc; (void)argv; return 0;}'
|
---|
119 | endif
|
---|
120 |
|
---|
121 | $(subst .h,.o,$(notdir $(hdr)))::
|
---|
122 | $$(MAKE) -f $(MAKEFILE) $(flatname)-c.o $(flatname)-cpp.o
|
---|
123 |
|
---|
124 | endef
|
---|
125 |
|
---|
126 | $(foreach hdr,$(hdrs), $(eval $(def_hdr)))
|
---|
127 |
|
---|