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
14 SHELL
=/usr
/bin
/env bash
16 BUILDDIR
:= @BUILDDIR@
17 GIT_BUILD
:= $(if
$(wildcard $(SRCDIR
)/.git
),T
)
19 # Run autogen.sh if needed and force make to restart itself.
20 # ... but there are several cases where we do not want to run
22 # 1. if we are building from tarballs, not git checkout (I do not
23 # think packagers would ever want that. I certainly do not.)
24 # 2. if we are making help, clean or distclean, because they do not
25 # need updated configuration
26 ifeq (,$(MAKE_RESTARTS
)$(if
$(GIT_BUILD
),,T
)$(if
$(filter-out help
clean distclean,$(MAKECMDGOALS
)),,T
))
28 .PHONY
: force-restart
29 Makefile
: $(BUILDDIR
)/config_host.mk force-restart
32 # run configure in an environment not polluted by config_host.mk
33 $(BUILDDIR
)/config_host.mk
: $(wildcard \
34 $(SRCDIR
)/config_host.mk.in \
35 $(SRCDIR
)/Makefile.in \
36 $(SRCDIR
)/instsetoo_native
/util
/openoffice.lst.in \
37 $(SRCDIR
)/configure.ac \
38 $(SRCDIR
)/config_host
/*.h.in \
39 $(BUILDDIR
)/autogen.input \
40 $(BUILDDIR
)/autogen.lastrun \
50 include $(BUILDDIR
)/config_
$(gb_Side
).mk
52 export GMAKE_OPTIONS?
=-r
$(if
$(verbose
)$(VERBOSE
),,s
)$(value
$(MAKEFLAGS
))
57 define gb_Top_GbuildModuleRules
58 .PHONY
: $(1) $(1).
all $(1).build
$(1).
check $(1).
clean $(1).showdeliverables
$(1).subsequentcheck
61 cd
$(SRCDIR
)/$(2) && $(GNUMAKE
) -j
$(PARALLELISM
) $(GMAKE_OPTIONS
)
63 $(1).build
$(1).
check $(1).
clean $(1).showdeliverables
$(1).subsequentcheck
:
64 cd
$(SRCDIR
)/$(2) && $(GNUMAKE
) -j
$(PARALLELISM
) $(GMAKE_OPTIONS
) $$(patsubst $(1).
%,%,$$@
)
66 $(1).
all: bootstrap fetch
67 $(GNUMAKE
) -j
$(PARALLELISM
) $(GMAKE_OPTIONS
) -f
$(SRCDIR
)/Makefile.gbuild
$(WORKDIR
)/Module
/$(1) $(if
$(CROSS_COMPILING
),,$(WORKDIR
)/Module
/check/$(1) $(WORKDIR
)/Module
/slowcheck
/$(1))
71 define gb_Top_GbuildModulesRules
72 $(foreach m
,$(1),$(call gb_Top_GbuildModuleRules
,$(notdir $(m
)),$(m
)))
75 gbuild_modules
:= $(patsubst $(SRCDIR
)/%/,%,$(dir $(wildcard $(SRCDIR
)/*/Module_
*.mk
$(SRCDIR
)/external
/*/Module_
*.mk
)))
77 $(eval
$(call gb_Top_GbuildModulesRules
,$(gbuild_modules
)))
79 gbuild_TARGETS
:= AllLangHelp \
118 # build a generic gbuild target
119 $(foreach target
,$(gbuild_TARGETS
),$(target
)_
% $(foreach module
,$(gbuild_modules
),$(target
)_
$(module
)/%)):
120 $(GNUMAKE
) -j
$(PARALLELISM
) $(GMAKE_OPTIONS
) -f
$(SRCDIR
)/Makefile.gbuild
$@
125 clean: clean-host clean-build
128 rm -fr
$(TESTINSTALLDIR
)
135 ifeq ($(CROSS_COMPILING
),YES
)
136 rm -fr
$(INSTDIR_FOR_BUILD
)
137 rm -fr
$(WORKDIR_FOR_BUILD
)
140 include $(SRCDIR
)/compilerplugins
/Makefile.mk
145 distclean : clean compilerplugins-clean
147 $(BUILDDIR
)/Makefile \
148 $(BUILDDIR
)/aclocal.m4 \
149 $(BUILDDIR
)/autom4te.cache \
150 $(BUILDDIR
)/config.log \
151 $(BUILDDIR
)/config.status \
152 $(BUILDDIR
)/config_build.mk \
153 $(BUILDDIR
)/config_host.mk \
154 $(BUILDDIR
)/config_host.mk.stamp \
155 $(BUILDDIR
)/config_host
/*.h \
156 $(BUILDDIR
)/configure \
157 $(BUILDDIR
)/instsetoo_native
/util
/openoffice.lst \
158 $(BUILDDIR
)/ios
/lo.xcconfig \
159 $(BUILDDIR
)/lo.xcent \
160 $(BUILDDIR
)/sysui
/desktop
/macosx
/Info.plist
161 find
$(SRCDIR
)/solenv
/gdb
-name
"*.pyc" -exec
rm {} \
;
167 echo
"custom cmd" && ( $(cmd
) )
172 ifneq ($(DO_FETCH_TARBALLS
),NO
)
173 include $(SRCDIR
)/Makefile.fetch
175 fetch
: get-submodules
177 ifneq (,$(wildcard $(SRCDIR
)/.git
))
179 ifneq ($(foreach i
,$(GIT_NEEDED_SUBMODULES
),$(i
)/.git
),$(wildcard $(foreach i
,$(GIT_NEEDED_SUBMODULES
),$(i
)/.git
)))
180 cd
$(SRCDIR
) && .
/g
-f clone
182 @cd
$(SRCDIR
) && .
/g
-z
# make sure the git hooks are in place enen if no submodules are needed
184 else # these sources are from a tarball, so get the other source tarballs
185 gb_LO_VER
:= $(shell .
$(SRCDIR
)/sources.ver
&& echo
$$lo_sources_ver)
186 $(if
$(gb_LO_VER
),,$(error Error while retrieving
$$lo_sources_ver from
$(SRCDIR
)/sources.ver
))
188 get-submodules
: | download
189 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
))))
190 $(foreach i
,$(subst helpcontent2
,help
,$(GIT_NEEDED_SUBMODULES
)),\
191 $(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
))
192 $(SRCDIR
)/bin
/unpack-sources
$(SRCDIR
) $(foreach i
,$(subst helpcontent2
,help
,$(GIT_NEEDED_SUBMODULES
)),\
193 $(TARFILE_LOCATION
)/libreoffice-
$(i
)-$(gb_LO_VER
).
tar.xz
)
200 @echo
"Automatic fetching of external tarballs is disabled."
207 bootstrap
: compilerplugins
212 # Note: this will pipe through all gbuild targets to ... gbuild
213 # with some translations like "build"->"all" for historic reasons
215 build
: bootstrap fetch
$(if
$(CROSS_COMPILING
),cross-toolset
)
216 ifneq ($(filter-out WNT MACOSX IOS ANDROID
,$(OS
)),)
217 mkdir
-p
$(INSTDIR
) && install-gdb-printers
-a
$(INSTDIR
) -c
219 $(GNUMAKE
) -j
$(PARALLELISM
) $(GMAKE_OPTIONS
) -f
$(SRCDIR
)/Makefile.gbuild \
220 $(if
$(filter build
check,$(MAKECMDGOALS
)),all) \
221 $(if
$(filter build-nocheck
,$(MAKECMDGOALS
)),build
) \
222 $(if
$(filter check,$(MAKECMDGOALS
)),subsequentcheck
) \
223 $(filter all build-l10n-only build-non-l10n-only debugrun help slowcheck translations unitcheck subsequentcheck
check,$(MAKECMDGOALS
))
225 $(GNUMAKE
) -j
$(PARALLELISM
) $(GMAKE_OPTIONS
) ios
228 build-nocheck
check debugrun help slowcheck translations unitcheck subsequentcheck
: build
230 cross-toolset
: bootstrap fetch
231 $(GNUMAKE
) gb_Side
=build
-j
$(PARALLELISM
) $(GMAKE_OPTIONS
) -f
$(SRCDIR
)/Makefile.gbuild build-tools
238 define gb_Top_DoInstall
239 echo
"$(1) in $(INSTALLDIR) ..." && \
240 ooinstall
$(2) "$(INSTALLDIR)"
245 define gb_Top_InstallFinished
246 echo
&& echo
"If you want to edit the .ui files with glade first execute:" && \
247 echo
&& echo
"export GLADE_CATALOG_SEARCH_PATH=$(2)/share/glade" && \
248 echo
&& echo
"$(1) finished, you can now execute:" && \
249 echo
"$(2)/program/soffice"
253 define gb_Top_InstallFinished
254 echo
&& echo
"$(1) finished, you can now run: " && \
255 echo
"open $(2)/$(PRODUCTNAME).app" && \
257 echo
"To debug: gdb $(2)/$(PRODUCTNAME).app/Contents/MacOS/soffice"
264 @
$(call gb_Top_DoInstall
,Installing
,)
265 @
$(call gb_Top_InstallFinished
,Installation
,$(INSTALLDIR
))
268 @
$(call gb_Top_DoInstall
,Installing and stripping binaries
,--strip)
269 @
$(call gb_Top_InstallFinished
,Installation
,$(INSTALLDIR
))
273 @echo
&& echo
"dev-install is obsolete! Just build with \"make check\" and run"
275 @echo
" open instdir/$(PRODUCTNAME).app"
277 @echo
"To debug: gdb instdir/$(PRODUCTNAME).app/Contents/MacOS/soffice"
279 @echo
" instdir/program/soffice"
282 @echo
"(only if you have good reason to test an actual installation: make test-install)"
287 @
rm -rf
$(TESTINSTALLDIR
)
288 @mkdir
-p
$(TESTINSTALLDIR
)
289 ifeq ($(OS_FOR_BUILD
),WNT
)
290 cd
$(SRCDIR
)/instsetoo_native
&& $(GNUMAKE
) LIBO_TEST_INSTALL
=TRUE
$(GMAKE_OPTIONS
)
292 @ooinstall
$(TESTINSTALLDIR
)
293 ifneq ($(MACOSX_CODESIGNING_IDENTITY
),)
294 @macosx-codesign-app-bundle
$(TESTINSTALLDIR
)/LibreOffice.app
297 @
$(call gb_Top_InstallFinished
,Test Installation
,$(TESTINSTALLDIR
))
299 distro-pack-install
: install
300 $(SRCDIR
)/bin
/distro-install-clean-up
301 $(SRCDIR
)/bin
/distro-install-desktop-integration
302 $(SRCDIR
)/bin
/distro-install-sdk
303 $(SRCDIR
)/bin
/distro-install-file-lists
312 @mkdocs.sh
$(SRCDIR
)/docs
$(SRCDIR
)/solenv
/inc
/doxygen.cfg
315 @
$(SRCDIR
)/bin
/findunusedcode
$(SRCDIR
) $(GNUMAKE
)
318 $(SRCDIR
)/bin
/find-unusedheaders.pl
322 @
$(SRCDIR
)/bin
/module-deps.pl
$(GNUMAKE
) $(SRCDIR
)/Makefile.gbuild
325 @
$(SRCDIR
)/bin
/module-deps.pl
$(GNUMAKE
) $(SRCDIR
)/Makefile.gbuild | dot
-Tpng
-o lo.png
327 define gb_Top_GbuildToIdeIntegration
328 $(1)-ide-integration
:
329 cd
$(SRCDIR
) && (make cmd
-npf Makefile.gbuild
all || true
) |
$(SRCDIR
)/bin
/gbuild-to-ide
--ide
$(1)
335 $(eval
$(call gb_Top_GbuildToIdeIntegration
,$(ide
))))
337 endif # MAKE_RESTARTS
339 # vim: set noet sw=4 ts=4: