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 get-submodules id
install install-gdb-printers install-strip
tags debugrun help showmodules translations packageinfo internal.
clean $(gb_Top_MODULE_CHECK_TARGETS
)
15 build_goal
:=$(if
$(filter build
check,$(MAKECMDGOALS
)),all)\
16 $(if
$(filter build-nocheck uicheck
,$(MAKECMDGOALS
)),build
)\
17 $(if
$(filter check,$(MAKECMDGOALS
)),subsequentcheck
$(if
$(filter Linux
, $(shell uname
)), uicheck
))\
18 $(filter all build-l10n-only build-non-l10n-only debugrun help showmodules translations
$(gb_Top_MODULE_CHECK_TARGETS
) check packageinfo gbuildtojson
,$(MAKECMDGOALS
))
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
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
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 \
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
61 @if
test `id -u` = 0 && ! grep
-q
'lxc\|docker' /proc
/self
/cgroup
; then \
63 echo
'No. You make ME a sandwich.'; \
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
)
85 $(SRCDIR
)/bin
/gen-iwyu-dummy-lib
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
))
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))
107 define gb_Top_GbuildModulesRules
108 $(foreach m
,$(1),$(call gb_Top_GbuildModuleRules
,$(notdir $(m
)),$(m
)))
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 \
134 ExtensionPackageSet \
161 # build a generic gbuild target
162 $(foreach target
,$(gbuild_TARGETS
),$(target
)_
% $(foreach module
,$(gbuild_modules
),$(target
)_
$(module
)/%)) %.genpatch
: bootstrap fetch
163 $(MAKE
) $(PARALLELISM_OPTION
) $(GMAKE_OPTIONS
) -f
$(SRCDIR
)/Makefile.gbuild
$@
168 clean: clean-host clean-build
171 rm -fr
$(TESTINSTALLDIR
)
176 ifneq ($(CROSS_COMPILING
),)
177 rm -fr
$(INSTDIR_FOR_BUILD
)
178 rm -fr
$(WORKDIR_FOR_BUILD
)
181 include $(SRCDIR
)/compilerplugins
/Makefile.mk
186 distclean : clean compilerplugins-clean
188 $(BUILDDIR
)/Makefile \
189 $(BUILDDIR
)/aclocal.m4 \
190 $(BUILDDIR
)/autom4te.cache \
191 $(BUILDDIR
)/bin
/bffvalidator.sh \
192 $(BUILDDIR
)/bin
/odfvalidator.sh \
193 $(BUILDDIR
)/bin
/officeotron.sh \
194 $(BUILDDIR
)/config.log \
195 $(BUILDDIR
)/config.Build.log \
196 $(BUILDDIR
)/config.status \
197 $(BUILDDIR
)/config_build.mk \
198 $(BUILDDIR
)/config_build_lang.mk \
199 $(BUILDDIR
)/config_build
/*.h \
200 $(BUILDDIR
)/config_host.mk \
201 $(BUILDDIR
)/config_host.mk.stamp \
202 $(BUILDDIR
)/config_host_lang.mk \
203 $(BUILDDIR
)/config_host_lang.mk.stamp \
204 $(BUILDDIR
)/config_host
/*.h \
205 $(BUILDDIR
)/configure \
206 $(BUILDDIR
)/instsetoo_native
/util
/openoffice.lst \
207 $(BUILDDIR
)/ios
/lo.xcconfig \
208 $(BUILDDIR
)/lo.xcent \
209 $(BUILDDIR
)/sysui
/desktop
/macosx
/Info.plist
210 $(FIND
) $(SRCDIR
)/solenv
/gdb
-name \
*.pyc
-exec
rm {} \
;
216 echo
"custom cmd" && ( $(cmd
) )
221 ifneq ($(DO_FETCH_TARBALLS
),)
222 include $(SRCDIR
)/Makefile.fetch
224 fetch
: get-submodules
226 ifneq (,$(wildcard $(SRCDIR
)/.git
))
228 ifneq ($(foreach i
,$(GIT_NEEDED_SUBMODULES
),$(i
)/.git
),$(wildcard $(foreach i
,$(GIT_NEEDED_SUBMODULES
),$(i
)/.git
)))
229 cd
$(SRCDIR
) && .
/g
-f clone
231 @cd
$(SRCDIR
) && .
/g
-z
# make sure the git hooks are in place even if no submodules are needed
233 else # these sources are from a tarball, so get the other source tarballs
234 gb_LO_VER
:= $(shell .
$(SRCDIR
)/sources.ver
&& echo
$$lo_sources_ver)
235 $(if
$(gb_LO_VER
),,$(error Error while retrieving
$$lo_sources_ver from
$(SRCDIR
)/sources.ver
))
237 get-submodules
: | download
238 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
))))
239 $(foreach i
,$(subst helpcontent2
,help
,$(GIT_NEEDED_SUBMODULES
)),\
240 $(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
))
241 $(SRCDIR
)/bin
/unpack-sources
$(SRCDIR
) $(foreach i
,$(subst helpcontent2
,help
,$(GIT_NEEDED_SUBMODULES
)),\
242 $(TARFILE_LOCATION
)/libreoffice-
$(i
)-$(gb_LO_VER
).
tar.xz
)
249 @echo
"Automatic fetching of external tarballs is disabled."
256 bootstrap
: check-if-root compilerplugins
261 # Note: this will pipe through all gbuild targets to ... gbuild
262 # with some translations like "build"->"all" for historic reasons
264 build
: bootstrap fetch
$(if
$(CROSS_COMPILING
),cross-toolset
) \
266 $(MAKE
) $(PARALLELISM_OPTION
) $(IWYU_OPTION
) $(GMAKE_OPTIONS
) -f
$(SRCDIR
)/Makefile.gbuild
$(build_goal
)
268 $(MAKE
) $(PARALLELISM_OPTION
) $(GMAKE_OPTIONS
) ios
271 build-non-l10n-only build-l10n-only build-nocheck
check debugrun translations packageinfo
$(gb_Top_MODULE_CHECK_TARGETS
): build
273 help showmodules gbuildtojson
:
274 $(MAKE
) $(PARALLELISM_OPTION
) $(GMAKE_OPTIONS
) -f
$(SRCDIR
)/Makefile.gbuild
$@
276 cross-toolset
: bootstrap fetch
277 # fetch again in case there are externals only needed on build platform
279 $(MAKE
) gb_Side
=build
$(PARALLELISM_OPTION
) $(GMAKE_OPTIONS
) -f
$(BUILDDIR
)/Makefile fetch
281 $(MAKE
) gb_Side
=build
$(PARALLELISM_OPTION
) $(GMAKE_OPTIONS
) -f
$(SRCDIR
)/Makefile.gbuild build-tools
283 install-gdb-printers
:
284 ifneq ($(filter-out WNT MACOSX IOS
,$(OS
)),)
286 $(SRCDIR
)/solenv
/bin
/install-gdb-printers
-a
$(INSTDIR
) -c
294 define gb_Top_DoInstall
295 echo
"$(1) in $(INSTALLDIR) ..." && \
296 $(SRCDIR
)/solenv
/bin
/ooinstall
$(2) "$(INSTALLDIR)"
301 define gb_Top_InstallFinished
302 echo
&& echo
"If you want to edit the .ui files with glade first execute:" && \
303 echo
&& echo
"export GLADE_CATALOG_SEARCH_PATH=$(2)/share/glade" && \
304 echo
&& echo
"$(1) finished, you can now execute:" && \
305 echo
"$(2)/program/soffice"
309 define gb_Top_InstallFinished
310 echo
&& echo
"$(1) finished, you can now run: " && \
311 echo
"open $(2)/$(PRODUCTNAME).app" && \
313 echo
"To debug: gdb $(2)/$(PRODUCTNAME).app/Contents/MacOS/soffice"
320 @
$(call gb_Top_DoInstall
,Installing
,)
321 @
$(call gb_Top_InstallFinished
,Installation
,$(INSTALLDIR
))
324 @
$(call gb_Top_DoInstall
,Installing and stripping binaries
,--strip)
325 @
$(call gb_Top_InstallFinished
,Installation
,$(INSTALLDIR
))
329 @
rm -rf
$(TESTINSTALLDIR
)
330 @mkdir
-p
$(TESTINSTALLDIR
)
331 ifeq ($(OS_FOR_BUILD
),WNT
)
332 cd
$(SRCDIR
)/instsetoo_native
&& $(MAKE
) LIBO_TEST_INSTALL
=TRUE
$(GMAKE_OPTIONS
)
334 @
$(SRCDIR
)/solenv
/bin
/ooinstall
$(TESTINSTALLDIR
)
335 ifneq ($(MACOSX_CODESIGNING_IDENTITY
),)
337 # Create Resources/*.lproj directories for languages supported by OS X
338 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 \
339 lproj
=$(TESTINSTALLDIR
)/$(PRODUCTNAME_WITHOUT_SPACES
).app
/Contents
/Resources
/$$lang.lproj
; \
343 # And remove the "bin" folder which should not be there
344 rm -rf
$(TESTINSTALLDIR
)/$(PRODUCTNAME_WITHOUT_SPACES
).app
/Contents
/bin
346 # Remove unnecessary executables in the LibreOfficePython framework
347 rm -rf
$(TESTINSTALLDIR
)/$(PRODUCTNAME_WITHOUT_SPACES
).app
/Contents
/Frameworks
/LibreOfficePython.framework
/Versions
/[1-9]*/bin
349 # Remove the python.o object file which is weird and interferes with app store uploading
350 # And with it removed, presumably the other stuff in the Python lib/python3.3/config-3.3m probably does not make sense either.
351 rm -rf
$(TESTINSTALLDIR
)/$(PRODUCTNAME_WITHOUT_SPACES
).app
/Contents
/Frameworks
/LibreOfficePython.framework
/Versions
/[1-9]*/lib
/python
[1-9]*/config-
[1-9]*
353 ifneq ($(ENABLE_MACOSX_SANDBOX
),)
354 # Remove the gengal binary and unopkg script that we don't want
355 rm $(TESTINSTALLDIR
)/$(PRODUCTNAME_WITHOUT_SPACES
).app
/Contents
/MacOS
/gengal
356 rm $(TESTINSTALLDIR
)/$(PRODUCTNAME_WITHOUT_SPACES
).app
/Contents
/MacOS
/unopkg
359 # Then use the macosx-codesign-app-bundle script
360 @
$(SRCDIR
)/solenv
/bin
/macosx-codesign-app-bundle
$(TESTINSTALLDIR
)/$(PRODUCTNAME_WITHOUT_SPACES
).app
363 @
$(call gb_Top_InstallFinished
,Test Installation
,$(TESTINSTALLDIR
))
365 mac-app-store-package
: test-install
366 ifneq ($(MACOSX_PACKAGE_SIGNING_IDENTITY
),)
367 rm -rf
"$(PRODUCTNAME).app"
368 mv
"$(TESTINSTALLDIR)/$(PRODUCTNAME_WITHOUT_SPACES).app" "$(PRODUCTNAME).app"
369 productbuild
--component
"$(PRODUCTNAME).app" /Applications
--sign
$(MACOSX_PACKAGE_SIGNING_IDENTITY
) $(PRODUCTNAME_WITHOUT_SPACES
).pkg
371 @echo You did not provide an installer signing identity with
--enable-macosx-package-signing
375 define gb_Top_DistroPackInstall
376 $(SRCDIR
)/bin
/distro-install-clean-up
377 $(SRCDIR
)/bin
/distro-install-desktop-integration
378 $(SRCDIR
)/bin
/distro-install-sdk
379 $(SRCDIR
)/bin
/distro-install-file-lists
382 distro-pack-install
: install
383 $(gb_Top_DistroPackInstall
)
385 distro-pack-install-strip
: install-strip
386 $(gb_Top_DistroPackInstall
)
389 $(MAKE
) $(GMAKE_OPTIONS
) -f
$(SRCDIR
)/Makefile.gbuild
$@
392 @
$(SRCDIR
)/solenv
/bin
/create-ids
395 @
$(SRCDIR
)/solenv
/bin
/create-tags
398 @
$(SRCDIR
)/solenv
/bin
/create-tags
-e
401 @
$(SRCDIR
)/solenv
/bin
/mkdocs.sh
$(SRCDIR
)/docs
$(SRCDIR
)/solenv
/inc
/doxygen.cfg
404 $(SRCDIR
)/bin
/find-unusedheaders.py
407 rm -fr
$(WORKDIR
)/symbols
/
408 mkdir
-p
$(WORKDIR
)/symbols
/
410 $(SRCDIR
)/bin
/symbolstore.py
$(WORKDIR
)/UnpackedTarball
/breakpad
/src
/tools
/windows
/binaries
/dump_syms.exe
$(WORKDIR
)/symbols
/ $(INSTDIR
)/program
/*
411 $(SRCDIR
)/bin
/symstore.sh
413 $(SRCDIR
)/bin
/symbolstore.py
$(WORKDIR
)/UnpackedTarball
/breakpad
/src
/tools
/linux
/dump_syms
/dump_syms
$(WORKDIR
)/symbols
/ $(INSTDIR
)/program
/*
416 cd
$(WORKDIR
)/symbols
/ && zip
-r
$(WORKDIR
)/symbols.zip
*
419 rm -fr
$(WORKDIR
)/installation
/mar
/
420 rm -fr
$(WORKDIR
)/installation
/temp
/
421 mkdir
-p
$(WORKDIR
)/installation
/temp
/
422 mkdir
-p
$(WORKDIR
)/installation
/mar
/
423 tar -xzf
$(WORKDIR
)/installation
/LibreOfficeDev
/archive
/install/en-US
/LibreOffice
* -C
$(WORKDIR
)/installation
/temp
/
424 $(SRCDIR
)/bin
/update
/make_full_update.sh
$(WORKDIR
)/installation
/mar
/test.mar
$(WORKDIR
)/installation
/temp
/*/
427 $(MAKE
) -f
$(SRCDIR
)/Makefile.gbuild upload-symbols
430 $(MAKE
) -f
$(SRCDIR
)/Makefile.gbuild create-update-info
433 $(MAKE
) -f
$(SRCDIR
)/Makefile.gbuild upload-update-info
436 $(MAKE
) -f
$(SRCDIR
)/Makefile.gbuild create-partial-info
439 @
$(SRCDIR
)/bin
/module-deps.pl
$(MAKE
) $(SRCDIR
)/Makefile.gbuild
442 @
$(SRCDIR
)/bin
/module-deps.pl
$(MAKE
) $(SRCDIR
)/Makefile.gbuild | dot
-Tpng
-o lo.png
445 @
$(SRCDIR
)/bin
/module-deps.pl
-t
$(MAKE
) $(SRCDIR
)/Makefile.gbuild
447 define gb_Top_GbuildToIdeIntegration
448 $(1)-ide-integration
: gbuildtojson
$(if
$(filter MACOSX
,$(OS_FOR_BUILD
)),python3.
all)
450 $(if
$(filter MACOSX
,$(OS_FOR_BUILD
)),PATH
="$(INSTROOT_FOR_BUILD)/Frameworks/LibreOfficePython.framework/Versions/Current/bin:$(PATH)") \
451 $(SRCDIR
)/bin
/gbuild-to-ide
--ide
$(1) --make
$(MAKE
)
455 define gb_Top_GbuildToIdeIntegrationNS
456 $(1)-ide-integration
: gbuildtojson
$(if
$(filter MACOSX
,$(OS_FOR_BUILD
)),python3.
all)
458 $(if
$(filter MACOSX
,$(OS_FOR_BUILD
)),PATH
="$(INSTROOT_FOR_BUILD)/Frameworks/LibreOfficePython.framework/Versions/Current/bin:$(PATH)") \
459 $(SRCDIR
)/bin
/gbuild-to-ideNS
--ide
$(1) --make
$(MAKE
)
467 $(eval
$(call gb_Top_GbuildToIdeIntegration
,$(ide
))))
476 $(eval
$(call gb_Top_GbuildToIdeIntegrationNS
,$(ide
))))
478 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_boost_locale StaticLibrary_fuzzerstubs StaticLibrary_fuzzer_core StaticLibrary_fuzzer_calc StaticLibrary_fuzzer_draw StaticLibrary_fuzzer_writer Library_forui 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 Executable_pptfuzzer Executable_rtffuzzer Executable_cgmfuzzer Executable_ww2fuzzer Executable_ww6fuzzer Executable_ww8fuzzer Executable_qpwfuzzer Executable_slkfuzzer
480 endif # MAKE_RESTARTS
482 # vim: set noet sw=4 ts=4: