VirtualBox

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

Last change on this file since 26003 was 25477, checked in by vboxsync, 15 years ago

include: Made the headers build cleanly on linux again.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.6 KB
Line 
1# $Id: Makefile.kmk 25477 2009-12-18 12:46:53Z 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 Sun Microsystems, Inc.
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# Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
19# Clara, CA 95054 USA or visit http://www.sun.com if you need
20# additional information or have any questions.
21#
22
23DEPTH = ..
24include $(KBUILD_PATH)/header.kmk
25
26LIBRARIES = SyntaxVBoxIncludeR3 SyntaxVBoxIncludeR0 SyntaxVBoxIncludeGC
27
28cpp_hdrs := \
29 VBox/dbggui.h \
30 VBox/settings.h \
31 $(wildcard iprt/*_cpp.h iprt/cpp/*.h )
32
33r3_only_hdrs := \
34 VBox/vrdpapi.h \
35 VBox/vrdpusb.h \
36 VBox/VBoxHDD.h \
37 VBox/VBoxHDD-Plugin.h \
38 VBox/dbus.h \
39 VBox/uvm.h \
40 iprt/tcp.h \
41 iprt/localipc.h \
42 iprt/linux/sysfs.h \
43
44# We omit a few headers which have platform specific issues or are templates.
45hdrs := $(filter-out \
46 VBox/VBoxGuest16.h \
47 VBox/VBoxGL2D.h \
48 VBox/WinNetConfig.h \
49 VBox/dbus-calls.h \
50 VBox/usblib-win.h \
51 VBox/usblib-solaris.h \
52 $(foreach os,$(filter-out $(KBUILD_TARGET),$(KBUILD_OSES)),iprt/$(os)/% VBox/$(os)/%) \
53 $(xforeach arch,$(KBUILD_ARCHES),iprt/nocrt/$(arch)/%) \
54 , $(wildcard VBox/*.h iprt/*.h iprt/*/*.h))
55
56hdrs.r3 := $(filter-out , $(hdrs))
57hdrs.r0 := $(filter-out $(cpp_hdrs) $(r3_only_hdrs), $(hdrs))
58hdrs.gc := $(filter-out \
59 VBox/VBoxGuestLib.h \
60 VBox/gvm.h \
61 iprt/thread.h \
62 iprt/mem.h \
63 iprt/alloc.h \
64 iprt/alloca.h \
65 $(cpp_hdrs) \
66 $(r3_only_hdrs) \
67 , $(hdrs))
68
69SyntaxVBoxIncludeR3_TEMPLATE = VBOXMAINEXE
70SyntaxVBoxIncludeR3_DEFS = VBOX_WITH_HGCM
71SyntaxVBoxIncludeR3_SOURCES := \
72 $(addprefix $(PATH_TARGET)/,$(subst .h,-c.c, $(subst /,_,$(hdrs.r3)))) \
73 $(addprefix $(PATH_TARGET)/,$(subst .h,-cpp.cpp, $(subst /,_,$(hdrs.r3))))
74
75SyntaxVBoxIncludeR0_TEMPLATE = VBOXR0
76SyntaxVBoxIncludeR0_DEFS = VBOX_WITH_HGCM
77SyntaxVBoxIncludeR0_SOURCES := \
78 $(addprefix $(PATH_TARGET)/,$(subst .h,-c.c, $(subst /,_,$(hdrs.r0)))) \
79 $(addprefix $(PATH_TARGET)/,$(subst .h,-cpp.cpp, $(subst /,_,$(hdrs.r0))))
80
81SyntaxVBoxIncludeGC_TEMPLATE = VBOXGC
82SyntaxVBoxIncludeGC_DEFS = VBOX_WITH_HGCM
83SyntaxVBoxIncludeGC_SOURCES := \
84 $(addprefix $(PATH_TARGET)/,$(subst .h,-c.c, $(subst /,_,$(hdrs.gc)))) \
85 $(addprefix $(PATH_TARGET)/,$(subst .h,-cpp.cpp, $(subst /,_,$(hdrs.gc))))
86
87
88# Comment out the next line to simplify header correction.
89VBOX_ROOT_INCLUDE_MAKEFILE = $(PATH_ROOT)/include/Makefile.kmk
90
91include $(KBUILD_PATH)/footer.kmk
92
93
94define def_hdr
95$(eval flatname := $(subst /,_,$(basename $(hdr))))
96$$(PATH_TARGET)/$(flatname)-cpp.cpp: $$(PATH_TARGET)/
97 $(QUIET)$$(APPEND) -t -n $$@ '#include <$(hdr)>' 'int main(int argc, char **argv) {(void)argc; (void)argv; return 0;}'
98
99$$(PATH_TARGET)/$(flatname)-c.c: $(VBOX_ROOT_INCLUDE_MAKEFILE) | $$(PATH_TARGET)/
100ifn1of ($(hdr),$(cpp_hdrs))
101 $(QUIET)$$(APPEND) -t -n $$@ '#include <$(hdr)>' 'int main(int argc, char **argv) {(void)argc; (void)argv; return 0;}'
102else
103 $(QUIET)$$(APPEND) -t -n $$@ 'int main(int argc, char **argv) {(void)argc; (void)argv; return 0;}'
104endif
105
106$(subst .h,.o,$(notdir $(hdr)))::
107 $$(MAKE) -f $(MAKEFILE) $(flatname)-c.o $(flatname)-cpp.o
108
109endef
110
111$(foreach hdr,$(hdrs), $(eval $(def_hdr)))
112
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