Version 5.0.4.1, tag libreoffice-5.0.4.1
[LibreOffice.git] / Makefile.in
blob61b16ab541cf650ea67c05a07ebf8ab99cc36b8c
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 gb_Top_MODULE_CHECK_TARGETS := slowcheck unitcheck subsequentcheck perfcheck
12 .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 etags fetch findunusedcode get-submodules id install install-strip tags debugrun help showmodules translations packageinfo internal.clean $(gb_Top_MODULE_CHECK_TARGETS)
14 MAKECMDGOALS?=all
15 build_goal:=$(if $(filter build check,$(MAKECMDGOALS)),all)\
16 $(if $(filter build-nocheck,$(MAKECMDGOALS)),build)\
17 $(if $(filter check,$(MAKECMDGOALS)),subsequentcheck)\
18 $(filter all build-l10n-only build-non-l10n-only debugrun help showmodules translations $(gb_Top_MODULE_CHECK_TARGETS) check packageinfo,$(MAKECMDGOALS))
20 SHELL := @SHELL_BASH@
21 SRCDIR := @SRC_ROOT@
22 BUILDDIR := @BUILDDIR@
23 GIT_BUILD := $(if $(wildcard $(SRCDIR)/.git),T)
25 # Run autogen.sh if needed and force make to restart itself.
26 # ... but there are several cases where we do not want to run
27 # autogen.sh:
28 # 1. if we are building from tarballs, not git checkout (I do not
29 # think packagers would ever want that. I certainly do not.)
30 # 2. if we are making help, clean or distclean, because they do not
31 # need updated configuration
32 ifeq (,$(MAKE_RESTARTS)$(if $(GIT_BUILD),,T)$(if $(filter-out help showmodules clean distclean,$(MAKECMDGOALS)),,T))
34 .PHONY : force-restart
35 Makefile: $(BUILDDIR)/config_host.mk $(BUILDDIR)/config_host_lang.mk force-restart
36 @touch $@
38 # run configure in an environment not polluted by config_host.mk
39 $(BUILDDIR)/config_host.mk : $(wildcard \
40 $(SRCDIR)/config_host.mk.in \
41 $(SRCDIR)/config_host_lang.mk.in \
42 $(SRCDIR)/Makefile.in \
43 $(SRCDIR)/instsetoo_native/util/openoffice.lst.in \
44 $(SRCDIR)/configure.ac \
45 $(SRCDIR)/config_host/*.h.in \
46 $(SRCDIR)/android/experimental/LOAndroid3/AndroidManifest.xml.in \
47 $(BUILDDIR)/autogen.input \
48 $(BUILDDIR)/autogen.lastrun \
49 $(BUILDDIR)/autogen.sh \
51 sh -c $(SRCDIR)/autogen.sh
53 else # MAKE_RESTARTS
55 all: build
57 gb_Side ?= host
59 include $(BUILDDIR)/config_$(gb_Side).mk
61 export GMAKE_OPTIONS?=-r$(if $(verbose)$(VERBOSE),,s)$(value $(MAKEFLAGS))
63 PARALLELISM_OPTION := $(if $(filter-out 0,$(PARALLELISM)),-j $(PARALLELISM),)
65 IWYU_OPTION := $(if $(IWYU_PATH),-k CC=$(IWYU_PATH) CXX=$(IWYU_PATH),)
67 # don't want to have a dependency to iwyudummy.generate because it's
68 # useful to manually edit the generated StaticLibrary_iwyudummy.mk
69 iwyudummy: bootstrap fetch
70 $(if $(wildcard $(BUILDDIR)/iwyudummy),,$(error first call "make iwyudummy.generate"))
71 cd $(BUILDDIR)/iwyudummy && $(MAKE) $(IWYU_OPTION) $(GMAKE_OPTIONS)
73 iwyudummy.generate:
74 $(SRCDIR)/bin/gen-iwyu-dummy-lib
77 # Partial Build
79 define gb_Top_GbuildModuleRules
80 .PHONY: $(1) $(1).all $(1).build $(1).check $(1).clean $(1).showdeliverables $(foreach target,$(gb_Top_MODULE_CHECK_TARGETS),$(1).$(target))
82 $(1): bootstrap fetch
83 cd $(SRCDIR)/$(2) && $$(MAKE) $(IWYU_OPTION) $(PARALLELISM_OPTION) $(GMAKE_OPTIONS)
85 $(1).build $(1).check $(1).clean $(1).showdeliverables $(foreach target,$(gb_Top_MODULE_CHECK_TARGETS),$(1).$(target)):
86 cd $(SRCDIR)/$(2) && $$(MAKE) $(PARALLELISM_OPTION) $(GMAKE_OPTIONS) $$(patsubst $(1).%,%,$$@)
88 $(1).all: bootstrap fetch
89 $$(MAKE) $(PARALLELISM_OPTION) $(IWYU_OPTION) $(GMAKE_OPTIONS) -f $(SRCDIR)/Makefile.gbuild $(WORKDIR)/Module/$(1) $(if $(CROSS_COMPILING),,$(WORKDIR)/Module/check/$(1) $(WORKDIR)/Module/slowcheck/$(1))
91 endef
93 define gb_Top_GbuildModulesRules
94 $(foreach m,$(1),$(call gb_Top_GbuildModuleRules,$(notdir $(m)),$(m)))
95 endef
97 gbuild_modules := $(patsubst $(SRCDIR)/%/,%,$(dir $(wildcard $(SRCDIR)/*/Module_*.mk $(SRCDIR)/external/*/Module_*.mk)))
99 gbuild_internal_modules := $(filter-out odk external,$(patsubst $(SRCDIR)/%/,%,$(dir $(wildcard $(SRCDIR)/*/Module_*.mk))))
101 internal.clean: $(addsuffix .clean,$(gbuild_internal_modules))
104 $(eval $(call gb_Top_GbuildModulesRules,$(gbuild_modules)))
106 gbuild_TARGETS := AllLangHelp \
107 AllLangPackage \
108 AllLangResTarget \
109 AutoInstall \
110 CliLibrary \
111 CliNativeLibrary \
112 CliUnoApi \
113 Configuration \
114 CppunitTest \
115 CustomTarget \
116 Dictionary \
117 Executable \
118 Extension \
119 ExtensionPackage \
120 ExtensionPackageSet \
121 ExternalPackage \
122 ExternalProject \
123 Gallery \
124 GeneratedPackage \
125 InstallModule \
126 InstallScript \
127 InternalUnoApi \
128 Jar \
129 JunitTest \
130 Library \
131 Module \
132 Package \
133 PackageSet \
134 Pagein \
135 Postprocess \
136 Pyuno \
137 PythonTest \
138 Rdb \
139 StaticLibrary \
140 UIConfig \
141 UnoApi \
142 UnpackedTarball \
143 WinResTarget \
144 Zip \
146 # build a generic gbuild target
147 $(foreach target,$(gbuild_TARGETS),$(target)_% $(foreach module,$(gbuild_modules),$(target)_$(module)/%)) %.genpatch: bootstrap fetch
148 $(MAKE) $(PARALLELISM_OPTION) $(GMAKE_OPTIONS) -f $(SRCDIR)/Makefile.gbuild $@
151 # Clean
153 clean: clean-host clean-build
155 clean-host:
156 rm -fr $(TESTINSTALLDIR)
157 rm -fr $(INSTDIR)
158 rm -fr $(WORKDIR)
160 clean-build:
161 ifneq ($(CROSS_COMPILING),)
162 rm -fr $(INSTDIR_FOR_BUILD)
163 rm -fr $(WORKDIR_FOR_BUILD)
164 endif
166 include $(SRCDIR)/compilerplugins/Makefile.mk
169 # Distclean
171 distclean : clean compilerplugins-clean
172 rm -fr \
173 $(BUILDDIR)/Makefile \
174 $(BUILDDIR)/aclocal.m4 \
175 $(BUILDDIR)/android/experimental/LOAndroid3/AndroidManifest.xml \
176 $(BUILDDIR)/autom4te.cache \
177 $(BUILDDIR)/config.log \
178 $(BUILDDIR)/config.Build.log \
179 $(BUILDDIR)/config.status \
180 $(BUILDDIR)/config_build.mk \
181 $(BUILDDIR)/config_host.mk \
182 $(BUILDDIR)/config_host.mk.stamp \
183 $(BUILDDIR)/config_host_lang.mk \
184 $(BUILDDIR)/config_host_lang.mk.stamp \
185 $(BUILDDIR)/config_host/*.h \
186 $(BUILDDIR)/configure \
187 $(BUILDDIR)/instsetoo_native/util/openoffice.lst \
188 $(BUILDDIR)/ios/lo.xcconfig \
189 $(BUILDDIR)/lo.xcent \
190 $(BUILDDIR)/sysui/desktop/macosx/Info.plist
191 find $(SRCDIR)/solenv/gdb -name "*.pyc" -exec rm {} \;
194 # custom command
196 cmd:
197 echo "custom cmd" && ( $(cmd) )
200 # Fetch
202 ifneq ($(DO_FETCH_TARBALLS),)
203 include $(SRCDIR)/Makefile.fetch
204 fetch: download
205 fetch: get-submodules
207 ifneq (,$(wildcard $(SRCDIR)/.git))
208 get-submodules:
209 ifneq ($(foreach i,$(GIT_NEEDED_SUBMODULES),$(i)/.git),$(wildcard $(foreach i,$(GIT_NEEDED_SUBMODULES),$(i)/.git)))
210 cd $(SRCDIR) && ./g -f clone
211 endif
212 @cd $(SRCDIR) && ./g -z # make sure the git hooks are in place enen if no submodules are needed
214 else # these sources are from a tarball, so get the other source tarballs
215 gb_LO_VER := $(shell . $(SRCDIR)/sources.ver && echo $$lo_sources_ver)
216 $(if $(gb_LO_VER),,$(error Error while retrieving $$lo_sources_ver from $(SRCDIR)/sources.ver))
218 get-submodules: | download
219 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))))
220 $(foreach i,$(subst helpcontent2,help,$(GIT_NEEDED_SUBMODULES)),\
221 $(call fetch_Download_item_unchecked,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))
222 $(SRCDIR)/bin/unpack-sources $(SRCDIR) $(foreach i,$(subst helpcontent2,help,$(GIT_NEEDED_SUBMODULES)),\
223 $(TARFILE_LOCATION)/libreoffice-$(i)-$(gb_LO_VER).tar.xz)
224 endif
226 endif
228 else
229 fetch:
230 @echo "Automatic fetching of external tarballs is disabled."
232 endif
235 # Bootstap
237 bootstrap: compilerplugins
240 # Build
242 # Note: this will pipe through all gbuild targets to ... gbuild
243 # with some translations like "build"->"all" for historic reasons
245 build: bootstrap fetch $(if $(CROSS_COMPILING),cross-toolset)
246 ifneq ($(filter-out WNT MACOSX IOS,$(OS)),)
247 mkdir -p $(INSTDIR)
248 $(SRCDIR)/solenv/bin/install-gdb-printers -a $(INSTDIR) -c
249 endif
250 $(MAKE) $(PARALLELISM_OPTION) $(IWYU_OPTION) $(GMAKE_OPTIONS) -f $(SRCDIR)/Makefile.gbuild $(build_goal)
251 ifeq ($(OS),IOS)
252 $(MAKE) $(PARALLELISM_OPTION) $(GMAKE_OPTIONS) ios
253 endif
255 build-non-l10n-only build-l10n-only build-nocheck check debugrun translations packageinfo $(gb_Top_MODULE_CHECK_TARGETS): build
257 help showmodules:
258 $(MAKE) $(PARALLELISM_OPTION) $(GMAKE_OPTIONS) -f $(SRCDIR)/Makefile.gbuild $@
260 cross-toolset: bootstrap fetch
261 $(MAKE) gb_Side=build $(PARALLELISM_OPTION) $(GMAKE_OPTIONS) -f $(SRCDIR)/Makefile.gbuild build-tools
265 # Install
268 define gb_Top_DoInstall
269 echo "$(1) in $(INSTALLDIR) ..." && \
270 $(SRCDIR)/solenv/bin/ooinstall $(2) "$(INSTALLDIR)"
272 endef
274 ifneq ($(OS),MACOSX)
275 define gb_Top_InstallFinished
276 echo && echo "If you want to edit the .ui files with glade first execute:" && \
277 echo && echo "export GLADE_CATALOG_SEARCH_PATH=$(2)/share/glade" && \
278 echo && echo "$(1) finished, you can now execute:" && \
279 echo "$(2)/program/soffice"
281 endef
282 else
283 define gb_Top_InstallFinished
284 echo && echo "$(1) finished, you can now run: " && \
285 echo "open $(2)/$(PRODUCTNAME).app" && \
286 echo "" && \
287 echo "To debug: gdb $(2)/$(PRODUCTNAME).app/Contents/MacOS/soffice"
289 endef
290 endif
292 ifneq ($(OS),MACOSX)
293 install:
294 @$(call gb_Top_DoInstall,Installing,)
295 @$(call gb_Top_InstallFinished,Installation,$(INSTALLDIR))
297 install-strip:
298 @$(call gb_Top_DoInstall,Installing and stripping binaries,--strip)
299 @$(call gb_Top_InstallFinished,Installation,$(INSTALLDIR))
300 endif # !MACOSX
302 test-install: build
303 @rm -rf $(TESTINSTALLDIR)
304 @mkdir -p $(TESTINSTALLDIR)
305 ifeq ($(OS_FOR_BUILD),WNT)
306 cd $(SRCDIR)/instsetoo_native && $(MAKE) LIBO_TEST_INSTALL=TRUE $(GMAKE_OPTIONS)
307 else
308 @$(SRCDIR)/solenv/bin/ooinstall $(TESTINSTALLDIR)
309 ifneq ($(MACOSX_CODESIGNING_IDENTITY),)
310 @$(SRCDIR)/solenv/bin/macosx-codesign-app-bundle $(TESTINSTALLDIR)/LibreOffice$(if $(ENABLE_RELEASE_BUILD),,Dev).app
311 endif
312 endif
313 @$(call gb_Top_InstallFinished,Test Installation,$(TESTINSTALLDIR))
315 mac-app-store-package: test-install
316 ifneq ($(MACOSX_PACKAGE_SIGNING_IDENTITY),)
317 mv "$(TESTINSTALLDIR)/$(PRODUCTNAME).app" "$(MACOSX_APP_NAME).app"
318 productbuild --component "$(MACOSX_APP_NAME).app" /Applications --sign $(MACOSX_PACKAGE_SIGNING_IDENTITY) $(shell echo "$(MACOSX_APP_NAME)" | tr ' ' '-').pkg
319 else
320 @echo You did not provide an installer signing identity with --enable-macosx-package-signing
321 @exit 1
322 endif
324 distro-pack-install: install
325 $(SRCDIR)/bin/distro-install-clean-up
326 $(SRCDIR)/bin/distro-install-desktop-integration
327 $(SRCDIR)/bin/distro-install-sdk
328 $(SRCDIR)/bin/distro-install-file-lists
330 install-package-%:
331 $(MAKE) $(GMAKE_OPTIONS) -f $(SRCDIR)/Makefile.gbuild $@
334 @$(SRCDIR)/solenv/bin/create-ids
336 tags:
337 @$(SRCDIR)/solenv/bin/create-tags
339 etags:
340 @$(SRCDIR)/solenv/bin/create-tags -e
342 docs:
343 @$(SRCDIR)/solenv/bin/mkdocs.sh $(SRCDIR)/docs $(SRCDIR)/solenv/inc/doxygen.cfg
345 findunusedcode:
346 @$(SRCDIR)/bin/findunusedcode $(SRCDIR) $(MAKE)
348 findunusedheaders:
349 $(SRCDIR)/bin/find-unusedheaders.pl
352 dump-deps:
353 @$(SRCDIR)/bin/module-deps.pl $(MAKE) $(SRCDIR)/Makefile.gbuild
355 dump-deps-png:
356 @$(SRCDIR)/bin/module-deps.pl $(MAKE) $(SRCDIR)/Makefile.gbuild | dot -Tpng -o lo.png
358 dump-deps-sort:
359 @$(SRCDIR)/bin/module-deps.pl -t $(MAKE) $(SRCDIR)/Makefile.gbuild
361 define gb_Top_GbuildToIdeIntegration
362 $(1)-ide-integration:
363 cd $(SRCDIR) && (LC_MESSAGES=C $(MAKE) cmd="$(MAKE) -npf Makefile.gbuild all" cmd || true) | $(SRCDIR)/bin/gbuild-to-ide --ide $(1)
365 endef
367 $(foreach ide,\
368 debug \
369 kdevelop \
370 vs2012 \
371 vs2013 \
372 vim \
373 xcode, \
374 $(eval $(call gb_Top_GbuildToIdeIntegration,$(ide))))
376 endif # MAKE_RESTARTS
378 # vim: set noet sw=4 ts=4: