summaryrefslogtreecommitdiff
path: root/src/VBox/Main/cbinding/Makefile.kmk
blob: 9eccab1797302a1f6a62d32195a08562b26667bf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
# $Id$
## @file
# Sub-Makefile for the VBox C Binding.
#

#
# Copyright (C) 2009-2023 Oracle and/or its affiliates.
#
# This file is part of VirtualBox base platform packages, as
# available from https://www.virtualbox.org.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation, in version 3 of the
# License.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, see <https://www.gnu.org/licenses>.
#
# SPDX-License-Identifier: GPL-3.0-only
#

SUB_DEPTH = ../../../..
include $(KBUILD_PATH)/subheader.kmk


#
# The samples
#
INSTALLS += CAPISamples
CAPISamples_MODE = a+r,u+rw
CAPISamples_INST = \
	$(INST_SDK)bindings/c/samples/
CAPISamples_SOURCES = \
	tstCAPIGlue.c \
	makefile.tstCAPIGlue=>Makefile

#
# The ???.
#
INSTALLS += CAPIGlue
CAPIGlue_MODE = a+r,u+rw
CAPIGlue_INST = \
	$(INST_SDK)bindings/c/glue/
CAPIGlue_SOURCES = \
	VBoxCAPIGlue.c \
	$(CAPIHeaders_0_OUTDIR)/VBoxCAPIGlue.h
CAPIGlue_CLEAN = \
	$(CAPIHeaders_0_OUTDIR)/VBoxCAPIGlue.h

$$(CAPIHeaders_0_OUTDIR)/VBoxCAPIGlue.h: \
		$(PATH_SUB_CURRENT)/VBoxCAPIGlue.h.in \
		$(MAKEFILE_CURRENT) \
		| $$(dir $$@)
	$(call MSG_GENERATE,,$@)
	$(QUIET)$(SED) \
		-e 's/@VBOX_API_VERSION@/$(VBOX_API_VERSION)/' \
		<  $< >  $@

#
# The ???.
#
INSTALLS += CAPIHeaders
CAPIHeaders_MODE = a+r,u+rw
CAPIHeaders_INST = $(INST_SDK)bindings/c/include/
CAPIHeaders_SOURCES = \
	$(CAPIHeaders_0_OUTDIR)/VBoxCAPI.h=>VBoxCAPI_v$(VBOX_API_VERSION).h
CAPIHeaders_CLEAN = \
	$(CAPIHeaders_0_OUTDIR)/VBoxCAPI.h

$$(CAPIHeaders_0_OUTDIR)/VBoxCAPI.h: \
		$(PATH_SUB_CURRENT)/capiidl.xsl \
		$(PATH_SUB_CURRENT)/../idl/typemap-shared.inc.xsl \
		$(VBOX_XIDL_FILE) \
		| $$(dir $$@)
	$(call MSG_TOOL,xsltproc,CAPIHeaders,$<,$@)
	$(QUIET)$(VBOX_XSLTPROC) -o $@ $^

ifndef VBOX_ONLY_SDK

 #
 # The C API binding utility DLL
 #
 DLLS += VBoxCAPI
 VBoxCAPI_TEMPLATE = VBoxMainClientDll
 ifdef VBOX_WITH_XPCOM
  # Keep old name on XPCOM so that legacy code is happy.
  VBoxCAPI_INST = $(INST_BIN)VBoxXPCOMC$(VBOX_SUFF_DLL)
 endif
 VBoxCAPI_DEFS = IN_VBOXCAPI
 VBoxCAPI_SOURCES = \
 	VBoxCAPI.cpp
 VBoxCAPI_SOURCES.win = \
 	VBoxCAPI.rc
 VBoxCAPI_INCS = \
 	$(CAPIHeaders_0_OUTDIR)
 VBoxCAPI_INTERMEDIATES = \
 	$(CAPIHeaders_0_OUTDIR)/VBoxCAPI.h

 #
 # The C API binding utility DLL, 32-bit variant for 64-bit hosts.
 #
 ifdef VBOX_WITH_32_ON_64_MAIN_API
  DLLS += VBoxCAPI-x86
  VBoxCAPI-x86_EXTENDS  := VBoxCAPI
  VBoxCAPI-x86_TEMPLATE := VBoxMainClientDll-x86
  ifdef VBOX_WITH_XPCOM
   VBoxCAPI-x86_INST    := $(INST_BIN)VBoxCAPI-x86$(VBOX_SUFF_DLL)
  endif
 endif

 #
 # The C glue library.
 #
 LIBRARIES += VBoxCAPIGlue
 VBoxCAPIGlue_TEMPLATE = VBoxMainExe
 VBoxCAPIGlue_DEFS = IN_VBOXCAPI
 VBoxCAPIGlue_SOURCES = \
 	VBoxCAPIGlue.c
 ifdef VBOX_WITH_XPCOM
  VBoxCAPIGlue_SOURCES += \
  	$(VBOX_PATH_SDK)/bindings/xpcom/lib/VirtualBox_i.c
 else
  VBoxCAPIGlue_SOURCES += \
  	$(VBOX_PATH_SDK)/bindings/mscom/lib/VirtualBox_i.c
 endif
 VBoxCAPIGlue_INCS = \
 	$(VBOX_PATH_SDK)/bindings/c/include \
 	$(VBOX_PATH_SDK)/bindings/c/glue
 VBoxCAPIGlue_INTERMEDIATES = \
 	$(VBOX_PATH_SDK)/bindings/c/glue/VBoxCAPIGlue.h \
 	$(VBOX_PATH_SDK)/bindings/c/include/VBoxCAPI_v$(VBOX_API_VERSION).h


 ifdef VBOX_WITH_32_ON_64_MAIN_API
  # Same as above, but 32-bit version.
  LIBRARIES += VBoxCAPIGlue-x86
  VBoxCAPIGlue-x86_EXTENDS      := VBoxCAPIGlue
  VBoxCAPIGlue-x86_BLD_TRG_ARCH := x86
 endif


 if defined(VBOX_WITH_TESTCASES) && "$(KBUILD_TARGET)" != "darwin"
  #
  # The testcase (also in samples).
  # C testcase using the dynamic glue.
  #
  PROGRAMS += tstCAPIGlue
  tstCAPIGlue_TEMPLATE = VBoxR3TstExe
  tstCAPIGlue_INCS = \
  	$(VBOX_PATH_SDK)/bindings/c/include \
  	$(VBOX_PATH_SDK)/bindings/c/glue
  ifdef VBOX_WITH_XPCOM
   tstCAPIGlue_INCS += \
   	$(VBOX_PATH_SDK)/bindings/xpcom/include
  else
   tstCAPIGlue_INCS += \
   	$(VBOX_PATH_SDK)/bindings/mscom/include
  endif
  tstCAPIGlue_INTERMEDIATES = \
  	$(VBOX_PATH_SDK)/bindings/c/glue/VBoxCAPIGlue.h \
  	$(VBOX_PATH_SDK)/bindings/c/include/VBoxCAPI_v$(VBOX_API_VERSION).h \
  	$(if-expr !defined(VBOX_WITH_XPCOM),$(VBOX_PATH_SDK)/bindings/mscom/include/VirtualBox.h,)
  tstCAPIGlue_SOURCES = \
  	tstCAPIGlue.c
  tstCAPIGlue_LIBS = \
  	$(VBoxCAPIGlue_1_TARGET)

  ifdef VBOX_WITH_32_ON_64_MAIN_API
   # Same as above, but 32-bit version.
   PROGRAMS += tstCAPIGlue-x86
   tstCAPIGlue-x86_EXTENDS      := tstCAPIGlue
   tstCAPIGlue-x86_TEMPLATE     := VBoxR3TstExe-x86
   tstCAPIGlue-x86_BLD_TRG_ARCH := x86
   tstCAPIGlue-x86_LIBS          = $(VBoxCAPIGlue-x86_1_TARGET)
  endif
 endif

endif # !VBOX_ONLY_SDK

# generate rules.
include $(FILE_KBUILD_SUB_FOOTER)