Impress: Implement getPartName.
[LibreOffice.git] / Makefile.in
blob915e11c977e2d9385756def57cad721bfa9220cb
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
12 MAKECMDGOALS?=all
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 := @SHELL_BASH@
19 SRCDIR := @SRC_ROOT@
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
25 # autogen.sh:
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
34 @touch $@
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
48 else # MAKE_RESTARTS
50 all: build
52 gb_Side ?= host
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),)
61 # Partial Build
63 define gb_Top_GbuildModuleRules
64 .PHONY: $(1) $(1).all $(1).build $(1).check $(1).clean $(1).showdeliverables $(1).subsequentcheck $(1).slowcheck
66 $(1): bootstrap fetch
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))
75 endef
77 define gb_Top_GbuildModulesRules
78 $(foreach m,$(1),$(call gb_Top_GbuildModuleRules,$(notdir $(m)),$(m)))
79 endef
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 \
91 AllLangPackage \
92 AllLangResTarget \
93 AutoInstall \
94 CliLibrary \
95 CliNativeLibrary \
96 CliUnoApi \
97 Configuration \
98 CppunitTest \
99 CustomTarget \
100 Dictionary \
101 Executable \
102 Extension \
103 ExtensionPackage \
104 ExtensionPackageSet \
105 ExternalPackage \
106 ExternalProject \
107 GeneratedPackage \
108 InstallModule \
109 InstallScript \
110 InternalUnoApi \
111 Jar \
112 JunitTest \
113 Library \
114 Module \
115 Package \
116 PackageSet \
117 Pagein \
118 Postprocess \
119 Pyuno \
120 PythonTest \
121 Rdb \
122 StaticLibrary \
123 UIConfig \
124 UnoApi \
125 UnpackedTarball \
126 WinResTarget \
127 Zip \
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 $@
134 # Clean
136 clean: clean-host clean-build
138 clean-host:
139 rm -fr $(TESTINSTALLDIR)
140 rm -fr $(INSTDIR)
141 rm -fr $(WORKDIR)
142 rm -fr solver
143 rm -fr install
145 clean-build:
146 ifneq ($(CROSS_COMPILING),)
147 rm -fr $(INSTDIR_FOR_BUILD)
148 rm -fr $(WORKDIR_FOR_BUILD)
149 endif
151 include $(SRCDIR)/compilerplugins/Makefile.mk
154 # Distclean
156 distclean : clean compilerplugins-clean
157 rm -fr \
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 {} \;
176 # custom command
178 cmd:
179 echo "custom cmd" && ( $(cmd) )
182 # Fetch
184 ifneq ($(DO_FETCH_TARBALLS),)
185 include $(SRCDIR)/Makefile.fetch
186 fetch: download
187 fetch: get-submodules
189 ifneq (,$(wildcard $(SRCDIR)/.git))
190 get-submodules:
191 ifneq ($(foreach i,$(GIT_NEEDED_SUBMODULES),$(i)/.git),$(wildcard $(foreach i,$(GIT_NEEDED_SUBMODULES),$(i)/.git)))
192 cd $(SRCDIR) && ./g -f clone
193 endif
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)
206 endif
208 endif
210 else
211 fetch:
212 @echo "Automatic fetching of external tarballs is disabled."
214 endif
217 # Bootstap
219 bootstrap: compilerplugins
222 # Build
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
230 endif
231 $(MAKE) $(PARALLELISM_OPTION) $(GMAKE_OPTIONS) -f $(SRCDIR)/Makefile.gbuild $(build_goal)
232 ifeq ($(OS),IOS)
233 $(MAKE) $(PARALLELISM_OPTION) $(GMAKE_OPTIONS) ios
234 endif
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
243 # Install
246 define gb_Top_DoInstall
247 echo "$(1) in $(INSTALLDIR) ..." && \
248 ooinstall $(2) "$(INSTALLDIR)"
250 endef
252 ifneq ($(OS),MACOSX)
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"
259 endef
260 else
261 define gb_Top_InstallFinished
262 echo && echo "$(1) finished, you can now run: " && \
263 echo "open $(2)/$(PRODUCTNAME).app" && \
264 echo "" && \
265 echo "To debug: gdb $(2)/$(PRODUCTNAME).app/Contents/MacOS/soffice"
267 endef
268 endif
270 ifneq ($(OS),MACOSX)
271 install:
272 @$(call gb_Top_DoInstall,Installing,)
273 @$(call gb_Top_InstallFinished,Installation,$(INSTALLDIR))
275 install-strip:
276 @$(call gb_Top_DoInstall,Installing and stripping binaries,--strip)
277 @$(call gb_Top_InstallFinished,Installation,$(INSTALLDIR))
278 endif # !MACOSX
280 dev-install:
281 @echo && echo "dev-install is obsolete! Just build with \"make check\" and run"
282 ifeq ($(OS),MACOSX)
283 @echo " open instdir/$(PRODUCTNAME).app"
284 @echo
285 @echo "To debug: gdb instdir/$(PRODUCTNAME).app/Contents/MacOS/soffice"
286 else
287 @echo " instdir/program/soffice"
288 endif
289 @echo
290 @echo "(only if you have good reason to test an actual installation: make test-install)"
291 @echo
292 @false
294 test-install: build
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)
299 else
300 @ooinstall $(TESTINSTALLDIR)
301 ifneq ($(MACOSX_CODESIGNING_IDENTITY),)
302 @macosx-codesign-app-bundle $(TESTINSTALLDIR)/LibreOffice$(if $(ENABLE_RELASE_BUILD),,Dev).app
303 endif
304 endif
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
311 else
312 @echo You did not provide an installer signing identity with --enable-macosx-package-signing
313 @exit 1
314 endif
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
322 install-package-%:
323 $(MAKE) $(GMAKE_OPTIONS) -f $(SRCDIR)/Makefile.gbuild $@
326 @create-ids
328 tags:
329 @create-tags
331 docs:
332 @mkdocs.sh $(SRCDIR)/docs $(SRCDIR)/solenv/inc/doxygen.cfg
334 findunusedcode:
335 @$(SRCDIR)/bin/findunusedcode $(SRCDIR) $(MAKE)
337 findunusedheaders:
338 $(SRCDIR)/bin/find-unusedheaders.pl
341 dump-deps:
342 @$(SRCDIR)/bin/module-deps.pl $(MAKE) $(SRCDIR)/Makefile.gbuild
344 dump-deps-png:
345 @$(SRCDIR)/bin/module-deps.pl $(MAKE) $(SRCDIR)/Makefile.gbuild | dot -Tpng -o lo.png
347 dump-deps-sort:
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)
354 endef
356 $(foreach ide,\
357 kdevelop \
358 vs2012 \
359 xcode, \
360 $(eval $(call gb_Top_GbuildToIdeIntegration,$(ide))))
362 endif # MAKE_RESTARTS
364 # vim: set noet sw=4 ts=4: