VirtualBox

source: vbox/trunk/src/VBox/Frontends/VBoxManage/Makefile.kmk@ 92506

Last change on this file since 92506 was 92403, checked in by vboxsync, 3 years ago

Main: bugref:1909: Added translation engine into VBoxManage, Added generation of translation files for VBoxManage. Fixed some errors

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 10.8 KB
Line 
1# $Id: Makefile.kmk 92403 2021-11-12 15:59:12Z vboxsync $
2## @file
3# Sub-Makefile for VBoxManage (the cli frontend).
4#
5
6#
7# Copyright (C) 2006-2020 Oracle Corporation
8#
9# This file is part of VirtualBox Open Source Edition (OSE), as
10# available from http://www.virtualbox.org. This file is free software;
11# you can redistribute it and/or modify it under the terms of the GNU
12# General Public License (GPL) as published by the Free Software
13# Foundation, in version 2 as it comes in the "COPYING" file of the
14# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
15# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
16#
17
18SUB_DEPTH = ../../../..
19include $(KBUILD_PATH)/subheader.kmk
20
21include $(PATH_ROOT)/doc/manual/Config.kmk
22
23
24VBOX_COMMON_VBOXMANAGE_DEFS = \
25 $(if $(VBOX_WITH_AHCI), VBOX_WITH_AHCI) \
26 $(if $(VBOX_WITH_COPYTOGUEST),VBOX_WITH_COPYTOGUEST) \
27 $(if $(VBOX_WITH_E1000),VBOX_WITH_E1000) \
28 $(if $(VBOX_WITH_GUEST_CONTROL),VBOX_WITH_GUEST_CONTROL) \
29 $(if $(VBOX_WITH_GUEST_PROPS),VBOX_WITH_GUEST_PROPS) \
30 $(if $(VBOX_WITH_HEADLESS), VBOX_WITH_HEADLESS) \
31 $(if $(VBOX_WITH_HGCM), VBOX_WITH_HGCM) \
32 $(if $(VBOX_WITH_HOSTNETIF_API), VBOX_WITH_HOSTNETIF_API) \
33 $(if $(VBOX_WITH_NETFLT), VBOX_WITH_NETFLT) \
34 $(if $(VBOX_WITH_VMNET), VBOX_WITH_VMNET) \
35 $(if $(VBOX_WITH_CLOUD_NET), VBOX_WITH_CLOUD_NET) \
36 $(if $(VBOX_WITH_LIBCURL), VBOX_WITH_PROXY_INFO) \
37 $(if $(VBOX_WITH_AUDIO_OSS), VBOX_WITH_AUDIO_OSS) \
38 $(if $(VBOX_WITH_AUDIO_ALSA), VBOX_WITH_AUDIO_ALSA) \
39 $(if $(VBOX_WITH_AUDIO_PULSE),VBOX_WITH_AUDIO_PULSE) \
40 $(if $(VBOX_WITH_SCSI), VBOX_WITH_SCSI) \
41 $(if $(VBOX_WITH_VBOXSDL), VBOX_WITH_VBOXSDL) \
42 $(if $(VBOX_WITH_VIDEOHWACCEL), VBOX_WITH_VIDEOHWACCEL) \
43 $(if $(VBOX_WITH_VIRTIO),VBOX_WITH_VIRTIO) \
44 $(if $(VBOX_WITH_VIRTIO_NET_1_0),VBOX_WITH_VIRTIO_NET_1_0) \
45 $(if $(VBOX_WITH_USB_CARDREADER),VBOX_WITH_USB_CARDREADER) \
46 $(if $(VBOX_WITH_PCI_PASSTHROUGH),VBOX_WITH_PCI_PASSTHROUGH) \
47 $(if $(VBOX_WITH_RECORDING),VBOX_WITH_RECORDING) \
48 $(if $(VBOX_WITH_AUDIO_RECORDING),VBOX_WITH_AUDIO_RECORDING) \
49 $(if $(VBOX_WITH_NAT_SERVICE),VBOX_WITH_NAT_SERVICE) \
50 $(if $(VBOX_WITH_SHARED_CLIPBOARD),VBOX_WITH_SHARED_CLIPBOARD) \
51 $(if $(VBOX_WITH_SHARED_CLIPBOARD_TRANSFERS),VBOX_WITH_SHARED_CLIPBOARD_TRANSFERS) \
52 $(if $(VBOX_WITH_IOMMU_AMD),VBOX_WITH_IOMMU_AMD) \
53 $(if $(VBOX_WITH_IOMMU_INTEL),VBOX_WITH_IOMMU_INTEL) \
54 $(if $(VBOX_WITH_VMSVGA),VBOX_WITH_VMSVGA) \
55 $(if $(VBOX_WITH_MAIN_NLS),VBOX_WITH_MAIN_NLS) \
56 $(if $(VBOX_WITH_TPM),VBOX_WITH_TPM)
57
58
59ifdef VBOX_WITH_DOCS
60 PROGRAMS += VBoxManageHelp
61endif
62VBoxManageHelp_TEMPLATE = VBoxAdvBldProg
63VBoxManageHelp_DEFS += \
64 VBOX_ONLY_DOCS \
65 $(VBOX_COMMON_VBOXMANAGE_DEFS)
66VBoxManageHelp_SOURCES = \
67 VBoxManage.cpp \
68 VBoxManageHelp.cpp \
69 $(if $(VBOX_WITH_GUEST_PROPS),VBoxManageGuestProp.cpp) \
70 $(if $(VBOX_WITH_GUEST_CONTROL),VBoxManageGuestCtrl.cpp)
71
72
73ifndef VBOX_ONLY_DOCS
74 PROGRAMS += VBoxManage
75 VBoxManage_TEMPLATE = VBOXMAINCLIENTEXE
76 VBoxManage_DEFS += $(VBOX_COMMON_VBOXMANAGE_DEFS)
77 VBoxManage_DEFS.win = _WIN32_WINNT=0x0500
78 VBoxManage_INCS = \
79 $(VBoxManage_0_OUTDIR) \
80 ../Common
81 VBoxManage_INTERMEDIATES = \
82 $(VBoxManage_0_OUTDIR)/VBoxManageBuiltInHelp.h
83 VBoxManage_SOURCES = \
84 VBoxManage.cpp \
85 VBoxManageUtils.cpp \
86 VBoxInternalManage.cpp \
87 VBoxManageAppliance.cpp \
88 VBoxManageBandwidthControl.cpp \
89 VBoxManageControlVM.cpp \
90 VBoxManageDebugVM.cpp \
91 VBoxManageDHCPServer.cpp \
92 VBoxManageDisk.cpp \
93 $(if $(VBOX_WITH_GUEST_CONTROL),VBoxManageGuestCtrl.cpp) \
94 $(if $(VBOX_WITH_GUEST_CONTROL),VBoxManageGuestCtrlListener.cpp) \
95 $(if $(VBOX_WITH_GUEST_PROPS),VBoxManageGuestProp.cpp) \
96 VBoxManageHelp.cpp \
97 $(VBoxManage_0_OUTDIR)/VBoxManageBuiltInHelp.cpp \
98 VBoxManageHostonly.cpp \
99 VBoxManageInfo.cpp \
100 VBoxManageList.cpp \
101 VBoxManageMetrics.cpp \
102 VBoxManageMisc.cpp \
103 VBoxManageModifyVM.cpp \
104 VBoxManageModifyNvram.cpp \
105 VBoxManageSnapshot.cpp \
106 VBoxManageStorageController.cpp \
107 VBoxManageUpdateCheck.cpp \
108 VBoxManageUSB.cpp \
109 $(if $(VBOX_WITH_NAT_SERVICE),VBoxManageNATNetwork.cpp,) \
110 $(if $(VBOX_WITH_NAT_SERVICE),../../NetworkServices/NetLib/VBoxNetPortForwardString.cpp,) \
111 VBoxManageCloud.cpp \
112 VBoxManageCloudMachine.cpp \
113 ../Common/PasswordInput.cpp
114 VBoxManage_SOURCES.win = \
115 VBoxManage.rc
116 VBoxManage_LIBS += $(LIB_DDU)
117
118ifdef VBOX_WITH_VBOXMANAGE_NLS
119 VBoxManage_DEFS += VBOX_WITH_VBOXMANAGE_NLS
120 VBoxManage_INCS += \
121 $(PATH_ROOT)/src/VBox/Main/include
122 VBoxManage_SOURCES += \
123 $(PATH_ROOT)/src/VBox/Main/src-all/VirtualBoxTranslator.cpp \
124 $(PATH_ROOT)/src/VBox/Main/src-all/QMTranslatorImpl.cpp \
125 $(PATH_ROOT)/src/VBox/Main/src-all/GlobalStatusConversion.cpp
126
127# define qt5 tools for translation
128 USES += qt5
129
130 VBOX_PATH_VBOXMANAGE_SRC := $(PATH_SUB_CURRENT)
131 include $(PATH_SUB_CURRENT)/nls/ApprovedLanguages.kmk
132
133 PROGRAMS += VBoxManageNls
134 VBoxManageNls_TEMPLATE = VBoxNLS
135 VBoxManageNls_QT_TRANSLATIONS = $(addsuffix .ts,$(addprefix $(VBOX_PATH_VBOXMANAGE_SRC)/nls/VBoxManageNls_,$(VBOX_APPROVED_VBOXMANAGE_LANGUAGES)))
136 VBoxManageNls_VBOX_ALL_NLS_SOURCES = $(wildcard \
137 $(VBOX_PATH_VBOXMANAGE_SRC)/*.h\
138 $(VBOX_PATH_VBOXMANAGE_SRC)/*.cpp )
139
140 updatenls:: makeallnls $(VBOX_PATH_VBOXMANAGE_SRC)/nls/VBoxManageNls_en.ts
141
142 makeallnls:: $(VBoxManageNls_VBOX_ALL_NLS_SOURCES)
143 $(call MSG_L1,lupdate all languages (nls/*.ts))
144 $(QUIET)$(TOOL_QT5_LUPDATE) \
145 $^ \
146 -ts \
147 $(filter-out nls/VBoxManageNls_en.ts, $(VBoxManageNls_QT_TRANSLATIONS)) \
148 $(VBOX_PATH_VBOXMANAGE_SRC)/nls/VBoxManageNls_xx_YY.ts
149
150# fake-main-nls:
151# $(foreach file, $(VBoxManageNls_QT_TRANSLATIONS) \
152# ,$(NLTAB)$(SED) -i \
153# -e '/<source>.*<\/source>/h' \
154# -e '/<source>.*<\/source>/p' \
155# -e '/<translation type="unfinished"><\/translation>/{' \
156# -e 'x' \
157# -e 's/<source>\(.*\)<\/source>/<translation type="unfinished">$(notdir $(file)): \1<\/translation>/' \
158# -e '}' \
159# $(file) )
160
161
162# Create the English translation file. This is something special cause it will
163# contain the plural forms only.
164 $(VBOX_PATH_VBOXMANAGE_SRC)/nls/VBoxManageNls_en.ts: $(VBoxManageNls_VBOX_ALL_NLS_SOURCES)
165 $(call MSG_L1,lupdate $@)
166 $(QUIET)$(TOOL_QT5_LUPDATE) \
167 $^ \
168 -ts \
169 "$@"
170 $(QUIET)$(SED) -n -i \
171 -e '/<context>/,/<\/context>/!p' \
172 -e '/<context>/h' \
173 -e '/<name>/H' \
174 -e '/<message numerus="yes">/,/<\/message>/H' \
175 -e '/<\/context>/{H;x;/<message/p}' \
176 "$@"
177
178endif # VBOX_WITH_VBOXMANAGE_NLS
179
180
181 # VBoxNetPortForwardString.h
182 VBoxManageNATNetwork.cpp_INCS += ../../NetworkServices/NetLib/
183
184endif # VBOX_ONLY_DOCS
185
186ifneq ($(KBUILD_TARGET),win)
187 # Workaround for buggy gcc-4.3 compilers, see
188 #
189 # http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36474
190 #
191 # Some later revisions of version 4.3.1 are known to work so we assume
192 # that version 4.3.2 or later has this bug definitely fixed.
193 VBoxManage_CXXFLAGS.release += \
194 $(if $(VBOX_GCC_VERSION_CXX),$(if-expr $(VBOX_GCC_VERSION_CXX) < 40300 || $(VBOX_GCC_VERSION_CXX) > 40301,,--param max-fields-for-field-sensitive=0),)
195 VBoxManageHelp_CXXFLAGS.release = $(VBoxManage_CXXFLAGS.release)
196endif
197
198
199#
200# VBoxManage built-in help from XML refentry in doc/manual/en_US/.
201#
202$(call KB_FN_DO_PASS0_ON_TARGET,VBoxManage)
203
204## @todo r=klaus the VBoxManage manpage handling currently cannot deal with
205# man_VBoxManage.xml and that's not just removing the - in the patterns. The
206# common options (and the included overview of the command) need to be handled
207# specially to be useful in VBoxManage.
208
209VBoxManage_CLEAN += \
210 $(VBoxManage_0_OUTDIR)/VBoxManageBuiltInHelp.cpp \
211 $(VBoxManage_0_OUTDIR)/VBoxManageBuiltInHelp.cpp.ts \
212 $(VBoxManage_0_OUTDIR)/VBoxManageBuiltInHelp.h \
213 $(VBoxManage_0_OUTDIR)/VBoxManageBuiltInHelp.h.ts \
214 $(addprefix $(VBoxManage_0_OUTDIR)/,$(filter man_VBoxManage-%,$(VBOX_MANUAL_XML_REFENTRY_FILES)))
215
216
217
218# Preprocess the xml files, applying remarks.
219$(foreach file,$(filter man_VBoxManage-%,$(VBOX_MANUAL_XML_REFENTRY_FILES)) \
220, $(evalcall2 def_vbox_refentry_preprocess_for_manpage,$(VBoxManage_0_OUTDIR),$(file),$(VBOX_PATH_MANUAL_SRC)/en_US/$(file),replace-xrefs))
221
222
223# Generate the .cpp file.
224$(VBoxManage_0_OUTDIR)/VBoxManageBuiltInHelp.cpp.ts \
225+| $(VBoxManage_0_OUTDIR)/VBoxManageBuiltInHelp.cpp: \
226 $(VBOX_DOCBOOK_REFENTRY_TO_C_HELP) \
227 $(addprefix $(VBoxManage_0_OUTDIR)/,$(filter man_VBoxManage-%,$(VBOX_MANUAL_XML_REFENTRY_FILES))) \
228 $(VBOX_XML_CATALOG) $(VBOX_XML_CATALOG_DOCBOOK) $(MAKEFILE) | $$(dir $$@)
229 $(call MSG_TOOL,xsltproc $(notdir $(firstword $(filter %.xsl,$^))),,$(filter %.xml,$^),$(patsubst %.ts,%,$@))
230 $(QUIET)$(APPEND) -tn "$@" \
231 '/* Autogenerated by $<, do not edit! */' \
232 '' \
233 '#include "VBoxManageBuiltInHelp.h"' \
234 ''
235 $(foreach refentry,$(filter %.xml,$^) \
236 ,$(NLTAB)$(QUIET)$(call VBOX_XSLTPROC_WITH_CAT, -a+to "$@") $< $(refentry))
237 $(QUIET)$(APPEND) -n "$@" \
238 '' \
239 'PCRTMSGREFENTRY g_apHelpEntries[] =' \
240 '{'
241 $(foreach refentry,$(filter %.xml,$^) \
242 ,$(NLTAB)$(QUIET)$(APPEND) -n "$@" \
243 ' &g_$(subst -,_,$(tolower $(patsubst man_%,%,$(notdir $(basename $(refentry)))))),')
244 $(QUIET)$(APPEND) -n "$@" \
245 '};' \
246 'const uint32_t g_cHelpEntries = RT_ELEMENTS(g_apHelpEntries);' \
247 ''
248 $(QUIET)$(CP) --changed -- "$@" "$(patsubst %.ts,%,$@)"
249# The above APPEND stuff trigger some kind of problem on some boxes when not split up...
250# update: Fixed in SVN (strcpy -> memmove in new_job(), job.c - r2591). Just need to rebuild all platforms.
251
252
253$(VBoxManage_0_OUTDIR)/VBoxManageBuiltInHelp.h.ts \
254+| $(VBoxManage_0_OUTDIR)/VBoxManageBuiltInHelp.h: \
255 $(VBOX_DOCBOOK_REFENTRY_TO_H_HELP) \
256 $(addprefix $(VBoxManage_0_OUTDIR)/,$(filter man_VBoxManage-%,$(VBOX_MANUAL_XML_REFENTRY_FILES))) \
257 $(VBOX_XML_CATALOG) $(VBOX_XML_CATALOG_DOCBOOK) $(MAKEFILE) | $$(dir $$@)
258 $(call MSG_TOOL,xsltproc $(notdir $(firstword $(filter %.xsl,$^))),,$(filter %.xml,$^),$(patsubst %.ts,%,$@))
259 $(QUIET)$(APPEND) -tn "$@" \
260 '/* Autogenerated by $<, do not edit! */' \
261 '' \
262 '#ifndef ___VBoxManageBuiltInHelp_h___' \
263 '#define ___VBoxManageBuiltInHelp_h___' \
264 '' \
265 '#include <iprt/message.h>' \
266 '' \
267 'RT_C_DECLS_BEGIN' \
268 '' \
269 'typedef enum HELP_CMD_VBOXMANAGE' \
270 '{' \
271 ' HELP_CMD_VBOXMANAGE_INVALID = 0,'
272 $(foreach refentry,$(filter %.xml,$^) \
273 ,$(NLTAB)$(QUIET)$(call VBOX_XSLTPROC_WITH_CAT, -a+to "$@") \
274 --stringparam 'g_sMode' 'cmd' $< $(refentry))
275 $(QUIET)$(APPEND) -n "$@" \
276 ' HELP_CMD_VBOXMANAGE_END' \
277 '} HELP_CMD_VBOXMANAGE;'
278 $(foreach refentry,$(filter %.xml,$^) \
279 ,$(NLTAB)$(QUIET)$(call VBOX_XSLTPROC_WITH_CAT, -a+to "$@") \
280 --stringparam 'g_sMode' 'subcmd' $< $(refentry))
281 $(QUIET)$(APPEND) -n "$@" \
282 '' \
283 'extern PCRTMSGREFENTRY g_apHelpEntries[];' \
284 'extern const uint32_t g_cHelpEntries;' \
285 '' \
286 'RT_C_DECLS_END' \
287 '' \
288 '#endif' \
289 ''
290 $(QUIET)$(CP) --changed -- "$@" "$(patsubst %.ts,%,$@)"
291
292
293include $(FILE_KBUILD_SUB_FOOTER)
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette