Linux x86 build fix
[LibreOffice.git] / Makefile.in
blobd32332c033a04656fc1c115b36ec370561454dd2
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) patch unpatch
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 $(BUILDDIR)/autogen.input \
47 $(BUILDDIR)/autogen.lastrun \
48 $(BUILDDIR)/autogen.sh \
50 sh -c $(SRCDIR)/autogen.sh
52 else # MAKE_RESTARTS
54 all: build
56 gb_Side ?= host
58 include $(BUILDDIR)/config_$(gb_Side).mk
60 export GMAKE_OPTIONS?=-r$(if $(verbose)$(VERBOSE),,s)$(value $(MAKEFLAGS))
62 PARALLELISM_OPTION := $(if $(filter-out 0,$(PARALLELISM)),-j $(PARALLELISM),)
64 IWYU_OPTION := $(if $(IWYU_PATH),-k CC=$(IWYU_PATH) CXX=$(IWYU_PATH),)
66 # don't want to have a dependency to iwyudummy.generate because it's
67 # useful to manually edit the generated StaticLibrary_iwyudummy.mk
68 iwyudummy: bootstrap fetch
69 $(if $(wildcard $(BUILDDIR)/iwyudummy),,$(error first call "make iwyudummy.generate"))
70 cd $(BUILDDIR)/iwyudummy && $(MAKE) $(IWYU_OPTION) $(GMAKE_OPTIONS)
72 iwyudummy.generate:
73 $(SRCDIR)/bin/gen-iwyu-dummy-lib
76 # Partial Build
78 define gb_Top_GbuildModuleRules
79 .PHONY: $(1) $(1).all $(1).build $(1).check $(1).clean $(1).showdeliverables $(foreach target,$(gb_Top_MODULE_CHECK_TARGETS),$(1).$(target))
81 $(1): bootstrap fetch
82 cd $(SRCDIR)/$(2) && $$(MAKE) $(IWYU_OPTION) $(PARALLELISM_OPTION) $(GMAKE_OPTIONS)
84 $(1).build $(1).check $(1).clean $(1).showdeliverables $(foreach target,$(gb_Top_MODULE_CHECK_TARGETS),$(1).$(target)):
85 cd $(SRCDIR)/$(2) && $$(MAKE) $(PARALLELISM_OPTION) $(GMAKE_OPTIONS) $$(patsubst $(1).%,%,$$@)
87 $(1).all: bootstrap fetch
88 $$(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))
90 endef
92 define gb_Top_GbuildModulesRules
93 $(foreach m,$(1),$(call gb_Top_GbuildModuleRules,$(notdir $(m)),$(m)))
94 endef
96 gbuild_modules := $(patsubst $(SRCDIR)/%/,%,$(dir $(wildcard $(SRCDIR)/*/Module_*.mk $(SRCDIR)/external/*/Module_*.mk)))
98 gbuild_internal_modules := $(filter-out odk external,$(patsubst $(SRCDIR)/%/,%,$(dir $(wildcard $(SRCDIR)/*/Module_*.mk))))
100 internal.clean: $(addsuffix .clean,$(gbuild_internal_modules))
103 $(eval $(call gb_Top_GbuildModulesRules,$(gbuild_modules)))
105 gbuild_TARGETS := AllLangHelp \
106 AllLangPackage \
107 AllLangResTarget \
108 AutoInstall \
109 CliLibrary \
110 CliNativeLibrary \
111 CliUnoApi \
112 Configuration \
113 CppunitTest \
114 CustomTarget \
115 Dictionary \
116 Executable \
117 Extension \
118 ExtensionPackage \
119 ExtensionPackageSet \
120 ExternalPackage \
121 ExternalProject \
122 Gallery \
123 GeneratedPackage \
124 InstallModule \
125 InstallScript \
126 InternalUnoApi \
127 Jar \
128 JunitTest \
129 Library \
130 Module \
131 Package \
132 PackageSet \
133 Pagein \
134 Postprocess \
135 Pyuno \
136 PythonTest \
137 Rdb \
138 StaticLibrary \
139 UIConfig \
140 UnoApi \
141 UnpackedTarball \
142 WinResTarget \
143 Zip \
145 # build a generic gbuild target
146 $(foreach target,$(gbuild_TARGETS),$(target)_% $(foreach module,$(gbuild_modules),$(target)_$(module)/%)) %.genpatch: bootstrap fetch
147 $(MAKE) $(PARALLELISM_OPTION) $(GMAKE_OPTIONS) -f $(SRCDIR)/Makefile.gbuild $@
150 # Clean
152 clean: clean-host clean-build
154 clean-host:
155 rm -fr $(TESTINSTALLDIR)
156 rm -fr $(INSTDIR)
157 rm -fr $(WORKDIR)
159 clean-build:
160 ifneq ($(CROSS_COMPILING),)
161 rm -fr $(INSTDIR_FOR_BUILD)
162 rm -fr $(WORKDIR_FOR_BUILD)
163 endif
165 include $(SRCDIR)/compilerplugins/Makefile.mk
168 # Distclean
170 distclean : clean compilerplugins-clean
171 rm -fr \
172 $(BUILDDIR)/Makefile \
173 $(BUILDDIR)/aclocal.m4 \
174 $(BUILDDIR)/android/source/AndroidManifest.xml \
175 $(BUILDDIR)/autom4te.cache \
176 $(BUILDDIR)/config.log \
177 $(BUILDDIR)/config.Build.log \
178 $(BUILDDIR)/config.status \
179 $(BUILDDIR)/config_build.mk \
180 $(BUILDDIR)/config_host.mk \
181 $(BUILDDIR)/config_host.mk.stamp \
182 $(BUILDDIR)/config_host_lang.mk \
183 $(BUILDDIR)/config_host_lang.mk.stamp \
184 $(BUILDDIR)/config_host/*.h \
185 $(BUILDDIR)/configure \
186 $(BUILDDIR)/instsetoo_native/util/openoffice.lst \
187 $(BUILDDIR)/ios/lo.xcconfig \
188 $(BUILDDIR)/lo.xcent \
189 $(BUILDDIR)/sysui/desktop/macosx/Info.plist
190 find $(SRCDIR)/solenv/gdb -name "*.pyc" -exec rm {} \;
193 # custom command
195 cmd:
196 echo "custom cmd" && ( $(cmd) )
199 # Fetch
201 ifneq ($(DO_FETCH_TARBALLS),)
202 include $(SRCDIR)/Makefile.fetch
203 fetch: download
204 fetch: get-submodules
206 ifneq (,$(wildcard $(SRCDIR)/.git))
207 get-submodules:
208 ifneq ($(foreach i,$(GIT_NEEDED_SUBMODULES),$(i)/.git),$(wildcard $(foreach i,$(GIT_NEEDED_SUBMODULES),$(i)/.git)))
209 cd $(SRCDIR) && ./g -f clone
210 endif
211 @cd $(SRCDIR) && ./g -z # make sure the git hooks are in place enen if no submodules are needed
213 else # these sources are from a tarball, so get the other source tarballs
214 gb_LO_VER := $(shell . $(SRCDIR)/sources.ver && echo $$lo_sources_ver)
215 $(if $(gb_LO_VER),,$(error Error while retrieving $$lo_sources_ver from $(SRCDIR)/sources.ver))
217 get-submodules: | download
218 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))))
219 $(foreach i,$(subst helpcontent2,help,$(GIT_NEEDED_SUBMODULES)),\
220 $(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))
221 $(SRCDIR)/bin/unpack-sources $(SRCDIR) $(foreach i,$(subst helpcontent2,help,$(GIT_NEEDED_SUBMODULES)),\
222 $(TARFILE_LOCATION)/libreoffice-$(i)-$(gb_LO_VER).tar.xz)
223 endif
225 endif
227 else
228 fetch:
229 @echo "Automatic fetching of external tarballs is disabled."
231 endif
234 # Bootstap
236 bootstrap: compilerplugins
239 # Build
241 # Note: this will pipe through all gbuild targets to ... gbuild
242 # with some translations like "build"->"all" for historic reasons
244 build: bootstrap fetch $(if $(CROSS_COMPILING),cross-toolset)
245 ifneq ($(filter-out WNT MACOSX IOS,$(OS)),)
246 mkdir -p $(INSTDIR)
247 $(SRCDIR)/solenv/bin/install-gdb-printers -a $(INSTDIR) -c
248 endif
249 $(MAKE) $(PARALLELISM_OPTION) $(IWYU_OPTION) $(GMAKE_OPTIONS) -f $(SRCDIR)/Makefile.gbuild $(build_goal)
250 ifeq ($(OS),IOS)
251 $(MAKE) $(PARALLELISM_OPTION) $(GMAKE_OPTIONS) ios
252 endif
254 build-non-l10n-only build-l10n-only build-nocheck check debugrun translations packageinfo $(gb_Top_MODULE_CHECK_TARGETS): build
256 help showmodules:
257 $(MAKE) $(PARALLELISM_OPTION) $(GMAKE_OPTIONS) -f $(SRCDIR)/Makefile.gbuild $@
259 cross-toolset: bootstrap fetch
260 $(MAKE) gb_Side=build $(PARALLELISM_OPTION) $(GMAKE_OPTIONS) -f $(SRCDIR)/Makefile.gbuild build-tools
264 # Install
267 define gb_Top_DoInstall
268 echo "$(1) in $(INSTALLDIR) ..." && \
269 $(SRCDIR)/solenv/bin/ooinstall $(2) "$(INSTALLDIR)"
271 endef
273 ifneq ($(OS),MACOSX)
274 define gb_Top_InstallFinished
275 echo && echo "If you want to edit the .ui files with glade first execute:" && \
276 echo && echo "export GLADE_CATALOG_SEARCH_PATH=$(2)/share/glade" && \
277 echo && echo "$(1) finished, you can now execute:" && \
278 echo "$(2)/program/soffice"
280 endef
281 else
282 define gb_Top_InstallFinished
283 echo && echo "$(1) finished, you can now run: " && \
284 echo "open $(2)/$(PRODUCTNAME).app" && \
285 echo "" && \
286 echo "To debug: gdb $(2)/$(PRODUCTNAME).app/Contents/MacOS/soffice"
288 endef
289 endif
291 ifneq ($(OS),MACOSX)
292 install:
293 @$(call gb_Top_DoInstall,Installing,)
294 @$(call gb_Top_InstallFinished,Installation,$(INSTALLDIR))
296 install-strip:
297 @$(call gb_Top_DoInstall,Installing and stripping binaries,--strip)
298 @$(call gb_Top_InstallFinished,Installation,$(INSTALLDIR))
299 endif # !MACOSX
301 test-install: build
302 @rm -rf $(TESTINSTALLDIR)
303 @mkdir -p $(TESTINSTALLDIR)
304 ifeq ($(OS_FOR_BUILD),WNT)
305 cd $(SRCDIR)/instsetoo_native && $(MAKE) LIBO_TEST_INSTALL=TRUE $(GMAKE_OPTIONS)
306 else
307 @$(SRCDIR)/solenv/bin/ooinstall $(TESTINSTALLDIR)
308 ifneq ($(MACOSX_CODESIGNING_IDENTITY),)
310 # Create Resources/*.lproj directories for languages supported by OS X
311 set -x; for lang in ca cs da de el en es fi fr hr hu id it ja ko ms nl no pl pt pt_PT ro ru sk sv th tr uk vi zh_CN zh_TW; do \
312 lproj=$(TESTINSTALLDIR)/CollaboraOffice$(if $(ENABLE_RELEASE_BUILD),,Dev).app/Contents/Resources/$$lang.lproj; \
313 mkdir $$lproj; \
314 done
316 # And remove the "bin" folder which should not be there
317 rm -rf $(TESTINSTALLDIR)/CollaboraOffice$(if $(ENABLE_RELEASE_BUILD),,Dev).app/Contents/bin
319 # Remove unnecessary executables in the LibreOfficePython framework
320 rm -rf $(TESTINSTALLDIR)/CollaboraOffice$(if $(ENABLE_RELEASE_BUILD),,Dev).app/Contents/Frameworks/LibreOfficePython.framework/Versions/[1-9]*/bin
322 # Remove the python.o object file which is weird and interferes with app store uploading
323 # And with it removed, presumably the other stuff in the Python lib/python3.3/config-3.3m probably does not make sense either.
324 rm -rf $(TESTINSTALLDIR)/CollaboraOffice$(if $(ENABLE_RELEASE_BUILD),,Dev).app/Contents/Frameworks/LibreOfficePython.framework/Versions/[1-9]*/lib/python[1-9]*/config-[1-9]*
326 ifneq ($ENABLE_MACOSX_SANDBOX),)
327 # Remove the gengal.bin binary and unopkg script that we don't want
328 rm $(TESTINSTALLDIR)/CollaboraOffice$(if $(ENABLE_RELEASE_BUILD),,Dev).app/Contents/MacOS/gengal.bin
329 rm $(TESTINSTALLDIR)/CollaboraOffice$(if $(ENABLE_RELEASE_BUILD),,Dev).app/Contents/MacOS/unopkg
330 endif
332 # Then use the macosx-codesign-app-bundle script
333 @$(SRCDIR)/solenv/bin/macosx-codesign-app-bundle $(TESTINSTALLDIR)/CollaboraOffice$(if $(ENABLE_RELEASE_BUILD),,Dev).app
334 endif
335 endif
336 @$(call gb_Top_InstallFinished,Test Installation,$(TESTINSTALLDIR))
338 mac-app-store-package: test-install
339 ifneq ($(MACOSX_PACKAGE_SIGNING_IDENTITY),)
340 rm -rf CollaboraOffice.app
341 mv "$(TESTINSTALLDIR)/CollaboraOffice.app" "CollaboraOffice.app"
342 productbuild --component "CollaboraOffice.app" /Applications --sign $(MACOSX_PACKAGE_SIGNING_IDENTITY) CollaboraOffice.pkg
343 else
344 @echo You did not provide an installer signing identity with --enable-macosx-package-signing
345 @exit 1
346 endif
348 distro-pack-install: install
349 $(SRCDIR)/bin/distro-install-clean-up
350 $(SRCDIR)/bin/distro-install-desktop-integration
351 $(SRCDIR)/bin/distro-install-sdk
352 $(SRCDIR)/bin/distro-install-file-lists
354 install-package-%:
355 $(MAKE) $(GMAKE_OPTIONS) -f $(SRCDIR)/Makefile.gbuild $@
358 @$(SRCDIR)/solenv/bin/create-ids
360 tags:
361 @$(SRCDIR)/solenv/bin/create-tags
363 etags:
364 @$(SRCDIR)/solenv/bin/create-tags -e
366 docs:
367 @$(SRCDIR)/solenv/bin/mkdocs.sh $(SRCDIR)/docs $(SRCDIR)/solenv/inc/doxygen.cfg
369 findunusedcode:
370 @$(SRCDIR)/bin/findunusedcode $(SRCDIR) $(MAKE)
372 findunusedheaders:
373 $(SRCDIR)/bin/find-unusedheaders.pl
376 dump-deps:
377 @$(SRCDIR)/bin/module-deps.pl $(MAKE) $(SRCDIR)/Makefile.gbuild
379 dump-deps-png:
380 @$(SRCDIR)/bin/module-deps.pl $(MAKE) $(SRCDIR)/Makefile.gbuild | dot -Tpng -o lo.png
382 dump-deps-sort:
383 @$(SRCDIR)/bin/module-deps.pl -t $(MAKE) $(SRCDIR)/Makefile.gbuild
385 define gb_Top_GbuildToIdeIntegration
386 $(1)-ide-integration:
387 cd $(SRCDIR) && (LC_MESSAGES=C $(MAKE) cmd="$(MAKE) -npf Makefile.gbuild all" cmd || true) | $(SRCDIR)/bin/gbuild-to-ide --ide $(1)
389 endef
391 $(foreach ide,\
392 debug \
393 kdevelop \
394 vs2012 \
395 vs2013 \
396 vim \
397 xcode, \
398 $(eval $(call gb_Top_GbuildToIdeIntegration,$(ide))))
400 endif # MAKE_RESTARTS
402 patch:
403 test -d uncommitted-patches || exit 0
404 for F in uncommitted-patches/*.patch; do \
405 patch --dry-run -p1 <$$F || exit 1; \
406 done
407 mkdir -p uncommitted-patches.applied
408 for F in uncommitted-patches/*.patch; do \
409 patch -p1 <$$F || exit 1; \
410 cp $$F uncommitted-patches.applied; \
411 done
413 unpatch:
414 test -d uncommitted-patches.applied || exit 0
415 for F in uncommitted-patches.applied/*.patch; do \
416 patch -R -p1 <$$F || exit 1; \
417 rm $$F; \
418 done
420 # vim: set noet sw=4 ts=4: