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
)
15 build_goal
:=$(if
$(filter build
check,$(MAKECMDGOALS
)),all)\
16 $(if
$(filter build-nocheck
,$(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 gbuildtoide
,$(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 .PHONY
: force-restart
34 Makefile
: $(BUILDDIR
)/config_host.mk
$(BUILDDIR
)/config_host_lang.mk force-restart
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 \
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
58 @if
test `id -u` = 0; then \
60 echo
'No. You make ME a sandwich.'; \
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
)
82 $(SRCDIR
)/bin
/gen-iwyu-dummy-lib
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
))
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))
104 define gb_Top_GbuildModulesRules
105 $(foreach m
,$(1),$(call gb_Top_GbuildModuleRules
,$(notdir $(m
)),$(m
)))
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 \
131 ExtensionPackageSet \
158 # build a generic gbuild target
159 $(foreach target
,$(gbuild_TARGETS
),$(target
)_
% $(foreach module
,$(gbuild_modules
),$(target
)_
$(module
)/%)) %.genpatch
: bootstrap fetch
160 $(MAKE
) $(PARALLELISM_OPTION
) $(GMAKE_OPTIONS
) -f
$(SRCDIR
)/Makefile.gbuild
$@
165 clean: clean-host clean-build
168 rm -fr
$(TESTINSTALLDIR
)
173 ifneq ($(CROSS_COMPILING
),)
174 rm -fr
$(INSTDIR_FOR_BUILD
)
175 rm -fr
$(WORKDIR_FOR_BUILD
)
178 include $(SRCDIR
)/compilerplugins
/Makefile.mk
183 distclean : clean compilerplugins-clean
185 $(BUILDDIR
)/Makefile \
186 $(BUILDDIR
)/aclocal.m4 \
187 $(BUILDDIR
)/autom4te.cache \
188 $(BUILDDIR
)/bin
/bffvalidator.sh \
189 $(BUILDDIR
)/bin
/odfvalidator.sh \
190 $(BUILDDIR
)/bin
/officeotron.sh \
191 $(BUILDDIR
)/config.log \
192 $(BUILDDIR
)/config.Build.log \
193 $(BUILDDIR
)/config.status \
194 $(BUILDDIR
)/config_build.mk \
195 $(BUILDDIR
)/config_build_lang.mk \
196 $(BUILDDIR
)/config_build
/*.h \
197 $(BUILDDIR
)/config_host.mk \
198 $(BUILDDIR
)/config_host.mk.stamp \
199 $(BUILDDIR
)/config_host_lang.mk \
200 $(BUILDDIR
)/config_host_lang.mk.stamp \
201 $(BUILDDIR
)/config_host
/*.h \
202 $(BUILDDIR
)/configure \
203 $(BUILDDIR
)/instsetoo_native
/util
/openoffice.lst \
204 $(BUILDDIR
)/ios
/lo.xcconfig \
205 $(BUILDDIR
)/lo.xcent \
206 $(BUILDDIR
)/sysui
/desktop
/macosx
/Info.plist
207 $(FIND
) $(SRCDIR
)/solenv
/gdb
-name \
*.pyc
-exec
rm {} \
;
213 echo
"custom cmd" && ( $(cmd
) )
218 ifneq ($(DO_FETCH_TARBALLS
),)
219 include $(SRCDIR
)/Makefile.fetch
221 fetch
: get-submodules
223 ifneq (,$(wildcard $(SRCDIR
)/.git
))
225 ifneq ($(foreach i
,$(GIT_NEEDED_SUBMODULES
),$(i
)/.git
),$(wildcard $(foreach i
,$(GIT_NEEDED_SUBMODULES
),$(i
)/.git
)))
226 cd
$(SRCDIR
) && .
/g
-f clone
228 @cd
$(SRCDIR
) && .
/g
-z
# make sure the git hooks are in place even if no submodules are needed
230 else # these sources are from a tarball, so get the other source tarballs
231 gb_LO_VER
:= $(shell .
$(SRCDIR
)/sources.ver
&& echo
$$lo_sources_ver)
232 $(if
$(gb_LO_VER
),,$(error Error while retrieving
$$lo_sources_ver from
$(SRCDIR
)/sources.ver
))
234 get-submodules
: | download
235 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
))))
236 $(foreach i
,$(subst helpcontent2
,help
,$(GIT_NEEDED_SUBMODULES
)),\
237 $(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
))
238 $(SRCDIR
)/bin
/unpack-sources
$(SRCDIR
) $(foreach i
,$(subst helpcontent2
,help
,$(GIT_NEEDED_SUBMODULES
)),\
239 $(TARFILE_LOCATION
)/libreoffice-
$(i
)-$(gb_LO_VER
).
tar.xz
)
246 @echo
"Automatic fetching of external tarballs is disabled."
253 bootstrap
: check-if-root compilerplugins
258 # Note: this will pipe through all gbuild targets to ... gbuild
259 # with some translations like "build"->"all" for historic reasons
261 build
: bootstrap fetch
$(if
$(CROSS_COMPILING
),cross-toolset
)
262 ifneq ($(filter-out WNT MACOSX IOS
,$(OS
)),)
264 $(SRCDIR
)/solenv
/bin
/install-gdb-printers
-a
$(INSTDIR
) -c
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 gbuildtoide
:
274 $(MAKE
) $(PARALLELISM_OPTION
) $(GMAKE_OPTIONS
) -f
$(SRCDIR
)/Makefile.gbuild
$@
276 cross-toolset
: bootstrap fetch
277 $(MAKE
) gb_Side
=build
$(PARALLELISM_OPTION
) $(GMAKE_OPTIONS
) -f
$(SRCDIR
)/Makefile.gbuild build-tools
284 define gb_Top_DoInstall
285 echo
"$(1) in $(INSTALLDIR) ..." && \
286 $(SRCDIR
)/solenv
/bin
/ooinstall
$(2) "$(INSTALLDIR)"
291 define gb_Top_InstallFinished
292 echo
&& echo
"If you want to edit the .ui files with glade first execute:" && \
293 echo
&& echo
"export GLADE_CATALOG_SEARCH_PATH=$(2)/share/glade" && \
294 echo
&& echo
"$(1) finished, you can now execute:" && \
295 echo
"$(2)/program/soffice"
299 define gb_Top_InstallFinished
300 echo
&& echo
"$(1) finished, you can now run: " && \
301 echo
"open $(2)/$(PRODUCTNAME).app" && \
303 echo
"To debug: gdb $(2)/$(PRODUCTNAME).app/Contents/MacOS/soffice"
310 @
$(call gb_Top_DoInstall
,Installing
,)
311 @
$(call gb_Top_InstallFinished
,Installation
,$(INSTALLDIR
))
314 @
$(call gb_Top_DoInstall
,Installing and stripping binaries
,--strip)
315 @
$(call gb_Top_InstallFinished
,Installation
,$(INSTALLDIR
))
319 @
rm -rf
$(TESTINSTALLDIR
)
320 @mkdir
-p
$(TESTINSTALLDIR
)
321 ifeq ($(OS_FOR_BUILD
),WNT
)
322 cd
$(SRCDIR
)/instsetoo_native
&& $(MAKE
) LIBO_TEST_INSTALL
=TRUE
$(GMAKE_OPTIONS
)
324 @
$(SRCDIR
)/solenv
/bin
/ooinstall
$(TESTINSTALLDIR
)
325 ifneq ($(MACOSX_CODESIGNING_IDENTITY
),)
327 # Create Resources/*.lproj directories for languages supported by OS X
328 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 \
329 lproj
=$(TESTINSTALLDIR
)/$(PRODUCTNAME_WITHOUT_SPACES
).app
/Contents
/Resources
/$$lang.lproj
; \
333 # And remove the "bin" folder which should not be there
334 rm -rf
$(TESTINSTALLDIR
)/$(PRODUCTNAME_WITHOUT_SPACES
).app
/Contents
/bin
336 # Remove unnecessary executables in the LibreOfficePython framework
337 rm -rf
$(TESTINSTALLDIR
)/$(PRODUCTNAME_WITHOUT_SPACES
).app
/Contents
/Frameworks
/LibreOfficePython.framework
/Versions
/[1-9]*/bin
339 # Remove the python.o object file which is weird and interferes with app store uploading
340 # And with it removed, presumably the other stuff in the Python lib/python3.3/config-3.3m probably does not make sense either.
341 rm -rf
$(TESTINSTALLDIR
)/$(PRODUCTNAME_WITHOUT_SPACES
).app
/Contents
/Frameworks
/LibreOfficePython.framework
/Versions
/[1-9]*/lib
/python
[1-9]*/config-
[1-9]*
343 ifneq ($(ENABLE_MACOSX_SANDBOX
),)
344 # Remove the gengal binary and unopkg and unoinfo scripts that we don't want
345 rm $(TESTINSTALLDIR
)/$(PRODUCTNAME_WITHOUT_SPACES
).app
/Contents
/MacOS
/gengal
346 rm $(TESTINSTALLDIR
)/$(PRODUCTNAME_WITHOUT_SPACES
).app
/Contents
/MacOS
/unopkg
347 rm $(TESTINSTALLDIR
)/$(PRODUCTNAME_WITHOUT_SPACES
).app
/Contents
/MacOS
/unoinfo
350 # Then use the macosx-codesign-app-bundle script
351 @
$(SRCDIR
)/solenv
/bin
/macosx-codesign-app-bundle
$(TESTINSTALLDIR
)/$(PRODUCTNAME_WITHOUT_SPACES
).app
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
362 @echo You did not provide an installer signing identity with
--enable-macosx-package-signing
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
373 distro-pack-install
: install
374 $(gb_Top_DistroPackInstall
)
376 distro-pack-install-strip
: install-strip
377 $(gb_Top_DistroPackInstall
)
380 $(MAKE
) $(GMAKE_OPTIONS
) -f
$(SRCDIR
)/Makefile.gbuild
$@
383 @
$(SRCDIR
)/solenv
/bin
/create-ids
386 @
$(SRCDIR
)/solenv
/bin
/create-tags
389 @
$(SRCDIR
)/solenv
/bin
/create-tags
-e
392 @
$(SRCDIR
)/solenv
/bin
/mkdocs.sh
$(SRCDIR
)/docs
$(SRCDIR
)/solenv
/inc
/doxygen.cfg
395 @
$(SRCDIR
)/bin
/findunusedcode
$(SRCDIR
) $(MAKE
)
398 $(SRCDIR
)/bin
/find-unusedheaders.pl
401 rm -fr
$(WORKDIR
)/symbols
/
402 mkdir
-p
$(WORKDIR
)/symbols
/
404 $(SRCDIR
)/bin
/symbolstore.py
$(WORKDIR
)/UnpackedTarball
/breakpad
/src
/tools
/windows
/binaries
/dump_syms.exe
$(WORKDIR
)/symbols
/ $(INSTDIR
)/program
/*
406 $(SRCDIR
)/bin
/symbolstore.py
$(WORKDIR
)/UnpackedTarball
/breakpad
/src
/tools
/linux
/dump_syms
/dump_syms
$(WORKDIR
)/symbols
/ $(INSTDIR
)/program
/*
409 cd
$(WORKDIR
)/symbols
/ && zip
-r
$(WORKDIR
)/symbols.zip
*
412 $(MAKE
) -f
$(SRCDIR
)/Makefile.gbuild upload-symbols
415 @
$(SRCDIR
)/bin
/module-deps.pl
$(MAKE
) $(SRCDIR
)/Makefile.gbuild
418 @
$(SRCDIR
)/bin
/module-deps.pl
$(MAKE
) $(SRCDIR
)/Makefile.gbuild | dot
-Tpng
-o lo.png
421 @
$(SRCDIR
)/bin
/module-deps.pl
-t
$(MAKE
) $(SRCDIR
)/Makefile.gbuild
423 define gb_Top_GbuildToIdeIntegration
424 $(1)-ide-integration
:
425 cd
$(SRCDIR
) && (LC_MESSAGES
=C
$(MAKE
) cmd
="$(MAKE) -npf Makefile.gbuild all" cmd || true
) |
$(SRCDIR
)/bin
/gbuild-to-ide
--ide
$(1)
438 $(eval
$(call gb_Top_GbuildToIdeIntegration
,$(ide
))))
440 endif # MAKE_RESTARTS
442 # vim: set noet sw=4 ts=4: