2012-05-15 07:47:37 -05:00
# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
2012-11-26 07:17:18 -06:00
.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
2012-05-15 07:47:37 -05:00
ifeq ($(MAKECMDGOALS),)
MAKECMDGOALS:=all
endif
all: build
SHELL=/usr/bin/env bash
SRCDIR:=$(patsubst %/,%,$(dir $(realpath $(firstword $(MAKEFILE_LIST)))))
ifeq ($(gb_Side),)
gb_Side:=host
endif
include $(SRCDIR)/config_$(gb_Side).mk
ifeq ($(GMAKE_OPTIONS),)
2012-07-31 02:27:18 -05:00
ifeq ($(verbose)$(VERBOSE),)
2012-05-15 07:47:37 -05:00
export GMAKE_OPTIONS:=-rs
else
export GMAKE_OPTIONS:=-r
endif
endif
2012-08-22 08:58:15 -05:00
# This list tells which modules are gbuild ones. It does *not* tell which modules to build. That is directed
# by the module being mentioned in packimages/prj/build.lst, etc, recursively.
2012-11-29 05:48:39 -06:00
$(WORKDIR)/modules.mk: $(wildcard */Module_*.mk) $(wildcard */prj/dmake) $(SRCDIR)/config_host.mk
2012-11-29 06:14:37 -06:00
mkdir -p $(dir $@)
2012-12-04 09:36:59 -06:00
echo -n "gbuild_modules:= tail_build \\" > $@
2012-11-29 05:13:07 -06:00
for m in */Module_*.mk; do echo $$m | sed -e 's/\/.*$$/ \\/'; done >> $@
echo >> $@
2012-11-30 09:20:28 -06:00
echo -n "dmake_modules:= " >> $@
2012-11-29 05:13:07 -06:00
for m in */prj/dmake; do echo $$m | sed -e 's/\/.*$$/ \\/'; done >> $@
echo >> $@
2012-12-07 12:48:50 -06:00
-include $(WORKDIR)/modules.mk
2012-11-29 05:13:07 -06:00
include $(SRCDIR)/solenv/gbuild/Output.mk
2012-11-29 05:58:35 -06:00
$(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)))))
2012-05-15 07:47:37 -05:00
export gb_TAILBUILDTARGET=all slowcheck
define gbuild_module_rules
2012-10-04 09:21:47 -05:00
.PHONY: $(1) $(1).all $(1).build $(1).check $(1).clean $(1).subsequentcheck $(1).deliver
2012-05-15 07:47:37 -05:00
$(1): bootstrap fetch
2012-10-27 12:05:33 -05:00
cd $(1) && $(GNUMAKE) -j $(PARALLELISM) $(GMAKE_OPTIONS) gb_PARTIALBUILD=T
2012-05-15 07:47:37 -05:00
$(1).all: bootstrap fetch
2012-12-04 09:45:33 -06:00
$$(if $$(filter $(1),$$(shell $(GNUMAKE) -r -f $(SRCDIR)/tail_build/Makefile showmodules)), \
2012-08-16 11:25:16 -05:00
cd tail_build && unset MAKEFLAGS && \
export gb_TAILBUILDTARGET="$(WORKDIR)/Module/$(1) $(WORKDIR)/Module/check/$(1) $(WORKDIR)/Module/slowcheck/$(1)" && \
, \
cd $(1) && unset MAKEFLAGS && \
) \
2012-10-27 12:05:33 -05:00
$(SOLARENV)/bin/build.pl -P$(PARALLELISM) --all -- -P$(PARALLELISM)
2012-05-15 07:47:37 -05:00
2012-11-29 06:34:24 -06:00
$(1).build $(1).check $(1).clean:
cd $(1) && $(GNUMAKE) -j $(PARALLELISM) $(GMAKE_OPTIONS) $$(patsubst $(1).%,%,$$@) gb_PARTIALBUILD=T
2012-05-15 07:47:37 -05:00
$(1).subsequentcheck:
2012-08-28 00:00:18 -05:00
cd $(1) && $(GNUMAKE) -j $(CHECK_PARALLELISM) $(GMAKE_OPTIONS) subsequentcheck gb_PARTIALBUILD=T
2012-05-15 07:47:37 -05:00
$(1).deliver:
@true
endef
define gbuild_modules_rules
$(foreach m,$(1),$(call gbuild_module_rules,$(m)))
endef
define dmake_module_rules
.PHONY: $(1) $(1).all $(1).deliver $(1).clean
$(1): bootstrap fetch
cd $(1) && unset MAKEFLAGS && \
2012-10-27 12:05:33 -05:00
$(SOLARENV)/bin/build.pl -P$(PARALLELISM) -- -P$(PARALLELISM)
2012-05-15 07:47:37 -05:00
$(1).all: bootstrap fetch
cd $(1) && unset MAKEFLAGS && \
2012-10-27 12:05:33 -05:00
$(SOLARENV)/bin/build.pl -P$(PARALLELISM) --all -- -P$(PARALLELISM)
2012-05-15 07:47:37 -05:00
$(1).deliver: $(1)
cd $(1) && $(SOLARENV)/bin/deliver.pl
$(1).clean:
cd $(1) && $(SOLARENV)/bin/deliver.pl -delete
rm -fr $(1)/$(INPATH)
endef
define dmake_modules_rules
$(foreach m,$(1),$(call dmake_module_rules,$(m)))
endef
#
# Partial Build
#
$(eval $(call gbuild_modules_rules,$(gbuild_modules)))
$(eval $(call dmake_modules_rules,$(dmake_modules)))
2012-08-24 04:55:28 -05:00
# run a JunitTest - relies on naming convention (module prefix)
$(WORKDIR)/JunitTest/%/done :
cd $(firstword $(subst _, ,$*)) && $(GNUMAKE) $(GMAKE_OPTIONS) $@ gb_PARTIALBUILD=T
# run a CppunitTest - relies on naming convention (module prefix)
$(WORKDIR)/CppunitTest/%.test :
cd $(firstword $(subst _, ,$*)) && $(GNUMAKE) $(GMAKE_OPTIONS) $@ gb_PARTIALBUILD=T
2012-05-15 07:47:37 -05:00
#
# Clean
#
clean: clean-host clean-build
clean-host:
2012-07-31 08:43:28 -05:00
ifeq ($(BUILD_DMAKE),YES)
2012-10-27 12:05:33 -05:00
if [ -f dmake/Makefile ] ; then $(GNUMAKE) -j $(PARALLELISM) -C dmake clean; fi
2012-07-31 08:43:28 -05:00
endif
2012-05-15 07:47:37 -05:00
rm -fr $(DEVINSTALLDIR)
2012-07-24 14:56:55 -05:00
rm -fr $(OUTDIR)
rm -fr $(WORKDIR)
2012-05-15 07:47:37 -05:00
rm -fr $(SRCDIR)/*/$(INPATH)
2012-09-15 08:47:11 -05:00
rm -fr $(SRCDIR)/solenv/$(OUTPATH)
2012-05-15 07:47:37 -05:00
rm -fr install
clean-build:
ifeq ($(CROSS_COMPILING),YES)
rm -rf $(SOLARVER)/$(INPATH_FOR_BUILD) # not necessarily below SRCDIR
rm -rf $(SRCDIR)/*/$(INPATH_FOR_BUILD)
endif
2012-10-05 11:17:13 -05:00
include $(SRCDIR)/compilerplugins/Makefile.mk
2012-05-15 07:47:37 -05:00
#
# Distclean
#
2012-10-05 11:17:13 -05:00
distclean : clean compilerplugins-clean
2012-05-15 07:47:37 -05:00
ifeq ($(BUILD_DMAKE),YES)
2012-10-27 12:05:33 -05:00
(if [ -f dmake/Makefile ] ; then $(GNUMAKE) -j $(PARALLELISM) -C dmake distclean; fi) && \
2012-05-15 07:47:37 -05:00
rm -f solenv/*/bin/dmake*
endif
rm -fr config_host.mk config_build.mk aclocal.m4 autom4te.cache \
2012-11-21 15:36:34 -06:00
config.log config.status configure \
2012-12-03 17:11:54 -06:00
config_host.mk.last config_host.mk.stamp warn
2012-05-15 07:47:37 -05:00
find $(SOLARENV)/gdb -name "*.pyc" -exec rm {} \;
#
# custom command
#
ifneq ( $(MAKECMDGOALS),cmd)
cmd:
echo "custom cmd" && ( $(cmd) )
endif
ifneq ($(filter-out clean distclean,$(MAKECMDGOALS)),)
#
# Fetch
#
2012-11-22 05:14:05 -06:00
ifneq ($(DO_FETCH_TARBALLS),NO)
2012-11-21 15:36:34 -06:00
include $(SRCDIR)/Makefile.fetch
2012-11-26 07:17:18 -06:00
fetch: download
fetch: get-submodules
2012-05-15 07:47:37 -05:00
2012-11-26 07:17:18 -06:00
ifneq (,$(wildcard .git))
get-submodules:
ifneq ($(foreach i,$(GIT_NEEDED_SUBMODULES),$(i)/.git),$(wildcard $(foreach i,$(GIT_NEEDED_SUBMODULES),$(i)/.git)))
ifeq (,$(GIT_LINK_SRC))
./g -f clone
else # space-saving clone from another local workdir
@echo "FIXME: GIT_LINK_SRC method is not yet implemented with submodules" 1>&2
2012-11-27 16:42:15 -06:00
true $(foreach i,$(GIT_NEEDED_SUBMODULES),\
&& rm -r $(i) && cp -R $(GIT_LINK_SRC)/$(i) $(i))
2012-11-26 07:17:18 -06:00
# bin/git-new-workdir $GIT_LINK_SRC/$i $i
git submodule update $(GIT_NEEDED_SUBMODULES)
endif
endif
else # these sources are from a tarball, so get the other source tarballs
gb_LO_VER := $(shell . $(SRCDIR)/sources.ver && echo $$lo_sources_ver)
$(if $(gb_LO_VER),,$(error Error while retrieving $$lo_sources_ver from $(SRCDIR)/sources.ver))
get-submodules: | download
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))))
$(foreach i,$(subst helpcontent2,help,$(GIT_NEEDED_SUBMODULES)),\
$(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))
$(SRCDIR)/bin/unpack-sources $(SRCDIR) $(foreach i,$(subst helpcontent2,help,$(GIT_NEEDED_SUBMODULES)),\
$(TARFILE_LOCATION)/libreoffice-$(i)-$(gb_LO_VER).tar.xz)
endif
endif
2012-05-15 07:47:37 -05:00
else
2012-11-26 07:17:18 -06:00
fetch:
2012-05-15 07:47:37 -05:00
@echo "Automatic fetching of external tarballs is disabled."
2012-11-26 07:17:18 -06:00
2012-05-15 07:47:37 -05:00
endif
#
# Bootstap
#
2012-10-11 11:09:42 -05:00
bootstrap: $(WORKDIR)/bootstrap compilerplugins
2012-05-15 07:47:37 -05:00
2012-10-31 17:48:49 -05:00
$(WORKDIR)/bootstrap:
2012-05-15 07:47:37 -05:00
@cd $(SRCDIR) && ./bootstrap
@mkdir -p $(dir $@) && touch $@
#
# Build
#
build-packimages: bootstrap fetch $(if $(filter $(INPATH),$(INPATH_FOR_BUILD)),,cross-toolset)
ifeq ($(DISABLE_SCRIPTING),TRUE)
# We must get the headers from vbahelper "delivered" because
# as we don't link to any libs from there they won't otherwise be, or
# something. And we still do include those headers always even if the
# libs aren't built in the --disable-scripting case. (Ifdefs for
# DISABLE_SCRIPTING will be added to the code later as necessary.)
$(GNUMAKE) vbahelper
endif
ifeq ($(DISABLE_DBCONNECTIVITY),TRUE)
# Ditto for dbconnectivity in the --disable-database-connectivity case
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
endif
cd packimages && unset MAKEFLAGS && \
2012-10-27 12:05:33 -05:00
$(SOLARENV)/bin/build.pl -P$(PARALLELISM) --all -- -P$(PARALLELISM) && \
$(GNUMAKE) -j $(PARALLELISM) $(GMAKE_OPTIONS)
2012-05-15 07:47:37 -05:00
build: build-packimages
ifeq ($(OS_FOR_BUILD),WNT)
2012-07-22 09:26:29 -05:00
cd instsetoo_native && unset MAKEFLAGS && $(SOLARENV)/bin/build.pl
2012-05-15 07:47:37 -05:00
else
cd instsetoo_native && unset MAKEFLAGS && \
2012-10-27 12:05:33 -05:00
$(SOLARENV)/bin/build.pl -P$(PARALLELISM) -- -P$(PARALLELISM)
2012-05-15 07:47:37 -05:00
endif
2012-08-22 11:32:05 -05:00
ifeq ($(OS),ANDROID)
2012-10-27 12:05:33 -05:00
cd android && $(GNUMAKE) -j $(PARALLELISM) $(GMAKE_OPTIONS)
2012-08-22 11:32:05 -05:00
endif
2012-05-15 07:47:37 -05:00
2012-09-29 15:09:39 -05:00
build-nocheck : export SKIP_TESTS := YES
build-nocheck : build
2012-05-15 07:47:37 -05:00
cross-toolset: bootstrap fetch
2012-10-27 12:05:33 -05:00
cd cross_toolset && $(GNUMAKE) -j $(PARALLELISM) $(GMAKE_OPTIONS)
2012-10-14 15:35:54 -05:00
ifneq (,$(filter DESKTOP,$(BUILD_TYPE)))
ifneq (WNT,$(OS))
# We need to build nss for nsinstall... See NSINSTALL=... in nss/makefile.mk
$(GNUMAKE) gb_Side=build nss
endif
endif
2012-05-15 07:47:37 -05:00
#
# Install
#
install:
echo "Installing in $(INSTALLDIR)..." && \
ooinstall "$(INSTALLDIR)" && \
echo "" && \
echo "Installation finished, you can now execute:" && \
echo "$(INSTALLDIR)/program/soffice"
install-strip:
echo "Installing and stripping binaries in $(INSTALLDIR)..." && \
ooinstall --strip "$(INSTALLDIR)" && \
echo "" && \
echo "Installation finished, you can now execute:" && \
echo "$(INSTALLDIR)/program/soffice"
dev-install: build
@rm -rf $(DEVINSTALLDIR)
@mkdir $(DEVINSTALLDIR)
2012-07-15 15:58:52 -05:00
ifeq ($(OS_FOR_BUILD),WNT)
2012-08-16 07:44:37 -05:00
cd instsetoo_native && unset MAKEFLAGS && $(SOLARENV)/bin/build.pl LIBO_DEV_INSTALL=TRUE
unzip -q -d "$(DEVINSTALLDIR)" "$(SRCDIR)/instsetoo_native/$(INPATH)/LibreOffice/archive/install/en-US/LibO*_install-arc_en-US.zip"
2012-07-15 15:58:52 -05:00
mv "$(DEVINSTALLDIR)"/LibO*_install-arc_en-US/* "$(DEVINSTALLDIR)"/opt
else
2012-05-15 07:47:37 -05:00
ifeq ($(DISABLE_LINKOO),TRUE)
@ooinstall $(DEVINSTALLDIR)/opt
@install-gdb-printers -L
else
@ooinstall -l $(DEVINSTALLDIR)/opt
2012-07-15 15:58:52 -05:00
endif
2012-05-15 07:47:37 -05:00
endif
@rm -f $(SRCDIR)/install && ln -s $(DEVINSTALLDIR)/opt/ $(SRCDIR)/install
2012-09-29 15:09:39 -05:00
dev-install-nocheck : export SKIP_TESTS := YES
dev-install-nocheck : dev-install
2012-10-29 11:38:44 -05:00
dev-update:
ifeq ($(DISABLE_LINKOO),TRUE)
@linkoo --copy $(DEVINSTALLDIR)/opt $(SRCDIR)
else
@linkoo $(DEVINSTALLDIR)/opt $(SRCDIR)
endif
2012-07-21 14:22:44 -05:00
install-tb:
@rm -rf $(DEVINSTALLDIR)
@mkdir $(DEVINSTALLDIR)
ifeq ($(OS_FOR_BUILD),WNT)
2012-08-16 07:44:37 -05:00
cd instsetoo_native && unset MAKEFLAGS && $(SOLARENV)/bin/build.pl LIBO_DEV_INSTALL=TRUE
unzip -q -d "$(DEVINSTALLDIR)" "$(SRCDIR)/instsetoo_native/$(INPATH)/LibreOffice/archive/install/en-US/LibO*_install-arc_en-US.zip"
2012-07-21 14:22:44 -05:00
mv "$(DEVINSTALLDIR)"/LibO*_install-arc_en-US/* "$(DEVINSTALLDIR)"/opt
else
@ooinstall $(DEVINSTALLDIR)/opt
2012-07-21 19:08:03 -05:00
@install-gdb-printers
2012-07-21 14:22:44 -05:00
endif
@rm -f $(SRCDIR)/install && ln -s $(DEVINSTALLDIR)/opt/ $(SRCDIR)/install
2012-05-15 07:47:37 -05:00
distro-pack-install: install
$(SRCDIR)/bin/distro-install-clean-up
$(SRCDIR)/bin/distro-install-desktop-integration
$(SRCDIR)/bin/distro-install-sdk
$(SRCDIR)/bin/distro-install-file-lists
id:
@create-ids
tags:
@create-tags
docs:
@mkdocs.sh $(SRCDIR)/docs $(SOLARENV)/inc/doxygen.cfg
findunusedcode:
@which callcatcher > /dev/null 2>&1 || \
(echo "callcatcher not installed" && false)
@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
2012-06-09 08:14:29 -05:00
@echo unexport ARCH_FLAGS >> $(SRCDIR)/config_host_callcatcher.mk
@echo unexport CFLAGS >> $(SRCDIR)/config_host_callcatcher.mk
@echo unexport CXXFLAGS >> $(SRCDIR)/config_host_callcatcher.mk
2012-05-15 07:47:37 -05:00
@mkdir -p $(SRCDIR)/solenv/callcatcher/bin && \
ln -sf $(SRCDIR)/solenv/$(INPATH)/bin/dmake \
$(SRCDIR)/solenv/callcatcher/bin/dmake
@$(GNUMAKE) -f $(SOLARENV)/bin/callcatcher.Makefile findunusedcode
@grep ::.*\( unusedcode.all \
| grep -v ^Atom \
2012-06-10 02:43:28 -05:00
| grep -v ^atom:: \
2012-05-15 07:47:37 -05:00
| grep -v ^boost:: \
| grep -v ^CIcc \
| grep -v ^CLuceneError:: \
| grep -v ^cppu:: \
| grep -v ^Dde \
| grep -v ^graphite2:: \
| grep -v ^jvmaccess:: \
| grep -v ^libcdr:: \
| grep -v ^libcmis:: \
2012-05-24 04:59:16 -05:00
| grep -v ^libmspub:: \
2012-05-15 07:47:37 -05:00
| grep -v ^libvisio:: \
| grep -v ^libwpg:: \
| grep -v ^libwps_tools_win:: \
| grep -v ^lucene:: \
| grep -v ^Matrix3d:: \
2012-11-14 03:27:04 -06:00
| grep -v ^RelatedMultipart:: \
2012-05-15 07:47:37 -05:00
| grep -v ^salhelper:: \
2012-06-23 16:40:33 -05:00
| grep -v ^VSDInternalStream:: \
2012-05-15 07:47:37 -05:00
| grep -v ^WP1 \
| grep -v ^WP3 \
| grep -v ^WP42 \
| grep -v ^WP6 \
| grep -v ^WPG \
| grep -v ^WPS \
| grep -v WPX \
2012-09-24 02:51:47 -05:00
| grep -v ^WSObject \
2012-05-15 07:47:37 -05:00
> unusedcode.easy
check: dev-install subsequentcheck
subsequentcheck :| $(if $(filter-out subsequentcheck,$(MAKECMDGOALS)),dev-install)
2012-10-27 12:05:33 -05:00
$(GNUMAKE) -j $(CHECK_PARALLELISM) $(GMAKE_OPTIONS) -f Makefile.post $@
2012-05-15 07:47:37 -05:00
2012-11-29 06:34:24 -06:00
unitcheck slowcheck debugrun:
2012-10-27 12:05:33 -05:00
$(GNUMAKE) -j $(PARALLELISM) $(GMAKE_OPTIONS) -f Makefile.post $@
2012-05-15 07:47:37 -05:00
endif # not clean or distclean
# vim: set noet sw=4 ts=4: