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