1 # -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
3 .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
5 ifeq ($(MAKECMDGOALS),)
11 SHELL=/usr/bin/env bash
12 SRCDIR:=$(patsubst %/,%,$(dir $(realpath $(firstword $(MAKEFILE_LIST)))))
18 include $(SRCDIR)/config_$(gb_Side).mk
20 ifeq ($(GMAKE_OPTIONS),)
21 ifeq ($(verbose)$(VERBOSE),)
22 export GMAKE_OPTIONS:=-rs
24 export GMAKE_OPTIONS:=-r
28 # This list tells which modules are gbuild ones. It does *not* tell which modules to build. That is directed
29 # by the module being mentioned in packimages/prj/build.lst, etc, recursively.
30 $(WORKDIR)/modules.mk: $(wildcard */Module_*.mk) $(wildcard */prj/dmake) $(SRCDIR)/config_host.mk
32 echo "gbuild_modules:= tail_build \\" > $@
33 for m in */Module_*.mk; do echo $$m | sed -e 's/\/.*$$/ \\/'; done >> $@
35 echo -n "dmake_modules:= " >> $@
36 for m in */prj/dmake; do echo $$m | sed -e 's/\/.*$$/ \\/'; done >> $@
39 include $(WORKDIR)/modules.mk
40 include $(SRCDIR)/solenv/gbuild/Output.mk
41 $(if $(filter $(gbuild_modules),$(dmake_modules)),$(eval $(call gb_Output_warn,The following modules claim to be both dmake and gbuild: $(filter $(gbuild_modules),$(dmake_modules)))))
43 export gb_TAILBUILDTARGET=all slowcheck
45 define gbuild_module_rules
46 .PHONY: $(1) $(1).all $(1).build $(1).check $(1).clean $(1).subsequentcheck $(1).deliver
49 cd $(1) && $(GNUMAKE) -j $(PARALLELISM) $(GMAKE_OPTIONS) gb_PARTIALBUILD=T
51 $(1).all: bootstrap fetch
52 $$(if $$(filter $(1),$$(shell $(GNUMAKE) -r -f $(SRCDIR)/tail_build/Makefile showmodules)), \
53 cd tail_build && unset MAKEFLAGS && \
54 export gb_TAILBUILDTARGET="$(WORKDIR)/Module/$(1) $(WORKDIR)/Module/check/$(1) $(WORKDIR)/Module/slowcheck/$(1)" && \
56 cd $(1) && unset MAKEFLAGS && \
58 $(SOLARENV)/bin/build.pl -P$(PARALLELISM) --all -- -P$(PARALLELISM)
60 $(1).build $(1).check $(1).clean:
61 cd $(1) && $(GNUMAKE) -j $(PARALLELISM) $(GMAKE_OPTIONS) $$(patsubst $(1).%,%,$$@) gb_PARTIALBUILD=T
64 cd $(1) && $(GNUMAKE) -j $(CHECK_PARALLELISM) $(GMAKE_OPTIONS) subsequentcheck gb_PARTIALBUILD=T
71 define gbuild_modules_rules
72 $(foreach m,$(1),$(call gbuild_module_rules,$(m)))
75 define dmake_module_rules
76 .PHONY: $(1) $(1).all $(1).deliver $(1).clean
79 cd $(1) && unset MAKEFLAGS && \
80 $(SOLARENV)/bin/build.pl -P$(PARALLELISM) -- -P$(PARALLELISM)
82 $(1).all: bootstrap fetch
83 cd $(1) && unset MAKEFLAGS && \
84 $(SOLARENV)/bin/build.pl -P$(PARALLELISM) --all -- -P$(PARALLELISM)
87 cd $(1) && $(SOLARENV)/bin/deliver.pl
90 cd $(1) && $(SOLARENV)/bin/deliver.pl -delete
95 define dmake_modules_rules
96 $(foreach m,$(1),$(call dmake_module_rules,$(m)))
102 $(eval $(call gbuild_modules_rules,$(gbuild_modules)))
104 $(eval $(call dmake_modules_rules,$(dmake_modules)))
106 # run a JunitTest - relies on naming convention (module prefix)
107 $(WORKDIR)/JunitTest/%/done :
108 cd $(firstword $(subst _, ,$*)) && $(GNUMAKE) $(GMAKE_OPTIONS) $@ gb_PARTIALBUILD=T
110 # run a CppunitTest - relies on naming convention (module prefix)
111 $(WORKDIR)/CppunitTest/%.test :
112 cd $(firstword $(subst _, ,$*)) && $(GNUMAKE) $(GMAKE_OPTIONS) $@ gb_PARTIALBUILD=T
117 clean: clean-host clean-build
120 ifeq ($(BUILD_DMAKE),YES)
121 if [ -f dmake/Makefile ] ; then $(GNUMAKE) -j $(PARALLELISM) -C dmake clean; fi
123 rm -fr $(DEVINSTALLDIR)
126 rm -fr $(SRCDIR)/*/$(INPATH)
127 rm -fr $(SRCDIR)/solenv/$(OUTPATH)
131 ifeq ($(CROSS_COMPILING),YES)
132 rm -rf $(SOLARVER)/$(INPATH_FOR_BUILD) # not necessarily below SRCDIR
133 rm -rf $(SRCDIR)/*/$(INPATH_FOR_BUILD)
136 include $(SRCDIR)/compilerplugins/Makefile.mk
141 distclean : clean compilerplugins-clean
142 ifeq ($(BUILD_DMAKE),YES)
143 (if [ -f dmake/Makefile ] ; then $(GNUMAKE) -j $(PARALLELISM) -C dmake distclean; fi) && \
144 rm -f solenv/*/bin/dmake*
146 rm -fr config_host.mk config_build.mk aclocal.m4 autom4te.cache \
147 config.log config.status configure \
148 config_host.mk.last config_host.mk.stamp src.downloaded warn
149 find $(SOLARENV)/gdb -name "*.pyc" -exec rm {} \;
154 ifneq ( $(MAKECMDGOALS),cmd)
156 echo "custom cmd" && ( $(cmd) )
160 ifneq ($(filter-out clean distclean,$(MAKECMDGOALS)),)
164 ifneq ($(DO_FETCH_TARBALLS),NO)
165 include $(SRCDIR)/Makefile.fetch
167 fetch: get-submodules
168 fetch: $(SRCDIR)/src.downloaded
170 ifneq (,$(wildcard .git))
172 ifneq ($(foreach i,$(GIT_NEEDED_SUBMODULES),$(i)/.git),$(wildcard $(foreach i,$(GIT_NEEDED_SUBMODULES),$(i)/.git)))
173 ifeq (,$(GIT_LINK_SRC))
175 else # space-saving clone from another local workdir
176 @echo "FIXME: GIT_LINK_SRC method is not yet implemented with submodules" 1>&2
177 true $(foreach i,$(GIT_NEEDED_SUBMODULES),\
178 && rm -r $(i) && cp -R $(GIT_LINK_SRC)/$(i) $(i))
179 # bin/git-new-workdir $GIT_LINK_SRC/$i $i
180 git submodule update $(GIT_NEEDED_SUBMODULES)
184 else # these sources are from a tarball, so get the other source tarballs
185 gb_LO_VER := $(shell . $(SRCDIR)/sources.ver && echo $$lo_sources_ver)
186 $(if $(gb_LO_VER),,$(error Error while retrieving $$lo_sources_ver from $(SRCDIR)/sources.ver))
188 get-submodules: | download
189 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))))
190 $(foreach i,$(subst helpcontent2,help,$(GIT_NEEDED_SUBMODULES)),\
191 $(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))
192 $(SRCDIR)/bin/unpack-sources $(SRCDIR) $(foreach i,$(subst helpcontent2,help,$(GIT_NEEDED_SUBMODULES)),\
193 $(TARFILE_LOCATION)/libreoffice-$(i)-$(gb_LO_VER).tar.xz)
198 # TODO: This should be really in external/ module, I think.
199 $(SRCDIR)/src.downloaded : $(SRCDIR)/download $(SRCDIR)/config_host.mk | download
206 @echo "Automatic fetching of external tarballs is disabled."
213 bootstrap: $(WORKDIR)/bootstrap compilerplugins
215 $(WORKDIR)/bootstrap:
216 @cd $(SRCDIR) && ./bootstrap
217 @mkdir -p $(dir $@) && touch $@
222 build-packimages: bootstrap fetch $(if $(filter $(INPATH),$(INPATH_FOR_BUILD)),,cross-toolset)
223 ifeq ($(DISABLE_SCRIPTING),TRUE)
224 # We must get the headers from vbahelper "delivered" because
225 # as we don't link to any libs from there they won't otherwise be, or
226 # something. And we still do include those headers always even if the
227 # libs aren't built in the --disable-scripting case. (Ifdefs for
228 # DISABLE_SCRIPTING will be added to the code later as necessary.)
231 ifeq ($(DISABLE_DBCONNECTIVITY),TRUE)
232 # Ditto for dbconnectivity in the --disable-database-connectivity case
233 cd connectivity && sed -e 's/^\(export [A-Z0-9_]*=\)\(.*\)$$/\1"\2"/' <../config_host.mk >conftmp.sh && . conftmp.sh && rm conftmp.sh && $(SOLARENV)/bin/deliver.pl
235 cd packimages && unset MAKEFLAGS && \
236 $(SOLARENV)/bin/build.pl -P$(PARALLELISM) --all -- -P$(PARALLELISM) && \
237 $(GNUMAKE) -j $(PARALLELISM) $(GMAKE_OPTIONS)
239 build: build-packimages
240 ifeq ($(OS_FOR_BUILD),WNT)
241 cd instsetoo_native && unset MAKEFLAGS && $(SOLARENV)/bin/build.pl
243 cd instsetoo_native && unset MAKEFLAGS && \
244 $(SOLARENV)/bin/build.pl -P$(PARALLELISM) -- -P$(PARALLELISM)
247 cd android && $(GNUMAKE) -j $(PARALLELISM) $(GMAKE_OPTIONS)
250 build-nocheck : export SKIP_TESTS := YES
251 build-nocheck : build
253 cross-toolset: bootstrap fetch
254 cd cross_toolset && $(GNUMAKE) -j $(PARALLELISM) $(GMAKE_OPTIONS)
255 ifneq (,$(filter DESKTOP,$(BUILD_TYPE)))
257 # We need to build nss for nsinstall... See NSINSTALL=... in nss/makefile.mk
258 $(GNUMAKE) gb_Side=build nss
267 echo "Installing in $(INSTALLDIR)..." && \
268 ooinstall "$(INSTALLDIR)" && \
270 echo "Installation finished, you can now execute:" && \
271 echo "$(INSTALLDIR)/program/soffice"
274 echo "Installing and stripping binaries in $(INSTALLDIR)..." && \
275 ooinstall --strip "$(INSTALLDIR)" && \
277 echo "Installation finished, you can now execute:" && \
278 echo "$(INSTALLDIR)/program/soffice"
281 @rm -rf $(DEVINSTALLDIR)
282 @mkdir $(DEVINSTALLDIR)
283 ifeq ($(OS_FOR_BUILD),WNT)
284 cd instsetoo_native && unset MAKEFLAGS && $(SOLARENV)/bin/build.pl LIBO_DEV_INSTALL=TRUE
285 unzip -q -d "$(DEVINSTALLDIR)" "$(SRCDIR)/instsetoo_native/$(INPATH)/LibreOffice/archive/install/en-US/LibreOffice*_archive.zip"
286 mv "$(DEVINSTALLDIR)"/LibreOffice*_archive/* "$(DEVINSTALLDIR)"/opt
288 ifeq ($(DISABLE_LINKOO),TRUE)
289 @ooinstall $(DEVINSTALLDIR)/opt
290 @install-gdb-printers -L
292 @ooinstall -l $(DEVINSTALLDIR)/opt
295 @rm -f $(SRCDIR)/install && ln -s $(DEVINSTALLDIR)/opt/ $(SRCDIR)/install
297 dev-install-nocheck : export SKIP_TESTS := YES
298 dev-install-nocheck : dev-install
301 ifeq ($(DISABLE_LINKOO),TRUE)
302 @linkoo --copy $(DEVINSTALLDIR)/opt $(SRCDIR)
304 @linkoo $(DEVINSTALLDIR)/opt $(SRCDIR)
308 @rm -rf $(DEVINSTALLDIR)
309 @mkdir $(DEVINSTALLDIR)
310 ifeq ($(OS_FOR_BUILD),WNT)
311 cd instsetoo_native && unset MAKEFLAGS && $(SOLARENV)/bin/build.pl LIBO_DEV_INSTALL=TRUE
312 unzip -q -d "$(DEVINSTALLDIR)" "$(SRCDIR)/instsetoo_native/$(INPATH)/LibreOffice/archive/install/en-US/LibreOffice*_archive.zip"
313 mv "$(DEVINSTALLDIR)"/LibreOffice*_archive/* "$(DEVINSTALLDIR)"/opt
315 @ooinstall $(DEVINSTALLDIR)/opt
316 @install-gdb-printers
318 @rm -f $(SRCDIR)/install && ln -s $(DEVINSTALLDIR)/opt/ $(SRCDIR)/install
320 distro-pack-install: install
321 $(SRCDIR)/bin/distro-install-clean-up
322 $(SRCDIR)/bin/distro-install-desktop-integration
323 $(SRCDIR)/bin/distro-install-sdk
324 $(SRCDIR)/bin/distro-install-mono
325 $(SRCDIR)/bin/distro-install-file-lists
334 @mkdocs.sh $(SRCDIR)/docs $(SOLARENV)/inc/doxygen.cfg
337 @which callcatcher > /dev/null 2>&1 || \
338 (echo "callcatcher not installed" && false)
339 @sed -e s,$$INPATH,callcatcher,g $(SRCDIR)/config_host.mk | sed -e s,"export OOO_JUNIT_JAR=.*","export OOO_JUNIT_JAR=",g > $(SRCDIR)/config_host_callcatcher.mk
340 @echo unexport ARCH_FLAGS >> $(SRCDIR)/config_host_callcatcher.mk
341 @echo unexport CFLAGS >> $(SRCDIR)/config_host_callcatcher.mk
342 @echo unexport CXXFLAGS >> $(SRCDIR)/config_host_callcatcher.mk
343 @mkdir -p $(SRCDIR)/solenv/callcatcher/bin && \
344 ln -sf $(SRCDIR)/solenv/$(INPATH)/bin/dmake \
345 $(SRCDIR)/solenv/callcatcher/bin/dmake
346 @$(GNUMAKE) -f $(SOLARENV)/bin/callcatcher.Makefile findunusedcode
347 @grep ::.*\( unusedcode.all \
352 | grep -v ^CLuceneError:: \
355 | grep -v ^graphite2:: \
356 | grep -v ^jvmaccess:: \
357 | grep -v ^libcdr:: \
358 | grep -v ^libcmis:: \
359 | grep -v ^libmspub:: \
360 | grep -v ^libvisio:: \
361 | grep -v ^libwpg:: \
362 | grep -v ^libwps_tools_win:: \
363 | grep -v ^lucene:: \
364 | grep -v ^Matrix3d:: \
365 | grep -v ^RelatedMultipart:: \
366 | grep -v ^salhelper:: \
367 | grep -v ^VSDInternalStream:: \
375 | grep -v ^WSObject \
378 check: dev-install subsequentcheck
380 subsequentcheck :| $(if $(filter-out subsequentcheck,$(MAKECMDGOALS)),dev-install)
381 $(GNUMAKE) -j $(CHECK_PARALLELISM) $(GMAKE_OPTIONS) -f Makefile.post $@
383 unitcheck slowcheck debugrun:
384 $(GNUMAKE) -j $(PARALLELISM) $(GMAKE_OPTIONS) -f Makefile.post $@
386 endif # not clean or distclean
388 # vim: set noet sw=4 ts=4: