2011-08-09 12:12:48 -05:00
# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
2012-05-15 07:47:37 -05:00
#
# Copyright 2012 LibreOffice contributors.
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
2012-01-24 15:48:30 -06:00
2012-12-23 12:27:28 -06:00
.PHONY : all bootstrap build check clean clean -build clean -host dev -install distclean distro -pack -install docs download fetch findunusedcode get -submodules help id install install -strip install -tb subsequentcheck tags
2012-01-26 16:29:26 -06:00
i f e q ( $( MAKECMDGOALS ) , )
MAKECMDGOALS := all
e n d i f
2012-01-24 15:48:30 -06:00
SHELL = /usr/bin/env bash
2012-12-23 12:27:28 -06:00
SRCDIR := @SRC_ROOT@
BUILDDIR := @BUILDDIR@
2012-01-24 15:48:30 -06:00
2012-12-23 13:36:29 -06:00
# Next 'if' means:
# If you want to make something more than help clean distclean,
# and make has not yet restarted itself..
# ..run autogen.sh if needed and force make to restart itself.
i f e q ( , $( MAKE_RESTARTS ) $( if $ ( filter help clean distclean ,$ ( MAKECMDGOALS ) ) ,T ) )
2012-03-06 16:43:07 -06:00
2012-12-23 12:27:28 -06:00
.PHONY : force -restart
Makefile : $( BUILDDIR ) /config_host .mk force -restart
@touch $@
2012-01-26 14:26:49 -06:00
2012-05-15 07:47:37 -05:00
# run configure in an environment not polluted by config_host.mk
2012-12-11 08:39:49 -06:00
$(BUILDDIR)/config_host.mk : \
2012-05-15 07:47:37 -05:00
$( SRCDIR) /config_host.mk.in \
2012-12-11 07:49:24 -06:00
$( SRCDIR) /Makefile.in \
2012-10-19 15:59:21 -05:00
$( SRCDIR) /configure.ac \
2012-12-11 08:39:49 -06:00
$( BUILDDIR) /autogen.lastrun
2012-12-11 07:49:24 -06:00
$( SRCDIR) /autogen.sh
2012-01-26 14:26:49 -06:00
2012-05-15 07:47:37 -05:00
# dummy rule in case autogen.lastrun does not exist
2012-12-11 08:39:49 -06:00
$(BUILDDIR)/autogen.lastrun :
2012-02-26 12:53:09 -06:00
@true
2012-12-23 12:27:28 -06:00
e l s e # MAKE_RESTARTS
all : build
i f e q ( $( gb_Side ) , )
gb_Side := host
e n d i f
i n c l u d e $( BUILDDIR ) / c o n f i g _ $( gb_Side ) . m k
SRCDIR := $( SRC_ROOT)
i f e q ( $( GMAKE_OPTIONS ) , )
i f e q ( $( verbose ) $( VERBOSE ) , )
export GMAKE_OPTIONS := -rs
e l s e
export GMAKE_OPTIONS := -r
e n d i f
e n d i f
# 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 postprocess/prj/build.lst, etc, recursively.
$(WORKDIR)/modules.mk : $( wildcard */Module_ *.mk ) $( wildcard */prj /dmake ) $( BUILDDIR ) /config_host .mk
mkdir -p $( dir $@ )
2013-01-03 09:16:50 -06:00
echo "gbuild_modules:= tail_build \\" > $@
2012-12-23 12:27:28 -06:00
for m in */Module_*.mk; do echo $$ m | sed -e 's/\/.*$$/ \\/' ; done >> $@
echo >> $@
echo -n "dmake_modules:= " >> $@
for m in */prj/dmake; do echo $$ m | sed -e 's/\/.*$$/ \\/' ; done >> $@
echo >> $@
- i n c l u d e $( WORKDIR ) / m o d u l e s . m k
i n c l u d e $( SRCDIR ) / s o l e n v / g b u i l d / O u t p u t . m k
$(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 ) ) )))
export gb_TAILBUILDTARGET = all slowcheck
d e f i n e g b u i l d _ m o d u l e _ r u l e s
.PHONY : $( 1) $( 1) .all $( 1) .build $( 1) .check $( 1) .clean $( 1) .subsequentcheck $( 1) .deliver
$(1) : bootstrap fetch
cd $( 1) && $( GNUMAKE) -j $( PARALLELISM) $( GMAKE_OPTIONS) gb_PARTIALBUILD = T
$(1).all : bootstrap fetch
$$ ( if $$ ( filter $( 1) ,$$ ( shell $( GNUMAKE) -r -f $( SRCDIR) /tail_build/Makefile showmodules) ) , \
cd $( SRC_ROOT) /tail_build && unset MAKEFLAGS && \
export gb_TAILBUILDTARGET = " $( WORKDIR) /Module/ $( 1) $( WORKDIR) /Module/check/ $( 1) $( WORKDIR) /Module/slowcheck/ $( 1) " && \
, \
cd $( SRC_ROOT) /$( 1) && unset MAKEFLAGS && \
) \
$( SOLARENV) /bin/build.pl -P$( PARALLELISM) --all -- -P$( PARALLELISM)
$(1).build $(1).check $(1).clean :
cd $( 1) && $( GNUMAKE) -j $( PARALLELISM) $( GMAKE_OPTIONS) $$ ( patsubst $( 1) .%,%,$$ @) gb_PARTIALBUILD = T
$(1).subsequentcheck :
cd $( 1) && $( GNUMAKE) -j $( CHECK_PARALLELISM) $( GMAKE_OPTIONS) subsequentcheck gb_PARTIALBUILD = T
$(1).deliver :
@true
e n d e f
d e f i n e g b u i l d _ m o d u l e s _ r u l e s
$( foreach m ,$ ( 1) ,$ ( call gbuild_module_rules ,$ ( m ) ) )
e n d e f
d e f i n e d m a k e _ m o d u l e _ r u l e s
.PHONY : $( 1) $( 1) .all $( 1) .deliver $( 1) .clean
$(1) : bootstrap fetch
cd $( SRC_ROOT) /$( 1) && unset MAKEFLAGS && \
$( SOLARENV) /bin/build.pl -P$( PARALLELISM) -- -P$( PARALLELISM)
$(1).all : bootstrap fetch
cd $( SRC_ROOT) /$( 1) && unset MAKEFLAGS && \
$( SOLARENV) /bin/build.pl -P$( PARALLELISM) --all -- -P$( PARALLELISM)
$(1).deliver : $( 1)
cd $( SRC_ROOT) /$( 1) && $( SOLARENV) /bin/deliver.pl
$(1).clean :
cd $( SRC_ROOT) /$( 1) && $( SOLARENV) /bin/deliver.pl -delete
rm -fr $( 1) /$( INPATH)
e n d e f
d e f i n e d m a k e _ m o d u l e s _ r u l e s
$( foreach m ,$ ( 1) ,$ ( call dmake_module_rules ,$ ( m ) ) )
e n d e f
#
# Partial Build
#
$( eval $ ( call gbuild_modules_rules ,$ ( gbuild_modules ) ) )
$( eval $ ( call dmake_modules_rules ,$ ( dmake_modules ) ) )
# 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
#
# Help
#
2012-07-26 08:49:10 -05:00
help :
@cat $( SRCDIR) /solenv/gbuild/gbuild.help.txt
2012-12-23 12:27:28 -06:00
#
# Clean
#
clean : clean -host clean -build
clean-host :
i f e q ( $( BUILD_DMAKE ) , Y E S )
if [ -f dmake/Makefile ] ; then $( GNUMAKE) -j $( PARALLELISM) -C dmake clean; fi
e n d i f
rm -fr $( DEVINSTALLDIR)
rm -fr $( OUTDIR)
rm -fr $( WORKDIR)
rm -fr $( SRCDIR) /*/$( INPATH)
rm -fr $( SRCDIR) /solenv/$( OUTPATH)
rm -fr install
clean-build :
i f e q ( $( CROSS_COMPILING ) , Y E S )
rm -rf $( SOLARVER) /$( INPATH_FOR_BUILD) # not necessarily below SRCDIR
rm -rf $( SRCDIR) /*/$( INPATH_FOR_BUILD)
e n d i f
i n c l u d e $( SRCDIR ) / c o m p i l e r p l u g i n s / M a k e f i l e . m k
#
# Distclean
#
distclean : clean compilerplugins -clean
i f e q ( $( BUILD_DMAKE ) , Y E S )
( if [ -f dmake/Makefile ] ; then $( GNUMAKE) -j $( PARALLELISM) -C dmake distclean; fi ) && \
rm -f solenv/*/bin/dmake*
e n d i f
rm -fr \
$( BUILDDIR) /Makefile \
$( BUILDDIR) /aclocal.m4 \
$( BUILDDIR) /autom4te.cache \
$( BUILDDIR) /config.log \
$( BUILDDIR) /config.status \
$( BUILDDIR) /config/*.h \
$( BUILDDIR) /config_build.mk \
$( BUILDDIR) /config_host.mk \
$( BUILDDIR) /config_host.mk.last \
$( BUILDDIR) /config_host.mk.stamp \
$( BUILDDIR) /configure \
$( BUILDDIR) /warn
find $( SOLARENV) /gdb -name "*.pyc" -exec rm { } \;
#
# custom command
#
i f n e q ( $( MAKECMDGOALS ) , c m d )
cmd :
echo "custom cmd" && ( $( cmd) )
e n d i f
2012-12-11 07:49:24 -06:00
2012-12-23 12:27:28 -06:00
i f n e q ( $( filter -out clean distclean ,$ ( MAKECMDGOALS ) ) , )
#
# Fetch
#
i f n e q ( $( DO_FETCH_TARBALLS ) , N O )
i n c l u d e $( SRCDIR ) / M a k e f i l e . f e t c h
fetch : download
fetch : get -submodules
i f n e q ( , $( wildcard $ ( SRCDIR ) /.git ) )
get-submodules :
i f n e q ( $( foreach i ,$ ( GIT_NEEDED_SUBMODULES ) ,$ ( i ) /.git ) , $( wildcard $ ( foreach i ,$ ( GIT_NEEDED_SUBMODULES ) ,$ ( i ) /.git ) ) )
i f e q ( , $( GIT_LINK_SRC ) )
cd $( SRCDIR) && ./g -f clone
e l s e # space-saving clone from another local workdir
@echo "FIXME: GIT_LINK_SRC method is not yet implemented with submodules" 1>& 2
true $( foreach i,$( GIT_NEEDED_SUBMODULES) ,\
&& rm -r $( i) && cp -R $( GIT_LINK_SRC) /$( i) $( i) )
# bin/git-new-workdir $GIT_LINK_SRC/$i $i
git submodule update $( GIT_NEEDED_SUBMODULES)
e n d i f
e n d i f
e l s e # 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
i f n e q ( $( foreach i ,$ ( subst helpcontent 2,help ,$ ( GIT_NEEDED_SUBMODULES ) ) ,$ ( SRCDIR ) /src /libreoffice -$ ( i ) -$ ( gb_LO_VER ) ) , $( wildcard $ ( foreach i ,$ ( subst helpcontent 2,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)
e n d i f
e n d i f
e l s e
fetch :
@echo "Automatic fetching of external tarballs is disabled."
e n d i f
#
# Bootstap
#
bootstrap : $( WORKDIR ) /bootstrap compilerplugins
$(WORKDIR)/bootstrap :
@cd $( SRCDIR) && ./bootstrap
@mkdir -p $( dir $@ ) && touch $@
#
# Build
#
build-postprocess : bootstrap fetch $( if $ ( filter $ ( INPATH ) ,$ ( INPATH_FOR_BUILD ) ) ,,cross -toolset )
i f e q ( $( DISABLE_SCRIPTING ) , T R U E )
# 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
e n d i f
i f e q ( $( DISABLE_DBCONNECTIVITY ) , T R U E )
# Ditto for dbconnectivity in the --disable-database-connectivity case
2012-12-24 16:39:09 -06:00
$( GNUMAKE) connectivity
2012-12-23 12:27:28 -06:00
e n d i f
cd $( SRC_ROOT) /postprocess && unset MAKEFLAGS && \
2012-12-26 15:38:49 -06:00
$( SOLARENV) /bin/build.pl -P$( PARALLELISM) --all -- -P$( PARALLELISM)
2012-12-23 12:27:28 -06:00
build : build -postprocess
i f e q ( $( OS_FOR_BUILD ) , W N T )
cd $( SRC_ROOT) /instsetoo_native && unset MAKEFLAGS && $( SOLARENV) /bin/build.pl
e l s e
cd $( SRC_ROOT) /instsetoo_native && unset MAKEFLAGS && \
$( SOLARENV) /bin/build.pl -P$( PARALLELISM) -- -P$( PARALLELISM)
e n d i f
i f e q ( $( OS ) , A N D R O I D )
cd android && $( GNUMAKE) -j $( PARALLELISM) $( GMAKE_OPTIONS)
e n d i f
2013-01-03 05:29:08 -06:00
i f e q ( $( OS ) , I O S )
cd ios && $( GNUMAKE) -j $( PARALLELISM) $( GMAKE_OPTIONS)
e n d i f
2012-12-23 12:27:28 -06:00
build-nocheck : export SKIP_TESTS := YES
build-nocheck : build
cross-toolset : bootstrap fetch
2012-12-27 11:23:04 -06:00
# We need to build icu for the build platform, as building icu for the host
# platform requires tools built as part of icu that can run on the build
# platform. see --with-cross-build in icu/ExternalProject_icu.mk
$( GNUMAKE) gb_Side = build icu
#
2012-12-23 12:27:28 -06:00
cd cross_toolset && $( GNUMAKE) -j $( PARALLELISM) $( GMAKE_OPTIONS)
2012-12-27 11:23:04 -06:00
#
2012-12-23 12:27:28 -06:00
i f n e q ( , $( filter DESKTOP ,$ ( BUILD_TYPE ) ) )
i f n e q ( W N T , $( OS ) )
# We need to build nss for nsinstall... See NSINSTALL=... in nss/makefile.mk
$( GNUMAKE) gb_Side = build nss
e n d i f
e n d i f
#
# 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)
i f e q ( $( OS_FOR_BUILD ) , W N T )
cd $( SRC_ROOT) /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 "
mv " $( DEVINSTALLDIR) " /LibO*_install-arc_en-US/* " $( DEVINSTALLDIR) " /opt
e l s e
i f e q ( $( DISABLE_LINKOO ) , T R U E )
@ooinstall $( DEVINSTALLDIR) /opt
@install-gdb-printers -L
e l s e
@ooinstall -l $( DEVINSTALLDIR) /opt
e n d i f
e n d i f
@rm -f $( SRCDIR) /install && ln -s $( DEVINSTALLDIR) /opt/ $( SRCDIR) /install
dev-install-nocheck : export SKIP_TESTS := YES
dev-install-nocheck : dev -install
dev-update :
i f e q ( $( DISABLE_LINKOO ) , T R U E )
@linkoo --copy $( DEVINSTALLDIR) /opt $( SRCDIR)
e l s e
@linkoo $( DEVINSTALLDIR) /opt $( SRCDIR)
e n d i f
install-tb :
@rm -rf $( DEVINSTALLDIR)
@mkdir $( DEVINSTALLDIR)
i f e q ( $( OS_FOR_BUILD ) , W N T )
cd $( SRC_ROOT) /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 "
mv " $( DEVINSTALLDIR) " /LibO*_install-arc_en-US/* " $( DEVINSTALLDIR) " /opt
e l s e
@ooinstall $( DEVINSTALLDIR) /opt
@install-gdb-printers
e n d i f
@rm -f $( SRCDIR) /install && ln -s $( DEVINSTALLDIR) /opt/ $( SRCDIR) /install
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 config_host.mk | sed -e s,"export OOO_JUNIT_JAR=.*" ,"export OOO_JUNIT_JAR=" ,g > $( SRCDIR) /config_host_callcatcher.mk
@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
@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 \
| grep -v ^atom:: \
| 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:: \
| grep -v ^libmspub:: \
| grep -v ^libvisio:: \
| grep -v ^libwpg:: \
| grep -v ^libwps_tools_win:: \
| grep -v ^lucene:: \
| grep -v ^Matrix3d:: \
| grep -v ^RelatedMultipart:: \
| grep -v ^salhelper:: \
| grep -v ^VSDInternalStream:: \
| grep -v ^WP1 \
| grep -v ^WP3 \
| grep -v ^WP42 \
| grep -v ^WP6 \
| grep -v ^WPG \
| grep -v ^WPS \
| grep -v WPX \
| grep -v ^WSObject \
> unusedcode.easy
check : dev -install subsequentcheck
subsequentcheck : | $( if $ ( filter -out subsequentcheck ,$ ( MAKECMDGOALS ) ) ,dev -install )
$( GNUMAKE) -j $( CHECK_PARALLELISM) $( GMAKE_OPTIONS) -f $( SRC_ROOT) /Makefile.post $@
unitcheck slowcheck debugrun :
$( GNUMAKE) -j $( PARALLELISM) $( GMAKE_OPTIONS) -f $( SRC_ROOT) /Makefile.post $@
e n d i f # not clean or distclean
e n d i f # MAKE_RESTARTS
# vim: set noet sw=4 ts=4: