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 .PHONY
: all bootstrap gbuild build build-non-l10n-only build-l10n-only
check clean clean-build clean-host test-install
distclean distro-pack-install docs download fetch findunusedcode get-submodules id
install install-strip subsequentcheck
tags debugrun help slowcheck translations unitcheck packageinfo internal.
clean
13 build_goal
:=$(if
$(filter build
check,$(MAKECMDGOALS
)),all)\
14 $(if
$(filter build-nocheck
,$(MAKECMDGOALS
)),build
)\
15 $(if
$(filter check,$(MAKECMDGOALS
)),subsequentcheck
)\
16 $(filter all build-l10n-only build-non-l10n-only debugrun help slowcheck translations unitcheck subsequentcheck
check packageinfo
,$(MAKECMDGOALS
))
20 BUILDDIR
:= @BUILDDIR@
21 GIT_BUILD
:= $(if
$(wildcard $(SRCDIR
)/.git
),T
)
23 # Run autogen.sh if needed and force make to restart itself.
24 # ... but there are several cases where we do not want to run
26 # 1. if we are building from tarballs, not git checkout (I do not
27 # think packagers would ever want that. I certainly do not.)
28 # 2. if we are making help, clean or distclean, because they do not
29 # need updated configuration
30 ifeq (,$(MAKE_RESTARTS
)$(if
$(GIT_BUILD
),,T
)$(if
$(filter-out help
clean distclean,$(MAKECMDGOALS
)),,T
))
32 .PHONY
: force-restart
33 Makefile
: $(BUILDDIR
)/config_host.mk force-restart
36 # run configure in an environment not polluted by config_host.mk
37 $(BUILDDIR
)/config_host.mk
: $(wildcard \
38 $(SRCDIR
)/config_host.mk.in \
39 $(SRCDIR
)/Makefile.in \
40 $(SRCDIR
)/instsetoo_native
/util
/openoffice.lst.in \
41 $(SRCDIR
)/configure.ac \
42 $(SRCDIR
)/config_host
/*.h.in \
43 $(BUILDDIR
)/autogen.input \
44 $(BUILDDIR
)/autogen.lastrun \
46 sh
-c
$(SRCDIR
)/autogen.sh
54 include $(BUILDDIR
)/config_
$(gb_Side
).mk
56 export GMAKE_OPTIONS?
=-r
$(if
$(verbose
)$(VERBOSE
),,s
)$(value
$(MAKEFLAGS
))
58 PARALLELISM_OPTION
:= $(if
$(filter-out 0,$(PARALLELISM
)),-j
$(PARALLELISM
),)
63 define gb_Top_GbuildModuleRules
64 .PHONY
: $(1) $(1).
all $(1).build
$(1).
check $(1).
clean $(1).showdeliverables
$(1).subsequentcheck
$(1).slowcheck
67 cd
$(SRCDIR
)/$(2) && $$(MAKE
) $(PARALLELISM_OPTION
) $(GMAKE_OPTIONS
)
69 $(1).build
$(1).
check $(1).
clean $(1).showdeliverables
$(1).subsequentcheck
$(1).slowcheck
:
70 cd
$(SRCDIR
)/$(2) && $$(MAKE
) $(PARALLELISM_OPTION
) $(GMAKE_OPTIONS
) $$(patsubst $(1).
%,%,$$@
)
72 $(1).
all: bootstrap fetch
73 $$(MAKE
) $(PARALLELISM_OPTION
) $(GMAKE_OPTIONS
) -f
$(SRCDIR
)/Makefile.gbuild
$(WORKDIR
)/Module
/$(1) $(if
$(CROSS_COMPILING
),,$(WORKDIR
)/Module
/check/$(1) $(WORKDIR
)/Module
/slowcheck
/$(1))
77 define gb_Top_GbuildModulesRules
78 $(foreach m
,$(1),$(call gb_Top_GbuildModuleRules
,$(notdir $(m
)),$(m
)))
81 gbuild_modules
:= $(patsubst $(SRCDIR
)/%/,%,$(dir $(wildcard $(SRCDIR
)/*/Module_
*.mk
$(SRCDIR
)/external
/*/Module_
*.mk
)))
83 gbuild_internal_modules
:= $(filter-out odk external
,$(patsubst $(SRCDIR
)/%/,%,$(dir $(wildcard $(SRCDIR
)/*/Module_
*.mk
))))
85 internal.
clean: $(addsuffix .
clean,$(gbuild_internal_modules
))
88 $(eval
$(call gb_Top_GbuildModulesRules
,$(gbuild_modules
)))
90 gbuild_TARGETS
:= AllLangHelp \
104 ExtensionPackageSet \
129 # build a generic gbuild target
130 $(foreach target
,$(gbuild_TARGETS
),$(target
)_
% $(foreach module
,$(gbuild_modules
),$(target
)_
$(module
)/%)) %.genpatch
: bootstrap fetch
131 $(MAKE
) $(PARALLELISM_OPTION
) $(GMAKE_OPTIONS
) -f
$(SRCDIR
)/Makefile.gbuild
$@
136 clean: clean-host clean-build
139 rm -fr
$(TESTINSTALLDIR
)
146 ifneq ($(CROSS_COMPILING
),)
147 rm -fr
$(INSTDIR_FOR_BUILD
)
148 rm -fr
$(WORKDIR_FOR_BUILD
)
151 include $(SRCDIR
)/compilerplugins
/Makefile.mk
156 distclean : clean compilerplugins-clean
158 $(BUILDDIR
)/Makefile \
159 $(BUILDDIR
)/aclocal.m4 \
160 $(BUILDDIR
)/autom4te.cache \
161 $(BUILDDIR
)/config.log \
162 $(BUILDDIR
)/config.Build.log \
163 $(BUILDDIR
)/config.status \
164 $(BUILDDIR
)/config_build.mk \
165 $(BUILDDIR
)/config_host.mk \
166 $(BUILDDIR
)/config_host.mk.stamp \
167 $(BUILDDIR
)/config_host
/*.h \
168 $(BUILDDIR
)/configure \
169 $(BUILDDIR
)/instsetoo_native
/util
/openoffice.lst \
170 $(BUILDDIR
)/ios
/lo.xcconfig \
171 $(BUILDDIR
)/lo.xcent \
172 $(BUILDDIR
)/sysui
/desktop
/macosx
/Info.plist
173 find
$(SRCDIR
)/solenv
/gdb
-name
"*.pyc" -exec
rm {} \
;
179 echo
"custom cmd" && ( $(cmd
) )
184 ifneq ($(DO_FETCH_TARBALLS
),)
185 include $(SRCDIR
)/Makefile.fetch
187 fetch
: get-submodules
189 ifneq (,$(wildcard $(SRCDIR
)/.git
))
191 ifneq ($(foreach i
,$(GIT_NEEDED_SUBMODULES
),$(i
)/.git
),$(wildcard $(foreach i
,$(GIT_NEEDED_SUBMODULES
),$(i
)/.git
)))
192 cd
$(SRCDIR
) && .
/g
-f clone
194 @cd
$(SRCDIR
) && .
/g
-z
# make sure the git hooks are in place enen if no submodules are needed
196 else # these sources are from a tarball, so get the other source tarballs
197 gb_LO_VER
:= $(shell .
$(SRCDIR
)/sources.ver
&& echo
$$lo_sources_ver)
198 $(if
$(gb_LO_VER
),,$(error Error while retrieving
$$lo_sources_ver from
$(SRCDIR
)/sources.ver
))
200 get-submodules
: | download
201 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
))))
202 $(foreach i
,$(subst helpcontent2
,help
,$(GIT_NEEDED_SUBMODULES
)),\
203 $(call fetch_Download_item
,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
,no-check
))
204 $(SRCDIR
)/bin
/unpack-sources
$(SRCDIR
) $(foreach i
,$(subst helpcontent2
,help
,$(GIT_NEEDED_SUBMODULES
)),\
205 $(TARFILE_LOCATION
)/libreoffice-
$(i
)-$(gb_LO_VER
).
tar.xz
)
212 @echo
"Automatic fetching of external tarballs is disabled."
219 bootstrap
: compilerplugins
224 # Note: this will pipe through all gbuild targets to ... gbuild
225 # with some translations like "build"->"all" for historic reasons
227 build
: bootstrap fetch
$(if
$(CROSS_COMPILING
),cross-toolset
)
228 ifneq ($(filter-out WNT MACOSX IOS ANDROID
,$(OS
)),)
229 mkdir
-p
$(INSTDIR
) && install-gdb-printers
-a
$(INSTDIR
) -c
231 $(MAKE
) $(PARALLELISM_OPTION
) $(GMAKE_OPTIONS
) -f
$(SRCDIR
)/Makefile.gbuild
$(build_goal
)
233 $(MAKE
) $(PARALLELISM_OPTION
) $(GMAKE_OPTIONS
) ios
236 build-non-l10n-only build-l10n-only build-nocheck
check debugrun help slowcheck translations unitcheck subsequentcheck packageinfo
: build
238 cross-toolset
: bootstrap fetch
239 $(MAKE
) gb_Side
=build
$(PARALLELISM_OPTION
) $(GMAKE_OPTIONS
) -f
$(SRCDIR
)/Makefile.gbuild build-tools
246 define gb_Top_DoInstall
247 echo
"$(1) in $(INSTALLDIR) ..." && \
248 ooinstall
$(2) "$(INSTALLDIR)"
253 define gb_Top_InstallFinished
254 echo
&& echo
"If you want to edit the .ui files with glade first execute:" && \
255 echo
&& echo
"export GLADE_CATALOG_SEARCH_PATH=$(2)/share/glade" && \
256 echo
&& echo
"$(1) finished, you can now execute:" && \
257 echo
"$(2)/program/soffice"
261 define gb_Top_InstallFinished
262 echo
&& echo
"$(1) finished, you can now run: " && \
263 echo
"open $(2)/$(PRODUCTNAME).app" && \
265 echo
"To debug: gdb $(2)/$(PRODUCTNAME).app/Contents/MacOS/soffice"
272 @
$(call gb_Top_DoInstall
,Installing
,)
273 @
$(call gb_Top_InstallFinished
,Installation
,$(INSTALLDIR
))
276 @
$(call gb_Top_DoInstall
,Installing and stripping binaries
,--strip)
277 @
$(call gb_Top_InstallFinished
,Installation
,$(INSTALLDIR
))
281 @echo
&& echo
"dev-install is obsolete! Just build with \"make check\" and run"
283 @echo
" open instdir/$(PRODUCTNAME).app"
285 @echo
"To debug: gdb instdir/$(PRODUCTNAME).app/Contents/MacOS/soffice"
287 @echo
" instdir/program/soffice"
290 @echo
"(only if you have good reason to test an actual installation: make test-install)"
295 @
rm -rf
$(TESTINSTALLDIR
)
296 @mkdir
-p
$(TESTINSTALLDIR
)
297 ifeq ($(OS_FOR_BUILD
),WNT
)
298 cd
$(SRCDIR
)/instsetoo_native
&& $(MAKE
) LIBO_TEST_INSTALL
=TRUE
$(GMAKE_OPTIONS
)
300 @ooinstall
$(TESTINSTALLDIR
)
301 ifneq ($(MACOSX_CODESIGNING_IDENTITY
),)
302 @macosx-codesign-app-bundle
$(TESTINSTALLDIR
)/LibreOffice
$(if
$(ENABLE_RELASE_BUILD
),,Dev
).app
305 @
$(call gb_Top_InstallFinished
,Test Installation
,$(TESTINSTALLDIR
))
307 mac-app-store-package
: test-install
308 ifneq ($(MACOSX_PACKAGE_SIGNING_IDENTITY
),)
309 mv
"$(TESTINSTALLDIR)/$(PRODUCTNAME).app" "$(MACOSX_APP_NAME).app"
310 productbuild
--component
"$(MACOSX_APP_NAME).app" /Applications
--sign
$(MACOSX_PACKAGE_SIGNING_IDENTITY
) $(shell echo
"$(MACOSX_APP_NAME)" | tr
' ' '-').pkg
312 @echo You did not provide an installer signing identity with
--enable-macosx-package-signing
316 distro-pack-install
: install
317 $(SRCDIR
)/bin
/distro-install-clean-up
318 $(SRCDIR
)/bin
/distro-install-desktop-integration
319 $(SRCDIR
)/bin
/distro-install-sdk
320 $(SRCDIR
)/bin
/distro-install-file-lists
323 $(MAKE
) $(GMAKE_OPTIONS
) -f
$(SRCDIR
)/Makefile.gbuild
$@
332 @mkdocs.sh
$(SRCDIR
)/docs
$(SRCDIR
)/solenv
/inc
/doxygen.cfg
335 @
$(SRCDIR
)/bin
/findunusedcode
$(SRCDIR
) $(MAKE
)
338 $(SRCDIR
)/bin
/find-unusedheaders.pl
342 @
$(SRCDIR
)/bin
/module-deps.pl
$(MAKE
) $(SRCDIR
)/Makefile.gbuild
345 @
$(SRCDIR
)/bin
/module-deps.pl
$(MAKE
) $(SRCDIR
)/Makefile.gbuild | dot
-Tpng
-o lo.png
348 @
$(SRCDIR
)/bin
/module-deps.pl
-t
$(MAKE
) $(SRCDIR
)/Makefile.gbuild
350 define gb_Top_GbuildToIdeIntegration
351 $(1)-ide-integration
:
352 cd
$(SRCDIR
) && (LC_MESSAGES
=C
$(MAKE
) cmd
="$(MAKE) -npf Makefile.gbuild all" cmd || true
) |
$(SRCDIR
)/bin
/gbuild-to-ide
--ide
$(1)
360 $(eval
$(call gb_Top_GbuildToIdeIntegration
,$(ide
))))
362 endif # MAKE_RESTARTS
364 # vim: set noet sw=4 ts=4: