# $Id: Makefile.kmk 99701 2023-05-09 13:02:23Z vboxsync $ ## @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 . # # 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)