Release SUSE 4.0-4, build id 304, Linux version 4.0.3.3.4, tag suse-4.0-4
[LibreOffice.git] / Makefile.top
blob015a6ee2e4cb5aa2293c906f656805bf5dea26d9
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),)
6 MAKECMDGOALS:=all
7 endif
9 all: build
11 SHELL=/usr/bin/env bash
12 SRCDIR:=$(patsubst %/,%,$(dir $(realpath $(firstword $(MAKEFILE_LIST)))))
14 ifeq ($(gb_Side),)
15 gb_Side:=host
16 endif
18 include $(SRCDIR)/config_$(gb_Side).mk
20 ifeq ($(GMAKE_OPTIONS),)
21 ifeq ($(verbose)$(VERBOSE),)
22 export GMAKE_OPTIONS:=-rs
23 else
24 export GMAKE_OPTIONS:=-r
25 endif
26 endif
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
31         mkdir -p $(dir $@)
32         echo "gbuild_modules:= tail_build \\" > $@
33         for m in */Module_*.mk; do echo $$m | sed -e 's/\/.*$$/ \\/'; done >> $@
34         echo >> $@
35         echo -n "dmake_modules:= " >> $@
36         for m in */prj/dmake; do echo $$m | sed -e 's/\/.*$$/ \\/'; done >> $@
37         echo >> $@
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
48 $(1): bootstrap fetch
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)" && \
55         , \
56                 cd $(1) && unset MAKEFLAGS && \
57         ) \
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
63 $(1).subsequentcheck:
64         cd $(1) && $(GNUMAKE) -j $(CHECK_PARALLELISM) $(GMAKE_OPTIONS) subsequentcheck gb_PARTIALBUILD=T
66 $(1).deliver:
67         @true
69 endef
71 define gbuild_modules_rules
72 $(foreach m,$(1),$(call gbuild_module_rules,$(m)))
73 endef
75 define dmake_module_rules
76 .PHONY: $(1) $(1).all $(1).deliver $(1).clean
78 $(1): bootstrap fetch
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)
86 $(1).deliver: $(1)
87         cd $(1) && $(SOLARENV)/bin/deliver.pl
89 $(1).clean:
90         cd $(1) && $(SOLARENV)/bin/deliver.pl -delete
91         rm -fr $(1)/$(INPATH)
93 endef
95 define dmake_modules_rules
96 $(foreach m,$(1),$(call dmake_module_rules,$(m)))
97 endef
100 # Partial Build
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
115 # Clean
117 clean: clean-host clean-build
119 clean-host:
120 ifeq ($(BUILD_DMAKE),YES)
121         if [ -f dmake/Makefile ] ; then $(GNUMAKE) -j $(PARALLELISM) -C dmake clean; fi
122 endif
123         rm -fr $(DEVINSTALLDIR)
124         rm -fr $(OUTDIR)
125         rm -fr $(WORKDIR)
126         rm -fr $(SRCDIR)/*/$(INPATH)
127         rm -fr $(SRCDIR)/solenv/$(OUTPATH)
128         rm -fr install
130 clean-build:
131 ifeq ($(CROSS_COMPILING),YES)
132         rm -rf $(SOLARVER)/$(INPATH_FOR_BUILD) # not necessarily below SRCDIR
133         rm -rf $(SRCDIR)/*/$(INPATH_FOR_BUILD)
134 endif
136 include $(SRCDIR)/compilerplugins/Makefile.mk
139 # Distclean
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*
145 endif
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 {} \;
152 # custom command
154 ifneq ( $(MAKECMDGOALS),cmd)
155 cmd:
156         echo "custom cmd" && ( $(cmd) )
158 endif
160 ifneq ($(filter-out clean distclean,$(MAKECMDGOALS)),)
162 # Fetch
164 ifneq ($(DO_FETCH_TARBALLS),NO)
165 include $(SRCDIR)/Makefile.fetch
166 fetch: download
167 fetch: get-submodules
168 fetch: $(SRCDIR)/src.downloaded
170 ifneq (,$(wildcard .git))
171 get-submodules:
172 ifneq ($(foreach i,$(GIT_NEEDED_SUBMODULES),$(i)/.git),$(wildcard $(foreach i,$(GIT_NEEDED_SUBMODULES),$(i)/.git)))
173 ifeq (,$(GIT_LINK_SRC))
174         ./g -f clone
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)
181 endif
182 endif
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)
194 endif
196 endif
198 # TODO: This should be really in external/ module, I think.
199 $(SRCDIR)/src.downloaded : $(SRCDIR)/download $(SRCDIR)/config_host.mk | download
200 ifeq ($(COM),MSC)
201         $< && touch $@
202 endif
204 else
205 fetch:
206         @echo "Automatic fetching of external tarballs is disabled."
208 endif
211 # Bootstap
213 bootstrap: $(WORKDIR)/bootstrap compilerplugins
215 $(WORKDIR)/bootstrap:
216         @cd $(SRCDIR) && ./bootstrap
217         @mkdir -p $(dir $@) && touch $@
220 # Build
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.)
229         $(GNUMAKE) vbahelper
230 endif
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
234 endif
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
242 else
243         cd instsetoo_native && unset MAKEFLAGS && \
244         $(SOLARENV)/bin/build.pl -P$(PARALLELISM) -- -P$(PARALLELISM)
245 endif
246 ifeq ($(OS),ANDROID)
247         cd android && $(GNUMAKE) -j $(PARALLELISM) $(GMAKE_OPTIONS)
248 endif
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)))
256 ifneq (WNT,$(OS))
257 # We need to build nss for nsinstall... See NSINSTALL=... in nss/makefile.mk
258         $(GNUMAKE) gb_Side=build nss
259 endif
260 endif
263 # Install
266 install:
267         echo "Installing in $(INSTALLDIR)..." && \
268         ooinstall "$(INSTALLDIR)" && \
269         echo "" && \
270         echo "Installation finished, you can now execute:" && \
271         echo "$(INSTALLDIR)/program/soffice"
273 install-strip:
274         echo "Installing and stripping binaries in $(INSTALLDIR)..." && \
275         ooinstall --strip "$(INSTALLDIR)" && \
276         echo "" && \
277         echo "Installation finished, you can now execute:" && \
278         echo "$(INSTALLDIR)/program/soffice"
280 dev-install: build
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
287 else
288 ifeq ($(DISABLE_LINKOO),TRUE)
289         @ooinstall $(DEVINSTALLDIR)/opt
290         @install-gdb-printers -L
291 else
292         @ooinstall -l $(DEVINSTALLDIR)/opt
293 endif
294 endif
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
300 dev-update:
301 ifeq ($(DISABLE_LINKOO),TRUE)
302         @linkoo --copy $(DEVINSTALLDIR)/opt $(SRCDIR)
303 else
304         @linkoo $(DEVINSTALLDIR)/opt $(SRCDIR)
305 endif
307 install-tb:
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
314 else
315         @ooinstall $(DEVINSTALLDIR)/opt
316         @install-gdb-printers
317 endif
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
328         @create-ids
330 tags:
331         @create-tags
333 docs:
334         @mkdocs.sh $(SRCDIR)/docs $(SOLARENV)/inc/doxygen.cfg
336 findunusedcode:
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 \
348               | grep -v ^Atom \
349               | grep -v ^atom:: \
350               | grep -v ^boost:: \
351               | grep -v ^CIcc \
352               | grep -v ^CLuceneError:: \
353               | grep -v ^cppu:: \
354               | grep -v ^Dde \
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:: \
368               | grep -v ^WP1 \
369               | grep -v ^WP3 \
370               | grep -v ^WP42 \
371               | grep -v ^WP6 \
372               | grep -v ^WPG \
373               | grep -v ^WPS \
374               | grep -v WPX \
375               | grep -v ^WSObject \
376               > unusedcode.easy
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: