Version 5.4.3.2, tag libreoffice-5.4.3.2
[LibreOffice.git] / Makefile.in
blobe54f43cb6d76ebe2cac5d8a6e08b8bc9ff1f3d35
1 # -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
3 # This file is part of the LibreOffice project.
5 # This Source Code Form is subject to the terms of the Mozilla Public
6 # License, v. 2.0. If a copy of the MPL was not distributed with this
7 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
10 gb_Top_MODULE_CHECK_TARGETS := slowcheck unitcheck subsequentcheck perfcheck uicheck screenshot
12 .PHONY : all check-if-root bootstrap gbuild build build-non-l10n-only build-l10n-only check clean clean-build clean-host test-install distclean distro-pack-install distro-pack-install-strip docs download etags fetch findunusedcode get-submodules id install install-strip tags debugrun help showmodules translations packageinfo internal.clean $(gb_Top_MODULE_CHECK_TARGETS)
14 MAKECMDGOALS?=all
15 build_goal:=$(if $(filter build check,$(MAKECMDGOALS)),all)\
16 $(if $(filter build-nocheck uicheck,$(MAKECMDGOALS)),build)\
17 $(if $(filter check,$(MAKECMDGOALS)),subsequentcheck)\
18 $(filter all build-l10n-only build-non-l10n-only debugrun help showmodules translations $(gb_Top_MODULE_CHECK_TARGETS) check packageinfo gbuildtojson,$(MAKECMDGOALS))
20 SRCDIR := @SRC_ROOT@
21 BUILDDIR := @BUILDDIR@
22 GIT_BUILD := $(if $(wildcard $(SRCDIR)/.git),T)
24 # Run autogen.sh if needed and force make to restart itself.
25 # ... but there are several cases where we do not want to run
26 # autogen.sh:
27 # 1. if we are building from tarballs, not git checkout (I do not
28 # think packagers would ever want that. I certainly do not.)
29 # 2. if we are making help, clean or distclean, because they do not
30 # need updated configuration
31 ifeq (,$(MAKE_RESTARTS)$(if $(GIT_BUILD),,T)$(if $(filter-out help showmodules clean distclean,$(MAKECMDGOALS)),,T))
33 # note: this must touch both Makefile and $(BUILDDIR)/Makefile, because make
34 # may be invoked using either of these paths, and it will restart itself only
35 # if the updated target is exactly the same path as the Makefile it is using
36 .PHONY : force-restart
37 Makefile $(BUILDDIR)/Makefile: $(BUILDDIR)/config_host.mk $(BUILDDIR)/config_host_lang.mk force-restart
38 @touch $@
40 # run configure in an environment not polluted by config_host.mk
41 $(BUILDDIR)/config_host.mk : $(wildcard \
42 $(SRCDIR)/config_host.mk.in \
43 $(SRCDIR)/config_host_lang.mk.in \
44 $(SRCDIR)/Makefile.in \
45 $(SRCDIR)/instsetoo_native/util/openoffice.lst.in \
46 $(SRCDIR)/configure.ac \
47 $(SRCDIR)/config_host/*.h.in \
48 $(BUILDDIR)/autogen.input \
49 $(BUILDDIR)/autogen.lastrun \
50 $(BUILDDIR)/autogen.sh \
51 ) \
52 $(shell . $(SRCDIR)/bin/get_config_variables JAVA_HOME && \
53 if test -n "$${JAVA_HOME}" -a ! -d "$${JAVA_HOME}/bin"; then echo force-restart; fi)
54 sh -c $(SRCDIR)/autogen.sh
56 else # MAKE_RESTARTS
58 all: build
60 check-if-root:
61 @if test `id -u` = 0 && ! grep -q 'lxc\|docker' /proc/self/cgroup; then \
62 echo; \
63 echo 'No. You make ME a sandwich.'; \
64 echo; \
65 exit 1; \
68 gb_Side ?= host
70 include $(BUILDDIR)/config_$(gb_Side).mk
72 export GMAKE_OPTIONS?=-r$(if $(verbose),,s)$(value $(MAKEFLAGS))
74 PARALLELISM_OPTION := $(if $(filter-out 0,$(PARALLELISM)),-j $(PARALLELISM),)
76 IWYU_OPTION := $(if $(IWYU_PATH),-k CC=$(IWYU_PATH) CXX=$(IWYU_PATH),)
78 # don't want to have a dependency to iwyudummy.generate because it's
79 # useful to manually edit the generated StaticLibrary_iwyudummy.mk
80 iwyudummy: bootstrap fetch
81 $(if $(wildcard $(BUILDDIR)/iwyudummy),,$(error first call "make iwyudummy.generate"))
82 cd $(BUILDDIR)/iwyudummy && $(MAKE) $(IWYU_OPTION) $(GMAKE_OPTIONS)
84 iwyudummy.generate:
85 $(SRCDIR)/bin/gen-iwyu-dummy-lib
88 # Partial Build
90 define gb_Top_GbuildModuleRules
91 .PHONY: $(1) $(1).all $(1).build $(1).check $(1).clean $(1).showdeliverables $(foreach target,$(gb_Top_MODULE_CHECK_TARGETS),$(1).$(target))
93 $(1): bootstrap fetch
94 cd $(SRCDIR)/$(2) && $$(MAKE) $(IWYU_OPTION) $(PARALLELISM_OPTION) $(GMAKE_OPTIONS)
96 $(1).build $(1).check $(foreach target,$(gb_Top_MODULE_CHECK_TARGETS),$(1).$(target)): bootstrap fetch
97 cd $(SRCDIR)/$(2) && $$(MAKE) $(PARALLELISM_OPTION) $(GMAKE_OPTIONS) $$(patsubst $(1).%,%,$$@)
99 $(1).clean $(1).showdeliverables:
100 cd $(SRCDIR)/$(2) && $$(MAKE) $(PARALLELISM_OPTION) $(GMAKE_OPTIONS) $$(patsubst $(1).%,%,$$@)
102 $(1).all: bootstrap fetch
103 $$(MAKE) $(PARALLELISM_OPTION) $(IWYU_OPTION) $(GMAKE_OPTIONS) -f $(SRCDIR)/Makefile.gbuild $(WORKDIR)/Module/$(1) $(if $(CROSS_COMPILING),,$(WORKDIR)/Module/check/$(1) $(WORKDIR)/Module/slowcheck/$(1))
105 endef
107 define gb_Top_GbuildModulesRules
108 $(foreach m,$(1),$(call gb_Top_GbuildModuleRules,$(notdir $(m)),$(m)))
109 endef
111 gbuild_modules := $(patsubst $(SRCDIR)/%/,%,$(dir $(wildcard $(SRCDIR)/*/Module_*.mk $(SRCDIR)/external/*/Module_*.mk)))
113 gbuild_internal_modules := $(filter-out odk external,$(patsubst $(SRCDIR)/%/,%,$(dir $(wildcard $(SRCDIR)/*/Module_*.mk))))
115 internal.clean: $(addsuffix .clean,$(gbuild_internal_modules))
118 $(eval $(call gb_Top_GbuildModulesRules,$(gbuild_modules)))
120 gbuild_TARGETS := AllLangHelp \
121 AllLangPackage \
122 AllLangResTarget \
123 AutoInstall \
124 CliLibrary \
125 CliNativeLibrary \
126 CliUnoApi \
127 CompilerTest \
128 Configuration \
129 CppunitTest \
130 CustomTarget \
131 Dictionary \
132 Executable \
133 Extension \
134 ExtensionPackage \
135 ExtensionPackageSet \
136 ExternalPackage \
137 ExternalProject \
138 Gallery \
139 GeneratedPackage \
140 InstallModule \
141 InstallScript \
142 InternalUnoApi \
143 Jar \
144 JunitTest \
145 Library \
146 Module \
147 Package \
148 PackageSet \
149 Pagein \
150 Postprocess \
151 Pyuno \
152 PythonTest \
153 Rdb \
154 StaticLibrary \
155 UIConfig \
156 UITest \
157 UnoApi \
158 UnpackedTarball \
159 WinResTarget \
160 Zip \
162 # build a generic gbuild target
163 $(foreach target,$(gbuild_TARGETS),$(target)_% $(foreach module,$(gbuild_modules),$(target)_$(module)/%)) %.genpatch: bootstrap fetch
164 $(MAKE) $(PARALLELISM_OPTION) $(GMAKE_OPTIONS) -f $(SRCDIR)/Makefile.gbuild $@
167 # Clean
169 clean: clean-host clean-build
171 clean-host:
172 rm -fr $(TESTINSTALLDIR)
173 rm -fr $(INSTDIR)
174 rm -fr $(WORKDIR)
176 clean-build:
177 ifneq ($(CROSS_COMPILING),)
178 rm -fr $(INSTDIR_FOR_BUILD)
179 rm -fr $(WORKDIR_FOR_BUILD)
180 endif
182 include $(SRCDIR)/compilerplugins/Makefile.mk
185 # Distclean
187 distclean : clean compilerplugins-clean
188 rm -fr \
189 $(BUILDDIR)/Makefile \
190 $(BUILDDIR)/aclocal.m4 \
191 $(BUILDDIR)/autom4te.cache \
192 $(BUILDDIR)/bin/bffvalidator.sh \
193 $(BUILDDIR)/bin/odfvalidator.sh \
194 $(BUILDDIR)/bin/officeotron.sh \
195 $(BUILDDIR)/config.log \
196 $(BUILDDIR)/config.Build.log \
197 $(BUILDDIR)/config.status \
198 $(BUILDDIR)/config_build.mk \
199 $(BUILDDIR)/config_build_lang.mk \
200 $(BUILDDIR)/config_build/*.h \
201 $(BUILDDIR)/config_host.mk \
202 $(BUILDDIR)/config_host.mk.stamp \
203 $(BUILDDIR)/config_host_lang.mk \
204 $(BUILDDIR)/config_host_lang.mk.stamp \
205 $(BUILDDIR)/config_host/*.h \
206 $(BUILDDIR)/configure \
207 $(BUILDDIR)/instsetoo_native/util/openoffice.lst \
208 $(BUILDDIR)/ios/lo.xcconfig \
209 $(BUILDDIR)/lo.xcent \
210 $(BUILDDIR)/sysui/desktop/macosx/Info.plist
211 $(FIND) $(SRCDIR)/solenv/gdb -name \*.pyc -exec rm {} \;
214 # custom command
216 cmd:
217 echo "custom cmd" && ( $(cmd) )
220 # Fetch
222 ifneq ($(DO_FETCH_TARBALLS),)
223 include $(SRCDIR)/Makefile.fetch
224 fetch: download
225 fetch: get-submodules
227 ifneq (,$(wildcard $(SRCDIR)/.git))
228 get-submodules:
229 ifneq ($(foreach i,$(GIT_NEEDED_SUBMODULES),$(i)/.git),$(wildcard $(foreach i,$(GIT_NEEDED_SUBMODULES),$(i)/.git)))
230 cd $(SRCDIR) && ./g -f clone
231 endif
232 @cd $(SRCDIR) && ./g -z # make sure the git hooks are in place even if no submodules are needed
234 else # these sources are from a tarball, so get the other source tarballs
235 gb_LO_VER := $(shell . $(SRCDIR)/sources.ver && echo $$lo_sources_ver)
236 $(if $(gb_LO_VER),,$(error Error while retrieving $$lo_sources_ver from $(SRCDIR)/sources.ver))
238 get-submodules: | download
239 ifneq ($(foreach i,$(subst helpcontent2,help,$(GIT_NEEDED_SUBMODULES)),$(SRCDIR)/src/libreoffice-$(i)-$(gb_LO_VER)),$(wildcard $(foreach i,$(subst helpcontent2,help,$(GIT_NEEDED_SUBMODULES)),$(SRCDIR)/src/libreoffice-$(i)-$(gb_LO_VER))))
240 $(foreach i,$(subst helpcontent2,help,$(GIT_NEEDED_SUBMODULES)),\
241 $(call fetch_Download_item_unchecked,http://download.documentfoundation.org/libreoffice/src/$(shell echo $(gb_LO_VER) | sed -e "s/\([0-9]*\.[0-9]*\.[0-9]*\).*/\1/"),libreoffice-$(i)-$(gb_LO_VER).tar.xz))
242 $(SRCDIR)/bin/unpack-sources $(SRCDIR) $(foreach i,$(subst helpcontent2,help,$(GIT_NEEDED_SUBMODULES)),\
243 $(TARFILE_LOCATION)/libreoffice-$(i)-$(gb_LO_VER).tar.xz)
244 endif
246 endif
248 else
249 fetch:
250 @echo "Automatic fetching of external tarballs is disabled."
252 endif
255 # Bootstrap
257 bootstrap: check-if-root compilerplugins
260 # Build
262 # Note: this will pipe through all gbuild targets to ... gbuild
263 # with some translations like "build"->"all" for historic reasons
265 build: bootstrap fetch $(if $(CROSS_COMPILING),cross-toolset)
266 ifneq ($(filter-out WNT MACOSX IOS,$(OS)),)
267 mkdir -p $(INSTDIR)
268 $(SRCDIR)/solenv/bin/install-gdb-printers -a $(INSTDIR) -c
269 endif
270 $(MAKE) $(PARALLELISM_OPTION) $(IWYU_OPTION) $(GMAKE_OPTIONS) -f $(SRCDIR)/Makefile.gbuild $(build_goal)
271 ifeq ($(OS),IOS)
272 $(MAKE) $(PARALLELISM_OPTION) $(GMAKE_OPTIONS) ios
273 endif
275 build-non-l10n-only build-l10n-only build-nocheck check debugrun translations packageinfo $(gb_Top_MODULE_CHECK_TARGETS): build
277 help showmodules gbuildtojson:
278 $(MAKE) $(PARALLELISM_OPTION) $(GMAKE_OPTIONS) -f $(SRCDIR)/Makefile.gbuild $@
280 cross-toolset: bootstrap fetch
281 $(MAKE) gb_Side=build $(PARALLELISM_OPTION) $(GMAKE_OPTIONS) -f $(SRCDIR)/Makefile.gbuild build-tools
285 # Install
288 define gb_Top_DoInstall
289 echo "$(1) in $(INSTALLDIR) ..." && \
290 $(SRCDIR)/solenv/bin/ooinstall $(2) "$(INSTALLDIR)"
292 endef
294 ifneq ($(OS),MACOSX)
295 define gb_Top_InstallFinished
296 echo && echo "If you want to edit the .ui files with glade first execute:" && \
297 echo && echo "export GLADE_CATALOG_SEARCH_PATH=$(2)/share/glade" && \
298 echo && echo "$(1) finished, you can now execute:" && \
299 echo "$(2)/program/soffice"
301 endef
302 else
303 define gb_Top_InstallFinished
304 echo && echo "$(1) finished, you can now run: " && \
305 echo "open $(2)/$(PRODUCTNAME).app" && \
306 echo "" && \
307 echo "To debug: gdb $(2)/$(PRODUCTNAME).app/Contents/MacOS/soffice"
309 endef
310 endif
312 ifneq ($(OS),MACOSX)
313 install:
314 @$(call gb_Top_DoInstall,Installing,)
315 @$(call gb_Top_InstallFinished,Installation,$(INSTALLDIR))
317 install-strip:
318 @$(call gb_Top_DoInstall,Installing and stripping binaries,--strip)
319 @$(call gb_Top_InstallFinished,Installation,$(INSTALLDIR))
320 endif # !MACOSX
322 test-install: build
323 @rm -rf $(TESTINSTALLDIR)
324 @mkdir -p $(TESTINSTALLDIR)
325 ifeq ($(OS_FOR_BUILD),WNT)
326 cd $(SRCDIR)/instsetoo_native && $(MAKE) LIBO_TEST_INSTALL=TRUE $(GMAKE_OPTIONS)
327 else
328 @$(SRCDIR)/solenv/bin/ooinstall $(TESTINSTALLDIR)
329 ifneq ($(MACOSX_CODESIGNING_IDENTITY),)
331 # Create Resources/*.lproj directories for languages supported by OS X
332 set -x; for lang in ca cs da de el en es fi fr hr hu id it ja ko ms nl no pl pt pt_PT ro ru sk sv th tr uk vi zh_CN zh_TW; do \
333 lproj=$(TESTINSTALLDIR)/$(PRODUCTNAME_WITHOUT_SPACES).app/Contents/Resources/$$lang.lproj; \
334 mkdir "$$lproj"; \
335 done
337 # And remove the "bin" folder which should not be there
338 rm -rf $(TESTINSTALLDIR)/$(PRODUCTNAME_WITHOUT_SPACES).app/Contents/bin
340 # Remove unnecessary executables in the LibreOfficePython framework
341 rm -rf $(TESTINSTALLDIR)/$(PRODUCTNAME_WITHOUT_SPACES).app/Contents/Frameworks/LibreOfficePython.framework/Versions/[1-9]*/bin
343 # Remove the python.o object file which is weird and interferes with app store uploading
344 # And with it removed, presumably the other stuff in the Python lib/python3.3/config-3.3m probably does not make sense either.
345 rm -rf $(TESTINSTALLDIR)/$(PRODUCTNAME_WITHOUT_SPACES).app/Contents/Frameworks/LibreOfficePython.framework/Versions/[1-9]*/lib/python[1-9]*/config-[1-9]*
347 ifneq ($(ENABLE_MACOSX_SANDBOX),)
348 # Remove the gengal binary and unopkg script that we don't want
349 rm $(TESTINSTALLDIR)/$(PRODUCTNAME_WITHOUT_SPACES).app/Contents/MacOS/gengal
350 rm $(TESTINSTALLDIR)/$(PRODUCTNAME_WITHOUT_SPACES).app/Contents/MacOS/unopkg
351 endif
353 # Then use the macosx-codesign-app-bundle script
354 @$(SRCDIR)/solenv/bin/macosx-codesign-app-bundle $(TESTINSTALLDIR)/$(PRODUCTNAME_WITHOUT_SPACES).app
355 endif
356 endif
357 @$(call gb_Top_InstallFinished,Test Installation,$(TESTINSTALLDIR))
359 mac-app-store-package: test-install
360 ifneq ($(MACOSX_PACKAGE_SIGNING_IDENTITY),)
361 rm -rf "$(PRODUCTNAME).app"
362 mv "$(TESTINSTALLDIR)/$(PRODUCTNAME_WITHOUT_SPACES).app" "$(PRODUCTNAME).app"
363 productbuild --component "$(PRODUCTNAME).app" /Applications --sign $(MACOSX_PACKAGE_SIGNING_IDENTITY) $(PRODUCTNAME_WITHOUT_SPACES).pkg
364 else
365 @echo You did not provide an installer signing identity with --enable-macosx-package-signing
366 @exit 1
367 endif
369 define gb_Top_DistroPackInstall
370 $(SRCDIR)/bin/distro-install-clean-up
371 $(SRCDIR)/bin/distro-install-desktop-integration
372 $(SRCDIR)/bin/distro-install-sdk
373 $(SRCDIR)/bin/distro-install-file-lists
374 endef
376 distro-pack-install: install
377 $(gb_Top_DistroPackInstall)
379 distro-pack-install-strip: install-strip
380 $(gb_Top_DistroPackInstall)
382 install-package-%:
383 $(MAKE) $(GMAKE_OPTIONS) -f $(SRCDIR)/Makefile.gbuild $@
386 @$(SRCDIR)/solenv/bin/create-ids
388 tags:
389 @$(SRCDIR)/solenv/bin/create-tags
391 etags:
392 @$(SRCDIR)/solenv/bin/create-tags -e
394 docs:
395 @$(SRCDIR)/solenv/bin/mkdocs.sh $(SRCDIR)/docs $(SRCDIR)/solenv/inc/doxygen.cfg
397 findunusedcode:
398 @$(SRCDIR)/bin/findunusedcode $(SRCDIR) $(MAKE)
400 findunusedheaders:
401 $(SRCDIR)/bin/find-unusedheaders.pl
403 symbols:
404 rm -fr $(WORKDIR)/symbols/
405 mkdir -p $(WORKDIR)/symbols/
406 ifeq ($(OS),WNT)
407 $(SRCDIR)/bin/symbolstore.py $(WORKDIR)/UnpackedTarball/breakpad/src/tools/windows/binaries/dump_syms.exe $(WORKDIR)/symbols/ $(INSTDIR)/program/*
408 $(SRCDIR)/bin/symstore.sh
409 else
410 $(SRCDIR)/bin/symbolstore.py $(WORKDIR)/UnpackedTarball/breakpad/src/tools/linux/dump_syms/dump_syms $(WORKDIR)/symbols/ $(INSTDIR)/program/*
411 endif
413 cd $(WORKDIR)/symbols/ && zip -r $(WORKDIR)/symbols.zip *
415 upload-symbols:
416 $(MAKE) -f $(SRCDIR)/Makefile.gbuild upload-symbols
418 dump-deps:
419 @$(SRCDIR)/bin/module-deps.pl $(MAKE) $(SRCDIR)/Makefile.gbuild
421 dump-deps-png:
422 @$(SRCDIR)/bin/module-deps.pl $(MAKE) $(SRCDIR)/Makefile.gbuild | dot -Tpng -o lo.png
424 dump-deps-sort:
425 @$(SRCDIR)/bin/module-deps.pl -t $(MAKE) $(SRCDIR)/Makefile.gbuild
427 define gb_Top_GbuildToIdeIntegration
428 $(1)-ide-integration: gbuildtojson $(if $(filter MACOSX,$(OS_FOR_BUILD)),python3.all)
429 cd $(SRCDIR) && \
430 $(if $(filter MACOSX,$(OS_FOR_BUILD)),PATH="$(INSTROOT_FOR_BUILD)/Frameworks/LibreOfficePython.framework/Versions/Current/bin:$(PATH)") \
431 $(SRCDIR)/bin/gbuild-to-ide --ide $(1) --make $(MAKE)
433 endef
435 define gb_Top_GbuildToIdeIntegrationNS
436 $(1)-ide-integration: gbuildtojson $(if $(filter MACOSX,$(OS_FOR_BUILD)),python3.all)
437 cd $(SRCDIR) && \
438 $(if $(filter MACOSX,$(OS_FOR_BUILD)),PATH="$(INSTROOT_FOR_BUILD)/Frameworks/LibreOfficePython.framework/Versions/Current/bin:$(PATH)") \
439 $(SRCDIR)/bin/gbuild-to-ideNS --ide $(1) --make $(MAKE)
441 endef
443 $(foreach ide,\
444 debug \
445 testIde \
446 xcode, \
447 $(eval $(call gb_Top_GbuildToIdeIntegration,$(ide))))
449 $(foreach ide,\
450 codelite \
451 vs2013 \
452 vs2015 \
453 kdevelop \
454 vim \
455 qtcreator \
456 eclipsecdt,\
457 $(eval $(call gb_Top_GbuildToIdeIntegrationNS,$(ide))))
459 fuzzers: Library_sal Library_salhelper Library_reg Library_store Library_unoidl codemaker Library_cppu Library_i18nlangtag Library_cppuhelper Library_comphelper StaticLibrary_ulingu StaticLibrary_findsofficepath Library_tl Library_basegfx Library_canvastools Library_cppcanvas Library_dbtools Library_deploymentmisc Library_deploymentmisc Library_editeng Library_fwe Library_fwi Library_i18nutil Library_localebe1 Library_sax Library_sofficeapp Library_ucbhelper Library_opencl Rdb_services udkapi offapi Library_clew Library_gie Library_icg Library_reflection Library_invocadapt Library_bootstrap Library_introspection Library_stocservices Library_xmlreader Library_gcc3_uno instsetoo_native more_fonts StaticLibrary_fuzzer Executable_wmffuzzer Executable_jpgfuzzer Executable_giffuzzer Executable_xbmfuzzer Executable_xpmfuzzer Executable_pngfuzzer Executable_bmpfuzzer Executable_svmfuzzer Executable_pcdfuzzer Executable_dxffuzzer Executable_metfuzzer Executable_ppmfuzzer Executable_psdfuzzer Executable_epsfuzzer Executable_pctfuzzer Executable_pcxfuzzer Executable_rasfuzzer Executable_tgafuzzer Executable_tiffuzzer Executable_hwpfuzzer Executable_602fuzzer Executable_lwpfuzzer Executable_olefuzzer AllLangResTarget_sd Executable_pptfuzzer Executable_rtffuzzer Executable_cgmfuzzer Executable_ww2fuzzer Executable_ww6fuzzer
461 endif # MAKE_RESTARTS
463 # vim: set noet sw=4 ts=4: