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 build
check clean clean-build clean-host dev-install
distclean distro-pack-install docs download fetch findunusedcode get-submodules id
install install-strip install-tb subsequentcheck
tags
12 ifeq ($(MAKECMDGOALS
),)
16 SHELL
=/usr
/bin
/env bash
18 BUILDDIR
:= @BUILDDIR@
19 GIT_BUILD
:= $(if
$(wildcard $(SRCDIR
)/.git
),T
)
21 # Run autogen.sh if needed and force make to restart itself.
22 # ... but there are several cases where we do not want to run
24 # 1. if we are building from tarballs, not git checkout (I do not
25 # think packagers would ever want that. I certainly do not.)
26 # 2. if we are making help, clean or distclean, because they do not
27 # need updated configuration
28 ifeq (,$(MAKE_RESTARTS
)$(if
$(GIT_BUILD
),,T
)$(if
$(filter-out help
clean distclean,$(MAKECMDGOALS
)),,T
))
30 .PHONY
: force-restart
31 Makefile
: $(BUILDDIR
)/config_host.mk force-restart
34 # run configure in an environment not polluted by config_host.mk
35 $(BUILDDIR
)/config_host.mk
: \
36 $(SRCDIR
)/config_host.mk.in \
37 $(SRCDIR
)/Makefile.in \
38 $(SRCDIR
)/instsetoo_native
/util
/openoffice.lst.in \
39 $(SRCDIR
)/configure.ac \
40 $(if
$(wildcard $(BUILDDIR
)/autogen.input
),$(BUILDDIR
)/autogen.input
,$(if
$(wildcard $(BUILDDIR
)/autogen.lastrun
),$(BUILDDIR
)/autogen.lastrun
))
43 # dummy rule in case any of the above prerequisites are removed, so
44 # that a stale Makefile still triggers autogen.sh, or in case
45 # autogen.input does not exist, or autogen.lastrun does not yet exist
46 $(SRCDIR
)/config_host.mk.in \
47 $(SRCDIR
)/Makefile.in \
48 $(SRCDIR
)/instsetoo_native
/util
/openoffice.lst.in \
49 $(SRCDIR
)/configure.ac \
50 $(BUILDDIR
)/autogen.input \
51 $(BUILDDIR
)/autogen.lastrun
:
62 include $(BUILDDIR
)/config_
$(gb_Side
).mk
64 ifeq ($(GMAKE_OPTIONS
),)
65 ifeq ($(verbose
)$(VERBOSE
),)
66 export GMAKE_OPTIONS
:=-rs
$(MAKEFLAGS
)
68 export GMAKE_OPTIONS
:=-r
$(MAKEFLAGS
)
75 define gbuild_module_rules
76 .PHONY
: $(1) $(1).
all $(1).build
$(1).
check $(1).
clean $(1).showdeliverables
$(1).subsequentcheck
79 cd
$(SRCDIR
)/$(1) && $(GNUMAKE
) -j
$(PARALLELISM
) $(GMAKE_OPTIONS
)
81 $(1).build
$(1).
check $(1).
clean $(1).showdeliverables
:
82 cd
$(SRCDIR
)/$(1) && $(GNUMAKE
) -j
$(PARALLELISM
) $(GMAKE_OPTIONS
) $$(patsubst $(1).
%,%,$$@
)
85 cd
$(SRCDIR
)/$(1) && $(GNUMAKE
) -j
$(CHECK_PARALLELISM
) $(GMAKE_OPTIONS
) subsequentcheck
87 $(1).
all: bootstrap fetch
88 $(GNUMAKE
) -j
$(PARALLELISM
) $(GMAKE_OPTIONS
) -f
$(SRCDIR
)/Makefile.gbuild
$(WORKDIR
)/Module
/$(1) $(if
$(CROSS_COMPILING
),,$(WORKDIR
)/Module
/check/$(1) $(WORKDIR
)/Module
/slowcheck
/$(1))
92 define gbuild_modules_rules
93 $(foreach m
,$(1),$(call gbuild_module_rules
,$(m
)))
96 gbuild_modules
:= $(filter-out Module
%,$(subst /, ,$(subst $(SRCDIR
)/,,$(wildcard $(SRCDIR
)/*/Module_
*.mk
))))
98 $(eval
$(call gbuild_modules_rules
,$(gbuild_modules
)))
100 gbuild_TARGETS
:= AllLangHelp \
136 # build a generic gbuild target
137 $(foreach target
,$(gbuild_TARGETS
),$(target
)_
% $(foreach module
,$(gbuild_modules
),$(target
)_
$(module
)/%)):
138 $(GNUMAKE
) -j
$(PARALLELISM
) $(GMAKE_OPTIONS
) -f
$(SRCDIR
)/Makefile.gbuild
$@
143 clean: clean-host clean-build
146 rm -fr
$(DEVINSTALLDIR
)
153 ifeq ($(CROSS_COMPILING
),YES
)
154 rm -fr
$(OUTDIR_FOR_BUILD
)
155 rm -fr
$(WORKDIR_FOR_BUILD
)
158 include $(SRCDIR
)/compilerplugins
/Makefile.mk
163 distclean : clean compilerplugins-clean
165 $(BUILDDIR
)/Makefile \
166 $(BUILDDIR
)/aclocal.m4 \
167 $(BUILDDIR
)/autom4te.cache \
168 $(BUILDDIR
)/config.log \
169 $(BUILDDIR
)/config.status \
170 $(BUILDDIR
)/config_build.mk \
171 $(BUILDDIR
)/config_host.mk \
172 $(BUILDDIR
)/config_host.mk.stamp \
173 $(BUILDDIR
)/config_host
/*.h \
174 $(BUILDDIR
)/config_host
/*.mk \
175 $(BUILDDIR
)/configure \
176 $(BUILDDIR
)/instsetoo_native
/util
/openoffice.lst \
178 find
$(SOLARENV
)/gdb
-name
"*.pyc" -exec
rm {} \
;
184 echo
"custom cmd" && ( $(cmd
) )
189 ifneq ($(DO_FETCH_TARBALLS
),NO
)
190 include $(SRCDIR
)/Makefile.fetch
192 fetch
: get-submodules
194 ifneq (,$(wildcard $(SRCDIR
)/.git
))
196 ifneq ($(foreach i
,$(GIT_NEEDED_SUBMODULES
),$(i
)/.git
),$(wildcard $(foreach i
,$(GIT_NEEDED_SUBMODULES
),$(i
)/.git
)))
197 cd
$(SRCDIR
) && .
/g
-f clone
199 @cd
$(SRCDIR
) && .
/g
-z
# make sure the git hooks are in place enen if no submodules are needed
201 else # these sources are from a tarball, so get the other source tarballs
202 gb_LO_VER
:= $(shell .
$(SRCDIR
)/sources.ver
&& echo
$$lo_sources_ver)
203 $(if
$(gb_LO_VER
),,$(error Error while retrieving
$$lo_sources_ver from
$(SRCDIR
)/sources.ver
))
205 get-submodules
: | download
206 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
))))
207 $(foreach i
,$(subst helpcontent2
,help
,$(GIT_NEEDED_SUBMODULES
)),\
208 $(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
))
209 $(SRCDIR
)/bin
/unpack-sources
$(SRCDIR
) $(foreach i
,$(subst helpcontent2
,help
,$(GIT_NEEDED_SUBMODULES
)),\
210 $(TARFILE_LOCATION
)/libreoffice-
$(i
)-$(gb_LO_VER
).
tar.xz
)
217 @echo
"Automatic fetching of external tarballs is disabled."
224 bootstrap
: compilerplugins
229 build
: bootstrap fetch
$(if
$(filter $(INPATH
),$(INPATH_FOR_BUILD
)),,cross-toolset
)
230 $(GNUMAKE
) -j
$(PARALLELISM
) $(GMAKE_OPTIONS
) -f
$(SRCDIR
)/Makefile.gbuild
232 $(GNUMAKE
) -j
$(PARALLELISM
) $(GMAKE_OPTIONS
) ios
235 build-nocheck
: bootstrap fetch
$(if
$(filter $(INPATH
),$(INPATH_FOR_BUILD
)),,cross-toolset
)
236 $(GNUMAKE
) -j
$(PARALLELISM
) $(GMAKE_OPTIONS
) -f
$(SRCDIR
)/Makefile.gbuild build
238 cross-toolset
: bootstrap fetch
239 $(GNUMAKE
) gb_Side
=build
-j
$(PARALLELISM
) $(GMAKE_OPTIONS
) -f
$(SRCDIR
)/Makefile.gbuild build-tools
246 echo
"Installing in $(INSTALLDIR)..." && \
247 ooinstall
"$(INSTALLDIR)" && \
249 echo
"Installation finished, you can now execute:" && \
250 echo
"$(INSTALLDIR)/program/soffice"
253 echo
"Installing and stripping binaries in $(INSTALLDIR)..." && \
254 ooinstall
--strip "$(INSTALLDIR)" && \
256 echo
"Installation finished, you can now execute:" && \
257 echo
"$(INSTALLDIR)/program/soffice"
259 ifeq ($(ENABLE_MACOSX_SANDBOX
),YES
)
260 entitlements
:=--entitlements
$(SRC_ROOT
)/lo.xcent
264 @
rm -rf
$(DEVINSTALLDIR
)
265 @mkdir
$(DEVINSTALLDIR
)
266 ifeq ($(OS_FOR_BUILD
),WNT
)
267 cd
$(SRCDIR
)/instsetoo_native
&& $(GNUMAKE
) LIBO_DEV_INSTALL
=TRUE
$(GMAKE_OPTIONS
)
269 ifeq ($(DISABLE_LINKOO
),TRUE
)
270 @ooinstall
$(DEVINSTALLDIR
)/opt
271 ifneq ($(MACOSX_CODESIGNING_IDENTITY
),)
275 # Executables get signed right after linking, see
276 # solenv/gbuild/platform/macosx.mk. But many of our dylibs are built
277 # by ad-hoc or 3rd-party mechanisms, so we can't easily sign them
278 # right after linking. So do it here.
280 # The dylibs in the Python framework are called *.so. Go figure
282 find
$(DEVINSTALLDIR
)/opt
/LibreOffice.app \
( -name
'*.dylib' -or
-name
'*.dylib.*' -or
-name
'*.so' \
) ! -type l | \
283 while read dylib
; do \
284 id
=`basename "$$dylib"`; \
289 id
=`echo $$id | sed -e 's/dylib.*/dylib/'`; \
292 codesign
--verbose
--identifier
=$(MACOSX_BUNDLE_IDENTIFIER
).
$$id --sign
$(MACOSX_CODESIGNING_IDENTITY
) "$$dylib"; \
297 # Yeah, we don't bundle any other framework than our Python one, and
298 # it has just one version, so this generic search is mostly for
301 for framework in
`find $(DEVINSTALLDIR)/opt/LibreOffice.app -name '*.framework' -type d`; do \
302 for version in
$$framework/Versions
/*; do \
303 test -d
$$version && codesign
--force --verbose
--prefix=$(MACOSX_BUNDLE_IDENTIFIER
).
--sign
$(MACOSX_CODESIGNING_IDENTITY
) $$version; \
307 # Sign the app bundle as a whole (will sign the soffice binary)
309 # The soffice binary will have been signed after linking but it needs
310 # to be re-signed as it has been renamed, or modified, or something
313 # At this stage we also attach the entitlements in the sandboxing case
315 codesign
--force --verbose
--sign
$(MACOSX_CODESIGNING_IDENTITY
) $(entitlements
) $(DEVINSTALLDIR
)/opt
/LibreOffice.app
318 @install-gdb-printers
-L
320 @ooinstall
-l
$(DEVINSTALLDIR
)/opt
323 @
rm -f
$(BUILDDIR
)/install && ln
-s
$(DEVINSTALLDIR
)/opt
/ $(BUILDDIR
)/install
325 @echo
"If you want to edit the .ui files with glade first execute:"
327 @echo
"export GLADE_CATALOG_SEARCH_PATH=$(SRCDIR)/install/share/glade"
330 @echo
"Developer installation finished, you can now execute:"
332 @echo
"$(BUILDDIR)/install/program/soffice"
333 else ifeq ($(OS
),MACOSX
)
335 @echo
"Developer installation finished, you can now run:"
337 @echo
" open $(BUILDDIR)/install/LibreOffice.app"
339 @echo
"To debug: gdb install/LibreOffice.app/Contents/MacOS/soffice"
342 dev-install-nocheck
: build-nocheck
343 $(MAKE
) dev-install
-o build
345 # FIXME: shouldn't linkoo be BUILDDIR vs SRCDIR aware ?
347 ifeq ($(DISABLE_LINKOO
),TRUE
)
348 @linkoo
--copy
$(DEVINSTALLDIR
)/opt
$(SRCDIR
)
350 @linkoo
$(DEVINSTALLDIR
)/opt
$(SRCDIR
)
354 @
rm -rf
$(DEVINSTALLDIR
)
355 @mkdir
$(DEVINSTALLDIR
)
356 ifeq ($(OS_FOR_BUILD
),WNT
)
357 cd
$(SRCDIR
)/instsetoo_native
&& $(GNUMAKE
) LIBO_DEV_INSTALL
=TRUE
$(GMAKE_OPTIONS
)
359 @ooinstall
$(DEVINSTALLDIR
)/opt
360 @install-gdb-printers
362 @
rm -f
$(BUILDDIR
)/install && ln
-s
$(DEVINSTALLDIR
)/opt
/ $(BUILDDIR
)/install
364 distro-pack-install
: install
365 $(SRCDIR
)/bin
/distro-install-clean-up
366 $(SRCDIR
)/bin
/distro-install-desktop-integration
367 $(SRCDIR
)/bin
/distro-install-sdk
368 $(SRCDIR
)/bin
/distro-install-file-lists
377 @mkdocs.sh
$(SRCDIR
)/docs
$(SOLARENV
)/inc
/doxygen.cfg
380 @which callcatcher
> /dev
/null
2>&1 || \
381 (echo
"callcatcher not installed" && false
)
382 @sed
-e s
,$$INPATH,callcatcher
,g config_host.mk | sed
-e s
,"export OOO_JUNIT_JAR=.*","export OOO_JUNIT_JAR=",g
> $(SRCDIR
)/config_host_callcatcher.mk
383 @echo
unexport ARCH_FLAGS
>> $(SRCDIR
)/config_host_callcatcher.mk
384 @echo
unexport CFLAGS
>> $(SRCDIR
)/config_host_callcatcher.mk
385 @echo
unexport CXXFLAGS
>> $(SRCDIR
)/config_host_callcatcher.mk
386 @mkdir
-p
$(SRCDIR
)/solenv
/callcatcher
/bin
&& \
387 $(GNUMAKE
) -f
$(SOLARENV
)/bin
/callcatcher.Makefile findunusedcode
388 @grep
::.
*\
( unusedcode.
all \
393 | grep
-v ^CLuceneError
:: \
395 | grep
-v ^CppUnit
:: \
397 | grep
-v ^graphite2
:: \
398 | grep
-v ^jvmaccess
:: \
399 | grep
-v ^libcdr
:: \
400 | grep
-v ^libcmis
:: \
401 | grep
-v ^libmspub
:: \
402 | grep
-v ^libvisio
:: \
403 | grep
-v ^libwpg
:: \
404 | grep
-v ^libwps_tools_win
:: \
405 | grep
-v ^lucene
:: \
406 | grep
-v ^Matrix3d
:: \
407 | grep
-v ^RelatedMultipart
:: \
408 | grep
-v ^salhelper
:: \
409 | grep
-v ^VSDInternalStream
:: \
417 | grep
-v ^WSObject \
420 check: dev-install subsequentcheck
423 @
$(SRCDIR
)/bin
/module-deps.pl
$(GNUMAKE
) $(SRCDIR
)/Makefile.gbuild
426 @
$(SRCDIR
)/bin
/module-deps.pl
$(GNUMAKE
) $(SRCDIR
)/Makefile.gbuild | dot
-Tpng
-o lo.png
428 subsequentcheck
:|
$(if
$(filter-out subsequentcheck
,$(MAKECMDGOALS
)),dev-install
)
429 $(GNUMAKE
) -j
$(CHECK_PARALLELISM
) $(GMAKE_OPTIONS
) -f
$(SRCDIR
)/Makefile.gbuild
$@
431 .PHONY
: debugrun help slowcheck translations unitcheck
432 debugrun help slowcheck translations unitcheck
:
433 $(GNUMAKE
) -j
$(PARALLELISM
) $(GMAKE_OPTIONS
) -f
$(SRCDIR
)/Makefile.gbuild
$@
435 endif # MAKE_RESTARTS
437 # vim: set noet sw=4 ts=4: