1 | # $Id: Makefile.kmk 7133 2008-02-25 18:20:27Z 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 innotek GmbH
|
---|
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 $(PATH_KBUILD)/header.kmk
|
---|
21 |
|
---|
22 | LIBRARIES = SyntaxVBoxIncludeR3 SyntaxVBoxIncludeR0 SyntaxVBoxIncludeGC
|
---|
23 |
|
---|
24 | cpp_hdrs := \
|
---|
25 | VBox/dbggui.h \
|
---|
26 | VBox/settings.h \
|
---|
27 | iprt/cpputils.h \
|
---|
28 | iprt/lock.h
|
---|
29 |
|
---|
30 | r3_only_hdrs := \
|
---|
31 | VBox/vrdpapi.h \
|
---|
32 | VBox/vrdpusb.h \
|
---|
33 | VBox/VBoxHDD-new.h \
|
---|
34 | VBox/VBoxHDD.h \
|
---|
35 | iprt/tcp.h \
|
---|
36 |
|
---|
37 | hdrs := $(filter-out \
|
---|
38 | VBox/VBoxGuest16.h \
|
---|
39 | VBox/tapwin32.h \
|
---|
40 | VBox/usblib-win.h, \
|
---|
41 | $(wildcard VBox/*.h iprt/*.h))
|
---|
42 |
|
---|
43 | hdrs.r3 := $(filter-out VBox/VBoxGuestLib.h, $(hdrs))
|
---|
44 | hdrs.r0 := $(filter-out $(cpp_hdrs) $(r3_only_hdrs), $(hdrs))
|
---|
45 | hdrs.gc := $(filter-out \
|
---|
46 | VBox/VBoxGuestLib.h \
|
---|
47 | VBox/gvm.h \
|
---|
48 | iprt/thread.h \
|
---|
49 | iprt/mem.h \
|
---|
50 | iprt/alloc.h \
|
---|
51 | $(cpp_hdrs) $(r3_only_hdrs), \
|
---|
52 | $(hdrs))
|
---|
53 |
|
---|
54 | SyntaxVBoxIncludeR3_TEMPLATE = VBOXMAINEXE
|
---|
55 | SyntaxVBoxIncludeR3_DEFS = VBOX_HGCM
|
---|
56 | SyntaxVBoxIncludeR3_SOURCES := \
|
---|
57 | $(addprefix $(PATH_TARGET)/,$(subst .h,-c.c, $(subst /,_,$(hdrs.r3)))) \
|
---|
58 | $(addprefix $(PATH_TARGET)/,$(subst .h,-cpp.cpp, $(subst /,_,$(hdrs.r3))))
|
---|
59 |
|
---|
60 | SyntaxVBoxIncludeR0_TEMPLATE = VBOXR0
|
---|
61 | SyntaxVBoxIncludeR0_DEFS = VBOX_HGCM
|
---|
62 | SyntaxVBoxIncludeR0_SOURCES := \
|
---|
63 | $(addprefix $(PATH_TARGET)/,$(subst .h,-c.c, $(subst /,_,$(hdrs.r0)))) \
|
---|
64 | $(addprefix $(PATH_TARGET)/,$(subst .h,-cpp.cpp, $(subst /,_,$(hdrs.r0))))
|
---|
65 |
|
---|
66 | SyntaxVBoxIncludeGC_TEMPLATE = VBOXGC
|
---|
67 | SyntaxVBoxIncludeGC_DEFS = VBOX_HGCM
|
---|
68 | SyntaxVBoxIncludeGC_SOURCES := \
|
---|
69 | $(addprefix $(PATH_TARGET)/,$(subst .h,-c.c, $(subst /,_,$(hdrs.gc)))) \
|
---|
70 | $(addprefix $(PATH_TARGET)/,$(subst .h,-cpp.cpp, $(subst /,_,$(hdrs.gc))))
|
---|
71 |
|
---|
72 |
|
---|
73 |
|
---|
74 | include $(PATH_KBUILD)/footer.kmk
|
---|
75 |
|
---|
76 |
|
---|
77 | define def_hdr
|
---|
78 | $(eval flatname := $(subst /,_,$(basename $(hdr))))
|
---|
79 | $$(PATH_TARGET)/$(flatname)-cpp.cpp:
|
---|
80 | $$(MKDIR) -p $$(dir $$@)
|
---|
81 | $$(RM) -f $$@
|
---|
82 | $$(APPEND) $$@ "#include <$(hdr)>"
|
---|
83 | $$(APPEND) $$@ "int main(int argc, char **argv) {(void)argc; (void)argv; return 0;}"
|
---|
84 |
|
---|
85 | $$(PATH_TARGET)/$(flatname)-c.c: Makefile.kmk
|
---|
86 | $$(MKDIR) -p $$(dir $$@)
|
---|
87 | $$(RM) -f $$@
|
---|
88 | ifn1of ($(hdr),$(cpp_hdrs))
|
---|
89 | $$(APPEND) $$@ "#include <$(hdr)>"
|
---|
90 | endif
|
---|
91 | $$(APPEND) $$@ "int main(int argc, char **argv) {(void)argc; (void)argv; return 0;}"
|
---|
92 |
|
---|
93 | $(subst .h,.o,$(notdir $(hdr)))::
|
---|
94 | $$(MAKE) -f $(MAKEFILE) $(flatname)-c.o $(flatname)-cpp.o
|
---|
95 |
|
---|
96 | endef
|
---|
97 |
|
---|
98 | $(foreach hdr,$(hdrs), $(eval $(def_hdr)))
|
---|
99 |
|
---|