1 | # $Id: Makefile.kmk 106065 2024-09-16 21:42:41Z vboxsync $
|
---|
2 | ## @file
|
---|
3 | # Sub-Makefile for the VBox C Binding.
|
---|
4 | #
|
---|
5 |
|
---|
6 | #
|
---|
7 | # Copyright (C) 2009-2024 Oracle and/or its affiliates.
|
---|
8 | #
|
---|
9 | # This file is part of VirtualBox base platform packages, as
|
---|
10 | # available from https://www.virtualbox.org.
|
---|
11 | #
|
---|
12 | # This program is free software; you can redistribute it and/or
|
---|
13 | # modify it under the terms of the GNU General Public License
|
---|
14 | # as published by the Free Software Foundation, in version 3 of the
|
---|
15 | # License.
|
---|
16 | #
|
---|
17 | # This program is distributed in the hope that it will be useful, but
|
---|
18 | # WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
19 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
20 | # General Public License for more details.
|
---|
21 | #
|
---|
22 | # You should have received a copy of the GNU General Public License
|
---|
23 | # along with this program; if not, see <https://www.gnu.org/licenses>.
|
---|
24 | #
|
---|
25 | # SPDX-License-Identifier: GPL-3.0-only
|
---|
26 | #
|
---|
27 |
|
---|
28 | SUB_DEPTH = ../../../..
|
---|
29 | include $(KBUILD_PATH)/subheader.kmk
|
---|
30 |
|
---|
31 |
|
---|
32 | #
|
---|
33 | # The samples
|
---|
34 | #
|
---|
35 | INSTALLS += CAPISamples
|
---|
36 | CAPISamples_MODE = a+r,u+rw
|
---|
37 | CAPISamples_INST = \
|
---|
38 | $(INST_SDK)bindings/c/samples/
|
---|
39 | CAPISamples_SOURCES = \
|
---|
40 | tstCAPIGlue.c \
|
---|
41 | makefile.tstCAPIGlue=>Makefile
|
---|
42 |
|
---|
43 | #
|
---|
44 | # The ???.
|
---|
45 | #
|
---|
46 | INSTALLS += CAPIGlue
|
---|
47 | CAPIGlue_MODE = a+r,u+rw
|
---|
48 | CAPIGlue_INST = \
|
---|
49 | $(INST_SDK)bindings/c/glue/
|
---|
50 | CAPIGlue_SOURCES = \
|
---|
51 | VBoxCAPIGlue.c \
|
---|
52 | $(CAPIHeaders_0_OUTDIR)/VBoxCAPIGlue.h
|
---|
53 | CAPIGlue_CLEAN = \
|
---|
54 | $(CAPIHeaders_0_OUTDIR)/VBoxCAPIGlue.h
|
---|
55 |
|
---|
56 | $$(CAPIHeaders_0_OUTDIR)/VBoxCAPIGlue.h: \
|
---|
57 | $(PATH_SUB_CURRENT)/VBoxCAPIGlue.h.in \
|
---|
58 | $(MAKEFILE_CURRENT) \
|
---|
59 | | $$(dir $$@)
|
---|
60 | $(call MSG_GENERATE,,$@)
|
---|
61 | $(QUIET)$(SED) \
|
---|
62 | -e 's/@VBOX_API_VERSION@/$(VBOX_API_VERSION)/' \
|
---|
63 | < $< > $@
|
---|
64 |
|
---|
65 | #
|
---|
66 | # The ???.
|
---|
67 | #
|
---|
68 | INSTALLS += CAPIHeaders
|
---|
69 | CAPIHeaders_MODE = a+r,u+rw
|
---|
70 | CAPIHeaders_INST = $(INST_SDK)bindings/c/include/
|
---|
71 | CAPIHeaders_SOURCES = \
|
---|
72 | $(CAPIHeaders_0_OUTDIR)/VBoxCAPI.h=>VBoxCAPI_v$(VBOX_API_VERSION).h
|
---|
73 | CAPIHeaders_CLEAN = \
|
---|
74 | $(CAPIHeaders_0_OUTDIR)/VBoxCAPI.h
|
---|
75 |
|
---|
76 | $$(CAPIHeaders_0_OUTDIR)/VBoxCAPI.h: \
|
---|
77 | $(PATH_SUB_CURRENT)/capiidl.xsl \
|
---|
78 | $(PATH_SUB_CURRENT)/../idl/typemap-shared.inc.xsl \
|
---|
79 | $(VBOX_XIDL_FILE) \
|
---|
80 | | $$(dir $$@)
|
---|
81 | $(call MSG_TOOL,xsltproc,CAPIHeaders,$<,$@)
|
---|
82 | $(QUIET)$(VBOX_XSLTPROC) --stringparam g_uVBoxCopyrightYear "$(VBOX_C_YEAR)" -o $@ $^
|
---|
83 |
|
---|
84 | ifndef VBOX_ONLY_SDK
|
---|
85 |
|
---|
86 | #
|
---|
87 | # The C API binding utility DLL
|
---|
88 | #
|
---|
89 | DLLS += VBoxCAPI
|
---|
90 | VBoxCAPI_TEMPLATE = VBoxMainClientDll
|
---|
91 | ifdef VBOX_WITH_XPCOM
|
---|
92 | # Keep old name on XPCOM so that legacy code is happy.
|
---|
93 | VBoxCAPI_INST = $(INST_BIN)VBoxXPCOMC$(VBOX_SUFF_DLL)
|
---|
94 | endif
|
---|
95 | VBoxCAPI_DEFS = IN_VBOXCAPI
|
---|
96 | VBoxCAPI_SOURCES = \
|
---|
97 | VBoxCAPI.cpp
|
---|
98 | VBoxCAPI_SOURCES.win = \
|
---|
99 | VBoxCAPI.rc
|
---|
100 | VBoxCAPI_INCS = \
|
---|
101 | $(CAPIHeaders_0_OUTDIR)
|
---|
102 | VBoxCAPI_INTERMEDIATES = \
|
---|
103 | $(CAPIHeaders_0_OUTDIR)/VBoxCAPI.h
|
---|
104 |
|
---|
105 | #
|
---|
106 | # The C API binding utility DLL, 32-bit variant for 64-bit hosts.
|
---|
107 | #
|
---|
108 | ifdef VBOX_WITH_32_ON_64_MAIN_API
|
---|
109 | DLLS += VBoxCAPI-x86
|
---|
110 | VBoxCAPI-x86_EXTENDS := VBoxCAPI
|
---|
111 | VBoxCAPI-x86_TEMPLATE := VBoxMainClientDll-x86
|
---|
112 | ifdef VBOX_WITH_XPCOM
|
---|
113 | VBoxCAPI-x86_INST := $(INST_BIN)VBoxCAPI-x86$(VBOX_SUFF_DLL)
|
---|
114 | endif
|
---|
115 | endif
|
---|
116 |
|
---|
117 | #
|
---|
118 | # The C glue library.
|
---|
119 | #
|
---|
120 | LIBRARIES += VBoxCAPIGlue
|
---|
121 | VBoxCAPIGlue_TEMPLATE = VBoxMainExe
|
---|
122 | VBoxCAPIGlue_DEFS = IN_VBOXCAPI
|
---|
123 | VBoxCAPIGlue_SOURCES = \
|
---|
124 | VBoxCAPIGlue.c
|
---|
125 | ifdef VBOX_WITH_XPCOM
|
---|
126 | VBoxCAPIGlue_SOURCES += \
|
---|
127 | $(VBOX_PATH_SDK)/bindings/xpcom/lib/VirtualBox_i.c
|
---|
128 | else
|
---|
129 | VBoxCAPIGlue_SOURCES += \
|
---|
130 | $(VBOX_PATH_SDK)/bindings/mscom/lib/VirtualBox_i.c
|
---|
131 | endif
|
---|
132 | VBoxCAPIGlue_INCS = \
|
---|
133 | $(VBOX_PATH_SDK)/bindings/c/include \
|
---|
134 | $(VBOX_PATH_SDK)/bindings/c/glue
|
---|
135 | VBoxCAPIGlue_INTERMEDIATES = \
|
---|
136 | $(VBOX_PATH_SDK)/bindings/c/glue/VBoxCAPIGlue.h \
|
---|
137 | $(VBOX_PATH_SDK)/bindings/c/include/VBoxCAPI_v$(VBOX_API_VERSION).h
|
---|
138 |
|
---|
139 |
|
---|
140 | ifdef VBOX_WITH_32_ON_64_MAIN_API
|
---|
141 | # Same as above, but 32-bit version.
|
---|
142 | LIBRARIES += VBoxCAPIGlue-x86
|
---|
143 | VBoxCAPIGlue-x86_EXTENDS := VBoxCAPIGlue
|
---|
144 | VBoxCAPIGlue-x86_BLD_TRG_ARCH := x86
|
---|
145 | endif
|
---|
146 |
|
---|
147 |
|
---|
148 | if defined(VBOX_WITH_TESTCASES) && "$(KBUILD_TARGET)" != "darwin"
|
---|
149 | #
|
---|
150 | # The testcase (also in samples).
|
---|
151 | # C testcase using the dynamic glue.
|
---|
152 | #
|
---|
153 | PROGRAMS += tstCAPIGlue
|
---|
154 | tstCAPIGlue_TEMPLATE = VBoxR3TstExe
|
---|
155 | tstCAPIGlue_INCS = \
|
---|
156 | $(VBOX_PATH_SDK)/bindings/c/include \
|
---|
157 | $(VBOX_PATH_SDK)/bindings/c/glue
|
---|
158 | ifdef VBOX_WITH_XPCOM
|
---|
159 | tstCAPIGlue_INCS += \
|
---|
160 | $(VBOX_PATH_SDK)/bindings/xpcom/include
|
---|
161 | else
|
---|
162 | tstCAPIGlue_INCS += \
|
---|
163 | $(VBOX_PATH_SDK)/bindings/mscom/include
|
---|
164 | endif
|
---|
165 | tstCAPIGlue_INTERMEDIATES = \
|
---|
166 | $(VBOX_PATH_SDK)/bindings/c/glue/VBoxCAPIGlue.h \
|
---|
167 | $(VBOX_PATH_SDK)/bindings/c/include/VBoxCAPI_v$(VBOX_API_VERSION).h \
|
---|
168 | $(if-expr !defined(VBOX_WITH_XPCOM),$(VBOX_PATH_SDK)/bindings/mscom/include/VirtualBox.h,)
|
---|
169 | tstCAPIGlue_SOURCES = \
|
---|
170 | tstCAPIGlue.c
|
---|
171 | tstCAPIGlue_LIBS = \
|
---|
172 | $(VBoxCAPIGlue_1_TARGET)
|
---|
173 |
|
---|
174 | ifdef VBOX_WITH_32_ON_64_MAIN_API
|
---|
175 | # Same as above, but 32-bit version.
|
---|
176 | PROGRAMS += tstCAPIGlue-x86
|
---|
177 | tstCAPIGlue-x86_EXTENDS := tstCAPIGlue
|
---|
178 | tstCAPIGlue-x86_TEMPLATE := VBoxR3TstExe-x86
|
---|
179 | tstCAPIGlue-x86_BLD_TRG_ARCH := x86
|
---|
180 | tstCAPIGlue-x86_LIBS = $(VBoxCAPIGlue-x86_1_TARGET)
|
---|
181 | endif
|
---|
182 | endif
|
---|
183 |
|
---|
184 | endif # !VBOX_ONLY_SDK
|
---|
185 |
|
---|
186 | # generate rules.
|
---|
187 | include $(FILE_KBUILD_SUB_FOOTER)
|
---|
188 |
|
---|