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
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
))
18 SHELL
=/usr
/bin
/env bash
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 \
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 $(eval
$(call gb_Top_GbuildModulesRules
,$(gbuild_modules
)))
85 gbuild_TARGETS
:= AllLangHelp \
124 # build a generic gbuild target
125 $(foreach target
,$(gbuild_TARGETS
),$(target
)_
% $(foreach module
,$(gbuild_modules
),$(target
)_
$(module
)/%)) %.genpatch
:
126 $(MAKE
) $(PARALLELISM_OPTION
) $(GMAKE_OPTIONS
) -f
$(SRCDIR
)/Makefile.gbuild
$@
131 clean: clean-host clean-build
134 rm -fr
$(TESTINSTALLDIR
)
141 ifneq ($(CROSS_COMPILING
),)
142 rm -fr
$(INSTDIR_FOR_BUILD
)
143 rm -fr
$(WORKDIR_FOR_BUILD
)
146 include $(SRCDIR
)/compilerplugins
/Makefile.mk
151 distclean : clean compilerplugins-clean
153 $(BUILDDIR
)/Makefile \
154 $(BUILDDIR
)/aclocal.m4 \
155 $(BUILDDIR
)/autom4te.cache \
156 $(BUILDDIR
)/config.log \
157 $(BUILDDIR
)/config.Build.log \
158 $(BUILDDIR
)/config.status \
159 $(BUILDDIR
)/config_build.mk \
160 $(BUILDDIR
)/config_host.mk \
161 $(BUILDDIR
)/config_host.mk.stamp \
162 $(BUILDDIR
)/config_host
/*.h \
163 $(BUILDDIR
)/configure \
164 $(BUILDDIR
)/instsetoo_native
/util
/openoffice.lst \
165 $(BUILDDIR
)/ios
/lo.xcconfig \
166 $(BUILDDIR
)/lo.xcent \
167 $(BUILDDIR
)/sysui
/desktop
/macosx
/Info.plist
168 find
$(SRCDIR
)/solenv
/gdb
-name
"*.pyc" -exec
rm {} \
;
174 echo
"custom cmd" && ( $(cmd
) )
179 ifneq ($(DO_FETCH_TARBALLS
),)
180 include $(SRCDIR
)/Makefile.fetch
182 fetch
: get-submodules
184 ifneq (,$(wildcard $(SRCDIR
)/.git
))
186 ifneq ($(foreach i
,$(GIT_NEEDED_SUBMODULES
),$(i
)/.git
),$(wildcard $(foreach i
,$(GIT_NEEDED_SUBMODULES
),$(i
)/.git
)))
187 cd
$(SRCDIR
) && .
/g
-f clone
189 @cd
$(SRCDIR
) && .
/g
-z
# make sure the git hooks are in place enen if no submodules are needed
191 else # these sources are from a tarball, so get the other source tarballs
192 gb_LO_VER
:= $(shell .
$(SRCDIR
)/sources.ver
&& echo
$$lo_sources_ver)
193 $(if
$(gb_LO_VER
),,$(error Error while retrieving
$$lo_sources_ver from
$(SRCDIR
)/sources.ver
))
195 get-submodules
: | download
196 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
))))
197 $(foreach i
,$(subst helpcontent2
,help
,$(GIT_NEEDED_SUBMODULES
)),\
198 $(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
))
199 $(SRCDIR
)/bin
/unpack-sources
$(SRCDIR
) $(foreach i
,$(subst helpcontent2
,help
,$(GIT_NEEDED_SUBMODULES
)),\
200 $(TARFILE_LOCATION
)/libreoffice-
$(i
)-$(gb_LO_VER
).
tar.xz
)
207 @echo
"Automatic fetching of external tarballs is disabled."
214 bootstrap
: compilerplugins
219 # Note: this will pipe through all gbuild targets to ... gbuild
220 # with some translations like "build"->"all" for historic reasons
222 build
: bootstrap fetch
$(if
$(CROSS_COMPILING
),cross-toolset
)
223 ifneq ($(filter-out WNT MACOSX IOS ANDROID
,$(OS
)),)
224 mkdir
-p
$(INSTDIR
) && install-gdb-printers
-a
$(INSTDIR
) -c
226 $(MAKE
) $(PARALLELISM_OPTION
) $(GMAKE_OPTIONS
) -f
$(SRCDIR
)/Makefile.gbuild
$(build_goal
)
228 $(MAKE
) $(PARALLELISM_OPTION
) $(GMAKE_OPTIONS
) ios
231 build-non-l10n-only build-l10n-only build-nocheck
check debugrun help slowcheck translations unitcheck subsequentcheck packageinfo
: build
233 cross-toolset
: bootstrap fetch
234 $(MAKE
) gb_Side
=build
$(PARALLELISM_OPTION
) $(GMAKE_OPTIONS
) -f
$(SRCDIR
)/Makefile.gbuild build-tools
241 define gb_Top_DoInstall
242 echo
"$(1) in $(INSTALLDIR) ..." && \
243 ooinstall
$(2) "$(INSTALLDIR)"
248 define gb_Top_InstallFinished
249 echo
&& echo
"If you want to edit the .ui files with glade first execute:" && \
250 echo
&& echo
"export GLADE_CATALOG_SEARCH_PATH=$(2)/share/glade" && \
251 echo
&& echo
"$(1) finished, you can now execute:" && \
252 echo
"$(2)/program/soffice"
256 define gb_Top_InstallFinished
257 echo
&& echo
"$(1) finished, you can now run: " && \
258 echo
"open $(2)/$(PRODUCTNAME).app" && \
260 echo
"To debug: gdb $(2)/$(PRODUCTNAME).app/Contents/MacOS/soffice"
267 @
$(call gb_Top_DoInstall
,Installing
,)
268 @
$(call gb_Top_InstallFinished
,Installation
,$(INSTALLDIR
))
271 @
$(call gb_Top_DoInstall
,Installing and stripping binaries
,--strip)
272 @
$(call gb_Top_InstallFinished
,Installation
,$(INSTALLDIR
))
276 @echo
&& echo
"dev-install is obsolete! Just build with \"make check\" and run"
278 @echo
" open instdir/$(PRODUCTNAME).app"
280 @echo
"To debug: gdb instdir/$(PRODUCTNAME).app/Contents/MacOS/soffice"
282 @echo
" instdir/program/soffice"
285 @echo
"(only if you have good reason to test an actual installation: make test-install)"
290 @
rm -rf
$(TESTINSTALLDIR
)
291 @mkdir
-p
$(TESTINSTALLDIR
)
292 ifeq ($(OS_FOR_BUILD
),WNT
)
293 cd
$(SRCDIR
)/instsetoo_native
&& $(MAKE
) LIBO_TEST_INSTALL
=TRUE
$(GMAKE_OPTIONS
)
295 @ooinstall
$(TESTINSTALLDIR
)
296 ifneq ($(MACOSX_CODESIGNING_IDENTITY
),)
297 @macosx-codesign-app-bundle
$(TESTINSTALLDIR
)/LibreOffice.app
300 @
$(call gb_Top_InstallFinished
,Test Installation
,$(TESTINSTALLDIR
))
302 distro-pack-install
: install
303 $(SRCDIR
)/bin
/distro-install-clean-up
304 $(SRCDIR
)/bin
/distro-install-desktop-integration
305 $(SRCDIR
)/bin
/distro-install-sdk
306 $(SRCDIR
)/bin
/distro-install-file-lists
309 $(MAKE
) $(GMAKE_OPTIONS
) -f
$(SRCDIR
)/Makefile.gbuild
$@
318 @mkdocs.sh
$(SRCDIR
)/docs
$(SRCDIR
)/solenv
/inc
/doxygen.cfg
321 @
$(SRCDIR
)/bin
/findunusedcode
$(SRCDIR
) $(MAKE
)
324 $(SRCDIR
)/bin
/find-unusedheaders.pl
328 @
$(SRCDIR
)/bin
/module-deps.pl
$(MAKE
) $(SRCDIR
)/Makefile.gbuild
331 @
$(SRCDIR
)/bin
/module-deps.pl
$(MAKE
) $(SRCDIR
)/Makefile.gbuild | dot
-Tpng
-o lo.png
334 @
$(SRCDIR
)/bin
/module-deps.pl
-t
$(MAKE
) $(SRCDIR
)/Makefile.gbuild
336 define gb_Top_GbuildToIdeIntegration
337 $(1)-ide-integration
:
338 cd
$(SRCDIR
) && (LC_MESSAGES
=C
$(MAKE
) cmd
="$(MAKE) -npf Makefile.gbuild all" cmd || true
) |
$(SRCDIR
)/bin
/gbuild-to-ide
--ide
$(1)
346 $(eval
$(call gb_Top_GbuildToIdeIntegration
,$(ide
))))
348 endif # MAKE_RESTARTS
350 # vim: set noet sw=4 ts=4: