1 | # $Id: Makefile.kmk 5999 2007-12-07 15:05:06Z 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 | hdrs := $(wildcard VBox/*.h iprt/*.h)
|
---|
25 |
|
---|
26 | SyntaxVBoxIncludeR3_TEMPLATE = VBOXR3
|
---|
27 | SyntaxVBoxIncludeR3_SOURCES := \
|
---|
28 | $(addprefix $(PATH_TARGET)/,$(subst .h,-c.c, $(subst /,_,$(hdrs)))) \
|
---|
29 | $(addprefix $(PATH_TARGET)/,$(subst .h,-cpp.cpp, $(subst /,_,$(hdrs))))
|
---|
30 |
|
---|
31 | SyntaxVBoxIncludeR0_TEMPLATE = VBOXR0
|
---|
32 | SyntaxVBoxIncludeR0_SOURCES = $(SyntaxVBoxIncludeR3_SOURCES)
|
---|
33 |
|
---|
34 | SyntaxVBoxIncludeGC_TEMPLATE = VBOXGC
|
---|
35 | SyntaxVBoxIncludeGC_SOURCES = $(SyntaxVBoxIncludeR3_SOURCES)
|
---|
36 |
|
---|
37 |
|
---|
38 |
|
---|
39 | include $(PATH_KBUILD)/footer.kmk
|
---|
40 |
|
---|
41 |
|
---|
42 | define def_hdr
|
---|
43 | $(eval flatname := $(subst /,_,$(basename $(hdr))))
|
---|
44 | $$(PATH_TARGET)/$(flatname)-cpp.cpp:
|
---|
45 | $$(MKDIR) -p $$(dir $$@)
|
---|
46 | $$(RM) -f $$@
|
---|
47 | $$(APPEND) $$@ "#include <$(hdr)>"
|
---|
48 | $$(APPEND) $$@ "int main(int argc, char **argv) {(void)argc; (void)argv; return 0;}"
|
---|
49 |
|
---|
50 | $$(PATH_TARGET)/$(flatname)-c.c:
|
---|
51 | $$(MKDIR) -p $$(dir $$@)
|
---|
52 | $$(RM) -f $$@
|
---|
53 | $$(APPEND) $$@ "#include <$(hdr)>"
|
---|
54 | $$(APPEND) $$@ "int main(int argc, char **argv) {(void)argc; (void)argv; return 0;}"
|
---|
55 |
|
---|
56 | $(subst .h,.o,$(notdir $(hdr)))::
|
---|
57 | $$(MAKE) -f $(MAKEFILE) $(flatname)-c.o $(flatname)-cpp.o
|
---|
58 |
|
---|
59 | endef
|
---|
60 |
|
---|
61 | $(foreach hdr,$(hdrs), $(eval $(def_hdr)))
|
---|
62 |
|
---|