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-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
)
265 ifneq ($(filter-out WNT MACOSX IOS
,$(OS
)),)
267 $(SRCDIR
)/solenv
/bin
/install-gdb-printers
-a
$(INSTDIR
) -c
269 $(MAKE
) $(PARALLELISM_OPTION
) $(IWYU_OPTION
) $(GMAKE_OPTIONS
) -f
$(SRCDIR
)/Makefile.gbuild
$(build_goal
)
271 $(MAKE
) $(PARALLELISM_OPTION
) $(GMAKE_OPTIONS
) ios
274 build-non-l10n-only build-l10n-only build-nocheck
check debugrun translations packageinfo
$(gb_Top_MODULE_CHECK_TARGETS
): build
276 help showmodules gbuildtojson
:
277 $(MAKE
) $(PARALLELISM_OPTION
) $(GMAKE_OPTIONS
) -f
$(SRCDIR
)/Makefile.gbuild
$@
279 cross-toolset
: bootstrap fetch
280 # fetch again in case there are externals only needed on build platform
282 $(MAKE
) gb_Side
=build
$(PARALLELISM_OPTION
) $(GMAKE_OPTIONS
) -f
$(BUILDDIR
)/Makefile fetch
284 $(MAKE
) gb_Side
=build
$(PARALLELISM_OPTION
) $(GMAKE_OPTIONS
) -f
$(SRCDIR
)/Makefile.gbuild build-tools
291 define gb_Top_DoInstall
292 echo
"$(1) in $(INSTALLDIR) ..." && \
293 $(SRCDIR
)/solenv
/bin
/ooinstall
$(2) "$(INSTALLDIR)"
298 define gb_Top_InstallFinished
299 echo
&& echo
"If you want to edit the .ui files with glade first execute:" && \
300 echo
&& echo
"export GLADE_CATALOG_SEARCH_PATH=$(2)/share/glade" && \
301 echo
&& echo
"$(1) finished, you can now execute:" && \
302 echo
"$(2)/program/soffice"
306 define gb_Top_InstallFinished
307 echo
&& echo
"$(1) finished, you can now run: " && \
308 echo
"open $(2)/$(PRODUCTNAME).app" && \
310 echo
"To debug: gdb $(2)/$(PRODUCTNAME).app/Contents/MacOS/soffice"
317 @
$(call gb_Top_DoInstall
,Installing
,)
318 @
$(call gb_Top_InstallFinished
,Installation
,$(INSTALLDIR
))
321 @
$(call gb_Top_DoInstall
,Installing and stripping binaries
,--strip)
322 @
$(call gb_Top_InstallFinished
,Installation
,$(INSTALLDIR
))
326 @
rm -rf
$(TESTINSTALLDIR
)
327 @mkdir
-p
$(TESTINSTALLDIR
)
328 ifeq ($(OS_FOR_BUILD
),WNT
)
329 cd
$(SRCDIR
)/instsetoo_native
&& $(MAKE
) LIBO_TEST_INSTALL
=TRUE
$(GMAKE_OPTIONS
)
331 @
$(SRCDIR
)/solenv
/bin
/ooinstall
$(TESTINSTALLDIR
)
332 ifneq ($(MACOSX_CODESIGNING_IDENTITY
),)
334 # Create Resources/*.lproj directories for languages supported by OS X
335 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 \
336 lproj
=$(TESTINSTALLDIR
)/$(PRODUCTNAME_WITHOUT_SPACES
).app
/Contents
/Resources
/$$lang.lproj
; \
340 # And remove the "bin" folder which should not be there
341 rm -rf
$(TESTINSTALLDIR
)/$(PRODUCTNAME_WITHOUT_SPACES
).app
/Contents
/bin
343 # Remove unnecessary executables in the LibreOfficePython framework
344 rm -rf
$(TESTINSTALLDIR
)/$(PRODUCTNAME_WITHOUT_SPACES
).app
/Contents
/Frameworks
/LibreOfficePython.framework
/Versions
/[1-9]*/bin
346 # Remove the python.o object file which is weird and interferes with app store uploading
347 # And with it removed, presumably the other stuff in the Python lib/python3.3/config-3.3m probably does not make sense either.
348 rm -rf
$(TESTINSTALLDIR
)/$(PRODUCTNAME_WITHOUT_SPACES
).app
/Contents
/Frameworks
/LibreOfficePython.framework
/Versions
/[1-9]*/lib
/python
[1-9]*/config-
[1-9]*
350 ifneq ($(ENABLE_MACOSX_SANDBOX
),)
351 # Remove the gengal binary and unopkg script that we don't want
352 rm $(TESTINSTALLDIR
)/$(PRODUCTNAME_WITHOUT_SPACES
).app
/Contents
/MacOS
/gengal
353 rm $(TESTINSTALLDIR
)/$(PRODUCTNAME_WITHOUT_SPACES
).app
/Contents
/MacOS
/unopkg
356 # Then use the macosx-codesign-app-bundle script
357 @
$(SRCDIR
)/solenv
/bin
/macosx-codesign-app-bundle
$(TESTINSTALLDIR
)/$(PRODUCTNAME_WITHOUT_SPACES
).app
360 @
$(call gb_Top_InstallFinished
,Test Installation
,$(TESTINSTALLDIR
))
362 mac-app-store-package
: test-install
363 ifneq ($(MACOSX_PACKAGE_SIGNING_IDENTITY
),)
364 rm -rf
"$(PRODUCTNAME).app"
365 mv
"$(TESTINSTALLDIR)/$(PRODUCTNAME_WITHOUT_SPACES).app" "$(PRODUCTNAME).app"
366 productbuild
--component
"$(PRODUCTNAME).app" /Applications
--sign
$(MACOSX_PACKAGE_SIGNING_IDENTITY
) $(PRODUCTNAME_WITHOUT_SPACES
).pkg
368 @echo You did not provide an installer signing identity with
--enable-macosx-package-signing
372 define gb_Top_DistroPackInstall
373 $(SRCDIR
)/bin
/distro-install-clean-up
374 $(SRCDIR
)/bin
/distro-install-desktop-integration
375 $(SRCDIR
)/bin
/distro-install-sdk
376 $(SRCDIR
)/bin
/distro-install-file-lists
379 distro-pack-install
: install
380 $(gb_Top_DistroPackInstall
)
382 distro-pack-install-strip
: install-strip
383 $(gb_Top_DistroPackInstall
)
386 $(MAKE
) $(GMAKE_OPTIONS
) -f
$(SRCDIR
)/Makefile.gbuild
$@
389 @
$(SRCDIR
)/solenv
/bin
/create-ids
392 @
$(SRCDIR
)/solenv
/bin
/create-tags
395 @
$(SRCDIR
)/solenv
/bin
/create-tags
-e
398 @
$(SRCDIR
)/solenv
/bin
/mkdocs.sh
$(SRCDIR
)/docs
$(SRCDIR
)/solenv
/inc
/doxygen.cfg
401 $(SRCDIR
)/bin
/find-unusedheaders.py
404 rm -fr
$(WORKDIR
)/symbols
/
405 mkdir
-p
$(WORKDIR
)/symbols
/
407 $(SRCDIR
)/bin
/symbolstore.py
$(WORKDIR
)/UnpackedTarball
/breakpad
/src
/tools
/windows
/binaries
/dump_syms.exe
$(WORKDIR
)/symbols
/ $(INSTDIR
)/program
/*
408 $(SRCDIR
)/bin
/symstore.sh
410 $(SRCDIR
)/bin
/symbolstore.py
$(WORKDIR
)/UnpackedTarball
/breakpad
/src
/tools
/linux
/dump_syms
/dump_syms
$(WORKDIR
)/symbols
/ $(INSTDIR
)/program
/*
413 cd
$(WORKDIR
)/symbols
/ && zip
-r
$(WORKDIR
)/symbols.zip
*
416 rm -fr
$(WORKDIR
)/installation
/mar
/
417 rm -fr
$(WORKDIR
)/installation
/temp
/
418 mkdir
-p
$(WORKDIR
)/installation
/temp
/
419 mkdir
-p
$(WORKDIR
)/installation
/mar
/
420 tar -xzf
$(WORKDIR
)/installation
/LibreOfficeDev
/archive
/install/en-US
/LibreOffice
* -C
$(WORKDIR
)/installation
/temp
/
421 $(SRCDIR
)/bin
/update
/make_full_update.sh
$(WORKDIR
)/installation
/mar
/test.mar
$(WORKDIR
)/installation
/temp
/*/
424 $(MAKE
) -f
$(SRCDIR
)/Makefile.gbuild upload-symbols
427 $(MAKE
) -f
$(SRCDIR
)/Makefile.gbuild create-update-info
430 $(MAKE
) -f
$(SRCDIR
)/Makefile.gbuild upload-update-info
433 $(MAKE
) -f
$(SRCDIR
)/Makefile.gbuild create-partial-info
436 @
$(SRCDIR
)/bin
/module-deps.pl
$(MAKE
) $(SRCDIR
)/Makefile.gbuild
439 @
$(SRCDIR
)/bin
/module-deps.pl
$(MAKE
) $(SRCDIR
)/Makefile.gbuild | dot
-Tpng
-o lo.png
442 @
$(SRCDIR
)/bin
/module-deps.pl
-t
$(MAKE
) $(SRCDIR
)/Makefile.gbuild
444 define gb_Top_GbuildToIdeIntegration
445 $(1)-ide-integration
: gbuildtojson
$(if
$(filter MACOSX
,$(OS_FOR_BUILD
)),python3.
all)
447 $(if
$(filter MACOSX
,$(OS_FOR_BUILD
)),PATH
="$(INSTROOT_FOR_BUILD)/Frameworks/LibreOfficePython.framework/Versions/Current/bin:$(PATH)") \
448 $(SRCDIR
)/bin
/gbuild-to-ide
--ide
$(1) --make
$(MAKE
)
452 define gb_Top_GbuildToIdeIntegrationNS
453 $(1)-ide-integration
: gbuildtojson
$(if
$(filter MACOSX
,$(OS_FOR_BUILD
)),python3.
all)
455 $(if
$(filter MACOSX
,$(OS_FOR_BUILD
)),PATH
="$(INSTROOT_FOR_BUILD)/Frameworks/LibreOfficePython.framework/Versions/Current/bin:$(PATH)") \
456 $(SRCDIR
)/bin
/gbuild-to-ideNS
--ide
$(1) --make
$(MAKE
)
464 $(eval
$(call gb_Top_GbuildToIdeIntegration
,$(ide
))))
473 $(eval
$(call gb_Top_GbuildToIdeIntegrationNS
,$(ide
))))
475 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
477 endif # MAKE_RESTARTS
479 # vim: set noet sw=4 ts=4: