1 | # $Id: Makefile.kmk 2981 2007-06-01 16:01:28Z 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 as published by the Free Software Foundation,
|
---|
14 | # in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
|
---|
15 | # distribution. VirtualBox OSE is distributed in the hope that it will
|
---|
16 | # be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
17 | #
|
---|
18 | # If you received this file as part of a commercial VirtualBox
|
---|
19 | # distribution, then only the terms of your commercial VirtualBox
|
---|
20 | # license agreement apply instead of the previous paragraph.
|
---|
21 | #
|
---|
22 |
|
---|
23 | DEPTH = ..
|
---|
24 | include $(PATH_KBUILD)/header.kmk
|
---|
25 |
|
---|
26 | LIBRARIES = SyntaxVBoxIncludeR3 SyntaxVBoxIncludeR0 SyntaxVBoxIncludeGC
|
---|
27 |
|
---|
28 | hdrs := $(wildcard VBox/*.h iprt/*.h)
|
---|
29 |
|
---|
30 | SyntaxVBoxIncludeR3_TEMPLATE = VBOXR3
|
---|
31 | SyntaxVBoxIncludeR3_SOURCES := \
|
---|
32 | $(addprefix $(PATH_TARGET)/,$(subst .h,-c.c, $(subst /,_,$(hdrs)))) \
|
---|
33 | $(addprefix $(PATH_TARGET)/,$(subst .h,-cpp.cpp, $(subst /,_,$(hdrs))))
|
---|
34 |
|
---|
35 | SyntaxVBoxIncludeR0_TEMPLATE = VBOXR0
|
---|
36 | SyntaxVBoxIncludeR0_SOURCES = $(SyntaxVBoxIncludeR3_SOURCES)
|
---|
37 |
|
---|
38 | SyntaxVBoxIncludeGC_TEMPLATE = VBOXGC
|
---|
39 | SyntaxVBoxIncludeGC_SOURCES = $(SyntaxVBoxIncludeR3_SOURCES)
|
---|
40 |
|
---|
41 |
|
---|
42 |
|
---|
43 | include $(PATH_KBUILD)/footer.kmk
|
---|
44 |
|
---|
45 |
|
---|
46 | define def_hdr
|
---|
47 | $(eval flatname := $(subst /,_,$(basename $(hdr))))
|
---|
48 | $$(PATH_TARGET)/$(flatname)-cpp.cpp:
|
---|
49 | $$(MKDIR) -p $$(dir $$@)
|
---|
50 | $$(RM) -f $$@
|
---|
51 | $$(APPEND) $$@ "#include <$(hdr)>"
|
---|
52 | $$(APPEND) $$@ "int main(int argc, char **argv) {(void)argc; (void)argv; return 0;}"
|
---|
53 |
|
---|
54 | $$(PATH_TARGET)/$(flatname)-c.c:
|
---|
55 | $$(MKDIR) -p $$(dir $$@)
|
---|
56 | $$(RM) -f $$@
|
---|
57 | $$(APPEND) $$@ "#include <$(hdr)>"
|
---|
58 | $$(APPEND) $$@ "int main(int argc, char **argv) {(void)argc; (void)argv; return 0;}"
|
---|
59 |
|
---|
60 | $(subst .h,.o,$(notdir $(hdr)))::
|
---|
61 | $$(MAKE) -f $(MAKEFILE) $(flatname)-c.o $(flatname)-cpp.o
|
---|
62 |
|
---|
63 | endef
|
---|
64 |
|
---|
65 | $(foreach hdr,$(hdrs), $(eval $(def_hdr)))
|
---|
66 |
|
---|