Updated core
[LibreOffice.git] / Makefile.in
blob037cb5dce95b101789a73051bb1cb0726059e24e
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 .PHONY : force-restart
34 Makefile: $(BUILDDIR)/config_host.mk $(BUILDDIR)/config_host_lang.mk force-restart
35 @touch $@
37 # run configure in an environment not polluted by config_host.mk
38 $(BUILDDIR)/config_host.mk : $(wildcard \
39 $(SRCDIR)/config_host.mk.in \
40 $(SRCDIR)/config_host_lang.mk.in \
41 $(SRCDIR)/Makefile.in \
42 $(SRCDIR)/instsetoo_native/util/openoffice.lst.in \
43 $(SRCDIR)/configure.ac \
44 $(SRCDIR)/config_host/*.h.in \
45 $(BUILDDIR)/autogen.input \
46 $(BUILDDIR)/autogen.lastrun \
47 $(BUILDDIR)/autogen.sh \
48 ) \
49 $(shell . $(SRCDIR)/bin/get_config_variables JAVA_HOME && \
50 if test -n "$${JAVA_HOME}" -a ! -d "$${JAVA_HOME}/bin"; then echo force-restart; fi)
51 sh -c $(SRCDIR)/autogen.sh
53 else # MAKE_RESTARTS
55 all: build
57 check-if-root:
58 @if test `id -u` = 0 && ! grep -q 'lxc\|docker' /proc/self/cgroup; then \
59 echo; \
60 echo 'No. You make ME a sandwich.'; \
61 echo; \
62 exit 1; \
65 gb_Side ?= host
67 include $(BUILDDIR)/config_$(gb_Side).mk
69 export GMAKE_OPTIONS?=-r$(if $(verbose),,s)$(value $(MAKEFLAGS))
71 PARALLELISM_OPTION := $(if $(filter-out 0,$(PARALLELISM)),-j $(PARALLELISM),)
73 IWYU_OPTION := $(if $(IWYU_PATH),-k CC=$(IWYU_PATH) CXX=$(IWYU_PATH),)
75 # don't want to have a dependency to iwyudummy.generate because it's
76 # useful to manually edit the generated StaticLibrary_iwyudummy.mk
77 iwyudummy: bootstrap fetch
78 $(if $(wildcard $(BUILDDIR)/iwyudummy),,$(error first call "make iwyudummy.generate"))
79 cd $(BUILDDIR)/iwyudummy && $(MAKE) $(IWYU_OPTION) $(GMAKE_OPTIONS)
81 iwyudummy.generate:
82 $(SRCDIR)/bin/gen-iwyu-dummy-lib
85 # Partial Build
87 define gb_Top_GbuildModuleRules
88 .PHONY: $(1) $(1).all $(1).build $(1).check $(1).clean $(1).showdeliverables $(foreach target,$(gb_Top_MODULE_CHECK_TARGETS),$(1).$(target))
90 $(1): bootstrap fetch
91 cd $(SRCDIR)/$(2) && $$(MAKE) $(IWYU_OPTION) $(PARALLELISM_OPTION) $(GMAKE_OPTIONS)
93 $(1).build $(1).check $(foreach target,$(gb_Top_MODULE_CHECK_TARGETS),$(1).$(target)): bootstrap fetch
94 cd $(SRCDIR)/$(2) && $$(MAKE) $(PARALLELISM_OPTION) $(GMAKE_OPTIONS) $$(patsubst $(1).%,%,$$@)
96 $(1).clean $(1).showdeliverables:
97 cd $(SRCDIR)/$(2) && $$(MAKE) $(PARALLELISM_OPTION) $(GMAKE_OPTIONS) $$(patsubst $(1).%,%,$$@)
99 $(1).all: bootstrap fetch
100 $$(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))
102 endef
104 define gb_Top_GbuildModulesRules
105 $(foreach m,$(1),$(call gb_Top_GbuildModuleRules,$(notdir $(m)),$(m)))
106 endef
108 gbuild_modules := $(patsubst $(SRCDIR)/%/,%,$(dir $(wildcard $(SRCDIR)/*/Module_*.mk $(SRCDIR)/external/*/Module_*.mk)))
110 gbuild_internal_modules := $(filter-out odk external,$(patsubst $(SRCDIR)/%/,%,$(dir $(wildcard $(SRCDIR)/*/Module_*.mk))))
112 internal.clean: $(addsuffix .clean,$(gbuild_internal_modules))
115 $(eval $(call gb_Top_GbuildModulesRules,$(gbuild_modules)))
117 gbuild_TARGETS := AllLangHelp \
118 AllLangPackage \
119 AllLangResTarget \
120 AutoInstall \
121 CliLibrary \
122 CliNativeLibrary \
123 CliUnoApi \
124 CompilerTest \
125 Configuration \
126 CppunitTest \
127 CustomTarget \
128 Dictionary \
129 Executable \
130 Extension \
131 ExtensionPackage \
132 ExtensionPackageSet \
133 ExternalPackage \
134 ExternalProject \
135 Gallery \
136 GeneratedPackage \
137 InstallModule \
138 InstallScript \
139 InternalUnoApi \
140 Jar \
141 JunitTest \
142 Library \
143 Module \
144 Package \
145 PackageSet \
146 Pagein \
147 Postprocess \
148 Pyuno \
149 PythonTest \
150 Rdb \
151 StaticLibrary \
152 UIConfig \
153 UITest \
154 UnoApi \
155 UnpackedTarball \
156 WinResTarget \
157 Zip \
159 # build a generic gbuild target
160 $(foreach target,$(gbuild_TARGETS),$(target)_% $(foreach module,$(gbuild_modules),$(target)_$(module)/%)) %.genpatch: bootstrap fetch
161 $(MAKE) $(PARALLELISM_OPTION) $(GMAKE_OPTIONS) -f $(SRCDIR)/Makefile.gbuild $@
164 # Clean
166 clean: clean-host clean-build
168 clean-host:
169 rm -fr $(TESTINSTALLDIR)
170 rm -fr $(INSTDIR)
171 rm -fr $(WORKDIR)
173 clean-build:
174 ifneq ($(CROSS_COMPILING),)
175 rm -fr $(INSTDIR_FOR_BUILD)
176 rm -fr $(WORKDIR_FOR_BUILD)
177 endif
179 include $(SRCDIR)/compilerplugins/Makefile.mk
182 # Distclean
184 distclean : clean compilerplugins-clean
185 rm -fr \
186 $(BUILDDIR)/Makefile \
187 $(BUILDDIR)/aclocal.m4 \
188 $(BUILDDIR)/autom4te.cache \
189 $(BUILDDIR)/bin/bffvalidator.sh \
190 $(BUILDDIR)/bin/odfvalidator.sh \
191 $(BUILDDIR)/bin/officeotron.sh \
192 $(BUILDDIR)/config.log \
193 $(BUILDDIR)/config.Build.log \
194 $(BUILDDIR)/config.status \
195 $(BUILDDIR)/config_build.mk \
196 $(BUILDDIR)/config_build_lang.mk \
197 $(BUILDDIR)/config_build/*.h \
198 $(BUILDDIR)/config_host.mk \
199 $(BUILDDIR)/config_host.mk.stamp \
200 $(BUILDDIR)/config_host_lang.mk \
201 $(BUILDDIR)/config_host_lang.mk.stamp \
202 $(BUILDDIR)/config_host/*.h \
203 $(BUILDDIR)/configure \
204 $(BUILDDIR)/instsetoo_native/util/openoffice.lst \
205 $(BUILDDIR)/ios/lo.xcconfig \
206 $(BUILDDIR)/lo.xcent \
207 $(BUILDDIR)/sysui/desktop/macosx/Info.plist
208 $(FIND) $(SRCDIR)/solenv/gdb -name \*.pyc -exec rm {} \;
211 # custom command
213 cmd:
214 echo "custom cmd" && ( $(cmd) )
217 # Fetch
219 ifneq ($(DO_FETCH_TARBALLS),)
220 include $(SRCDIR)/Makefile.fetch
221 fetch: download
222 fetch: get-submodules
224 ifneq (,$(wildcard $(SRCDIR)/.git))
225 get-submodules:
226 ifneq ($(foreach i,$(GIT_NEEDED_SUBMODULES),$(i)/.git),$(wildcard $(foreach i,$(GIT_NEEDED_SUBMODULES),$(i)/.git)))
227 cd $(SRCDIR) && ./g -f clone
228 endif
229 @cd $(SRCDIR) && ./g -z # make sure the git hooks are in place even if no submodules are needed
231 else # these sources are from a tarball, so get the other source tarballs
232 gb_LO_VER := $(shell . $(SRCDIR)/sources.ver && echo $$lo_sources_ver)
233 $(if $(gb_LO_VER),,$(error Error while retrieving $$lo_sources_ver from $(SRCDIR)/sources.ver))
235 get-submodules: | download
236 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))))
237 $(foreach i,$(subst helpcontent2,help,$(GIT_NEEDED_SUBMODULES)),\
238 $(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))
239 $(SRCDIR)/bin/unpack-sources $(SRCDIR) $(foreach i,$(subst helpcontent2,help,$(GIT_NEEDED_SUBMODULES)),\
240 $(TARFILE_LOCATION)/libreoffice-$(i)-$(gb_LO_VER).tar.xz)
241 endif
243 endif
245 else
246 fetch:
247 @echo "Automatic fetching of external tarballs is disabled."
249 endif
252 # Bootstrap
254 bootstrap: check-if-root compilerplugins
257 # Build
259 # Note: this will pipe through all gbuild targets to ... gbuild
260 # with some translations like "build"->"all" for historic reasons
262 build: bootstrap fetch $(if $(CROSS_COMPILING),cross-toolset)
263 ifneq ($(filter-out WNT MACOSX IOS,$(OS)),)
264 mkdir -p $(INSTDIR)
265 $(SRCDIR)/solenv/bin/install-gdb-printers -a $(INSTDIR) -c
266 endif
267 $(MAKE) $(PARALLELISM_OPTION) $(IWYU_OPTION) $(GMAKE_OPTIONS) -f $(SRCDIR)/Makefile.gbuild $(build_goal)
268 ifeq ($(OS),IOS)
269 $(MAKE) $(PARALLELISM_OPTION) $(GMAKE_OPTIONS) ios
270 endif
272 build-non-l10n-only build-l10n-only build-nocheck check debugrun translations packageinfo $(gb_Top_MODULE_CHECK_TARGETS): build
274 help showmodules gbuildtojson:
275 $(MAKE) $(PARALLELISM_OPTION) $(GMAKE_OPTIONS) -f $(SRCDIR)/Makefile.gbuild $@
277 cross-toolset: bootstrap fetch
278 $(MAKE) gb_Side=build $(PARALLELISM_OPTION) $(GMAKE_OPTIONS) -f $(SRCDIR)/Makefile.gbuild build-tools
282 # Install
285 define gb_Top_DoInstall
286 echo "$(1) in $(INSTALLDIR) ..." && \
287 $(SRCDIR)/solenv/bin/ooinstall $(2) "$(INSTALLDIR)"
289 endef
291 ifneq ($(OS),MACOSX)
292 define gb_Top_InstallFinished
293 echo && echo "If you want to edit the .ui files with glade first execute:" && \
294 echo && echo "export GLADE_CATALOG_SEARCH_PATH=$(2)/share/glade" && \
295 echo && echo "$(1) finished, you can now execute:" && \
296 echo "$(2)/program/soffice"
298 endef
299 else
300 define gb_Top_InstallFinished
301 echo && echo "$(1) finished, you can now run: " && \
302 echo "open $(2)/$(PRODUCTNAME).app" && \
303 echo "" && \
304 echo "To debug: gdb $(2)/$(PRODUCTNAME).app/Contents/MacOS/soffice"
306 endef
307 endif
309 ifneq ($(OS),MACOSX)
310 install:
311 @$(call gb_Top_DoInstall,Installing,)
312 @$(call gb_Top_InstallFinished,Installation,$(INSTALLDIR))
314 install-strip:
315 @$(call gb_Top_DoInstall,Installing and stripping binaries,--strip)
316 @$(call gb_Top_InstallFinished,Installation,$(INSTALLDIR))
317 endif # !MACOSX
319 test-install: build
320 @rm -rf $(TESTINSTALLDIR)
321 @mkdir -p $(TESTINSTALLDIR)
322 ifeq ($(OS_FOR_BUILD),WNT)
323 cd $(SRCDIR)/instsetoo_native && $(MAKE) LIBO_TEST_INSTALL=TRUE $(GMAKE_OPTIONS)
324 else
325 @$(SRCDIR)/solenv/bin/ooinstall $(TESTINSTALLDIR)
326 ifneq ($(MACOSX_CODESIGNING_IDENTITY),)
328 # Create Resources/*.lproj directories for languages supported by OS X
329 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 \
330 lproj=$(TESTINSTALLDIR)/$(PRODUCTNAME_WITHOUT_SPACES).app/Contents/Resources/$$lang.lproj; \
331 mkdir "$$lproj"; \
332 done
334 # And remove the "bin" folder which should not be there
335 rm -rf $(TESTINSTALLDIR)/$(PRODUCTNAME_WITHOUT_SPACES).app/Contents/bin
337 # Remove unnecessary executables in the LibreOfficePython framework
338 rm -rf $(TESTINSTALLDIR)/$(PRODUCTNAME_WITHOUT_SPACES).app/Contents/Frameworks/LibreOfficePython.framework/Versions/[1-9]*/bin
340 # Remove the python.o object file which is weird and interferes with app store uploading
341 # And with it removed, presumably the other stuff in the Python lib/python3.3/config-3.3m probably does not make sense either.
342 rm -rf $(TESTINSTALLDIR)/$(PRODUCTNAME_WITHOUT_SPACES).app/Contents/Frameworks/LibreOfficePython.framework/Versions/[1-9]*/lib/python[1-9]*/config-[1-9]*
344 ifneq ($(ENABLE_MACOSX_SANDBOX),)
345 # Remove the gengal binary and unopkg script that we don't want
346 rm $(TESTINSTALLDIR)/$(PRODUCTNAME_WITHOUT_SPACES).app/Contents/MacOS/gengal
347 rm $(TESTINSTALLDIR)/$(PRODUCTNAME_WITHOUT_SPACES).app/Contents/MacOS/unopkg
348 endif
350 # Then use the macosx-codesign-app-bundle script
351 @$(SRCDIR)/solenv/bin/macosx-codesign-app-bundle $(TESTINSTALLDIR)/$(PRODUCTNAME_WITHOUT_SPACES).app
352 endif
353 endif
354 @$(call gb_Top_InstallFinished,Test Installation,$(TESTINSTALLDIR))
356 mac-app-store-package: test-install
357 ifneq ($(MACOSX_PACKAGE_SIGNING_IDENTITY),)
358 rm -rf "$(PRODUCTNAME).app"
359 mv "$(TESTINSTALLDIR)/$(PRODUCTNAME_WITHOUT_SPACES).app" "$(PRODUCTNAME).app"
360 productbuild --component "$(PRODUCTNAME).app" /Applications --sign $(MACOSX_PACKAGE_SIGNING_IDENTITY) $(PRODUCTNAME_WITHOUT_SPACES).pkg
361 else
362 @echo You did not provide an installer signing identity with --enable-macosx-package-signing
363 @exit 1
364 endif
366 define gb_Top_DistroPackInstall
367 $(SRCDIR)/bin/distro-install-clean-up
368 $(SRCDIR)/bin/distro-install-desktop-integration
369 $(SRCDIR)/bin/distro-install-sdk
370 $(SRCDIR)/bin/distro-install-file-lists
371 endef
373 distro-pack-install: install
374 $(gb_Top_DistroPackInstall)
376 distro-pack-install-strip: install-strip
377 $(gb_Top_DistroPackInstall)
379 install-package-%:
380 $(MAKE) $(GMAKE_OPTIONS) -f $(SRCDIR)/Makefile.gbuild $@
383 @$(SRCDIR)/solenv/bin/create-ids
385 tags:
386 @$(SRCDIR)/solenv/bin/create-tags
388 etags:
389 @$(SRCDIR)/solenv/bin/create-tags -e
391 docs:
392 @$(SRCDIR)/solenv/bin/mkdocs.sh $(SRCDIR)/docs $(SRCDIR)/solenv/inc/doxygen.cfg
394 findunusedcode:
395 @$(SRCDIR)/bin/findunusedcode $(SRCDIR) $(MAKE)
397 findunusedheaders:
398 $(SRCDIR)/bin/find-unusedheaders.pl
400 symbols:
401 rm -fr $(WORKDIR)/symbols/
402 mkdir -p $(WORKDIR)/symbols/
403 ifeq ($(OS),WNT)
404 $(SRCDIR)/bin/symbolstore.py $(WORKDIR)/UnpackedTarball/breakpad/src/tools/windows/binaries/dump_syms.exe $(WORKDIR)/symbols/ $(INSTDIR)/program/*
405 $(SRCDIR)/bin/symstore.sh
406 else
407 $(SRCDIR)/bin/symbolstore.py $(WORKDIR)/UnpackedTarball/breakpad/src/tools/linux/dump_syms/dump_syms $(WORKDIR)/symbols/ $(INSTDIR)/program/*
408 endif
410 cd $(WORKDIR)/symbols/ && zip -r $(WORKDIR)/symbols.zip *
412 upload-symbols:
413 $(MAKE) -f $(SRCDIR)/Makefile.gbuild upload-symbols
415 dump-deps:
416 @$(SRCDIR)/bin/module-deps.pl $(MAKE) $(SRCDIR)/Makefile.gbuild
418 dump-deps-png:
419 @$(SRCDIR)/bin/module-deps.pl $(MAKE) $(SRCDIR)/Makefile.gbuild | dot -Tpng -o lo.png
421 dump-deps-sort:
422 @$(SRCDIR)/bin/module-deps.pl -t $(MAKE) $(SRCDIR)/Makefile.gbuild
424 define gb_Top_GbuildToIdeIntegration
425 $(1)-ide-integration: gbuildtojson $(if $(filter MACOSX,$(OS_FOR_BUILD)),python3.all)
426 cd $(SRCDIR) && \
427 $(if $(filter MACOSX,$(OS_FOR_BUILD)),PATH="$(INSTROOT_FOR_BUILD)/Frameworks/LibreOfficePython.framework/Versions/Current/bin:$(PATH)") \
428 $(SRCDIR)/bin/gbuild-to-ide --ide $(1) --make $(MAKE)
430 endef
432 define gb_Top_GbuildToIdeIntegrationNS
433 $(1)-ide-integration: gbuildtojson $(if $(filter MACOSX,$(OS_FOR_BUILD)),python3.all)
434 cd $(SRCDIR) && \
435 $(if $(filter MACOSX,$(OS_FOR_BUILD)),PATH="$(INSTROOT_FOR_BUILD)/Frameworks/LibreOfficePython.framework/Versions/Current/bin:$(PATH)") \
436 $(SRCDIR)/bin/gbuild-to-ideNS --ide $(1) --make $(MAKE)
438 endef
440 $(foreach ide,\
441 debug \
442 testIde \
443 xcode, \
444 $(eval $(call gb_Top_GbuildToIdeIntegration,$(ide))))
446 $(foreach ide,\
447 codelite \
448 vs2013 \
449 vs2015 \
450 kdevelop \
451 vim \
452 qtcreator \
453 eclipsecdt,\
454 $(eval $(call gb_Top_GbuildToIdeIntegrationNS,$(ide))))
456 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
458 endif # MAKE_RESTARTS
460 # vim: set noet sw=4 ts=4: