Version 4.3.0.0.beta1, tag libreoffice-4.3.0.0.beta1
[LibreOffice.git] / Makefile.in
blobf63dbe069837fd092970ed52e3c6dbe549d16ac3
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
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=/usr/bin/env 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 $(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 $(eval $(call gb_Top_GbuildModulesRules,$(gbuild_modules)))
85 gbuild_TARGETS := AllLangHelp \
86 AllLangPackage \
87 AllLangResTarget \
88 AutoInstall \
89 CliLibrary \
90 CliNativeLibrary \
91 CliUnoApi \
92 Configuration \
93 CppunitTest \
94 CustomTarget \
95 Dictionary \
96 Executable \
97 Extension \
98 ExtensionPackage \
99 ExtensionPackageSet \
100 ExternalPackage \
101 ExternalProject \
102 GeneratedPackage \
103 InstallModule \
104 InstallScript \
105 InternalUnoApi \
106 Jar \
107 JunitTest \
108 Library \
109 Module \
110 Package \
111 PackageSet \
112 Pagein \
113 Postprocess \
114 Pyuno \
115 PythonTest \
116 Rdb \
117 StaticLibrary \
118 UIConfig \
119 UnoApi \
120 UnpackedTarball \
121 WinResTarget \
122 Zip \
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 $@
129 # Clean
131 clean: clean-host clean-build
133 clean-host:
134 rm -fr $(TESTINSTALLDIR)
135 rm -fr $(INSTDIR)
136 rm -fr $(WORKDIR)
137 rm -fr solver
138 rm -fr install
140 clean-build:
141 ifneq ($(CROSS_COMPILING),)
142 rm -fr $(INSTDIR_FOR_BUILD)
143 rm -fr $(WORKDIR_FOR_BUILD)
144 endif
146 include $(SRCDIR)/compilerplugins/Makefile.mk
149 # Distclean
151 distclean : clean compilerplugins-clean
152 rm -fr \
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 {} \;
171 # custom command
173 cmd:
174 echo "custom cmd" && ( $(cmd) )
177 # Fetch
179 ifneq ($(DO_FETCH_TARBALLS),)
180 include $(SRCDIR)/Makefile.fetch
181 fetch: download
182 fetch: get-submodules
184 ifneq (,$(wildcard $(SRCDIR)/.git))
185 get-submodules:
186 ifneq ($(foreach i,$(GIT_NEEDED_SUBMODULES),$(i)/.git),$(wildcard $(foreach i,$(GIT_NEEDED_SUBMODULES),$(i)/.git)))
187 cd $(SRCDIR) && ./g -f clone
188 endif
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)
201 endif
203 endif
205 else
206 fetch:
207 @echo "Automatic fetching of external tarballs is disabled."
209 endif
212 # Bootstap
214 bootstrap: compilerplugins
217 # Build
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
225 endif
226 $(MAKE) $(PARALLELISM_OPTION) $(GMAKE_OPTIONS) -f $(SRCDIR)/Makefile.gbuild $(build_goal)
227 ifeq ($(OS),IOS)
228 $(MAKE) $(PARALLELISM_OPTION) $(GMAKE_OPTIONS) ios
229 endif
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
238 # Install
241 define gb_Top_DoInstall
242 echo "$(1) in $(INSTALLDIR) ..." && \
243 ooinstall $(2) "$(INSTALLDIR)"
245 endef
247 ifneq ($(OS),MACOSX)
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"
254 endef
255 else
256 define gb_Top_InstallFinished
257 echo && echo "$(1) finished, you can now run: " && \
258 echo "open $(2)/$(PRODUCTNAME).app" && \
259 echo "" && \
260 echo "To debug: gdb $(2)/$(PRODUCTNAME).app/Contents/MacOS/soffice"
262 endef
263 endif
265 ifneq ($(OS),MACOSX)
266 install:
267 @$(call gb_Top_DoInstall,Installing,)
268 @$(call gb_Top_InstallFinished,Installation,$(INSTALLDIR))
270 install-strip:
271 @$(call gb_Top_DoInstall,Installing and stripping binaries,--strip)
272 @$(call gb_Top_InstallFinished,Installation,$(INSTALLDIR))
273 endif # !MACOSX
275 dev-install:
276 @echo && echo "dev-install is obsolete! Just build with \"make check\" and run"
277 ifeq ($(OS),MACOSX)
278 @echo " open instdir/$(PRODUCTNAME).app"
279 @echo
280 @echo "To debug: gdb instdir/$(PRODUCTNAME).app/Contents/MacOS/soffice"
281 else
282 @echo " instdir/program/soffice"
283 endif
284 @echo
285 @echo "(only if you have good reason to test an actual installation: make test-install)"
286 @echo
287 @false
289 test-install: build
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)
294 else
295 @ooinstall $(TESTINSTALLDIR)
296 ifneq ($(MACOSX_CODESIGNING_IDENTITY),)
297 @macosx-codesign-app-bundle $(TESTINSTALLDIR)/LibreOffice.app
298 endif
299 endif
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
308 install-package-%:
309 $(MAKE) $(GMAKE_OPTIONS) -f $(SRCDIR)/Makefile.gbuild $@
312 @create-ids
314 tags:
315 @create-tags
317 docs:
318 @mkdocs.sh $(SRCDIR)/docs $(SRCDIR)/solenv/inc/doxygen.cfg
320 findunusedcode:
321 @$(SRCDIR)/bin/findunusedcode $(SRCDIR) $(MAKE)
323 findunusedheaders:
324 $(SRCDIR)/bin/find-unusedheaders.pl
327 dump-deps:
328 @$(SRCDIR)/bin/module-deps.pl $(MAKE) $(SRCDIR)/Makefile.gbuild
330 dump-deps-png:
331 @$(SRCDIR)/bin/module-deps.pl $(MAKE) $(SRCDIR)/Makefile.gbuild | dot -Tpng -o lo.png
333 dump-deps-sort:
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)
340 endef
342 $(foreach ide,\
343 kdevelop \
344 vs2012 \
345 xcode, \
346 $(eval $(call gb_Top_GbuildToIdeIntegration,$(ide))))
348 endif # MAKE_RESTARTS
350 # vim: set noet sw=4 ts=4: