1*cdf0e10cSrcweir#*************************************************************************
2*cdf0e10cSrcweir#
3*cdf0e10cSrcweir# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir#
5*cdf0e10cSrcweir# Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir#
7*cdf0e10cSrcweir# OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir#
9*cdf0e10cSrcweir# This file is part of OpenOffice.org.
10*cdf0e10cSrcweir#
11*cdf0e10cSrcweir# OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir# it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir# only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir#
15*cdf0e10cSrcweir# OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir# but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir# GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir# (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir#
21*cdf0e10cSrcweir# You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir# version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir# <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir# for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir#
26*cdf0e10cSrcweir#*************************************************************************
27*cdf0e10cSrcweir
28*cdf0e10cSrcweir.PHONY : setuplocal removelocal
29*cdf0e10cSrcweirifneq ($(gb_LOCALBUILDDIR),)
30*cdf0e10cSrcweirifneq ($(wildcard $(gb_LOCALBUILDDIR)/SetupLocal.mk),)
31*cdf0e10cSrcweirsetuplocal :
32*cdf0e10cSrcweir	$(eval $(call gb_Output_error,$(gb_LOCALBUILDDIR) exists already.))
33*cdf0e10cSrcweir
34*cdf0e10cSrcweirelse
35*cdf0e10cSrcweir
36*cdf0e10cSrcweirsetuplocal :
37*cdf0e10cSrcweir	$(eval MODULE := $(firstword $(MODULE) $(lastword $(subst /, ,$(dir $(realpath $(firstword $(MAKEFILE_LIST))))))))
38*cdf0e10cSrcweir	$(eval modulerepo := $(patsubst %/$(MODULE),%,$(foreach repo,$(gb_REPOS),$(wildcard $(repo)/$(MODULE)))))
39*cdf0e10cSrcweir	$(eval $(call gb_Output_announce,setting up local build directory (module: $(MODULE)).,$(true),SYC,5))
40*cdf0e10cSrcweir	mkdir -p $(gb_LOCALBUILDDIR)/srcdir $(gb_LOCALBUILDDIR)/workdir $(gb_LOCALBUILDDIR)/outdir
41*cdf0e10cSrcweir	rsync --archive --exclude 'workdir/**' $(SOLARVERSION)/$(INPATH)/ $(gb_LOCALBUILDDIR)/outdir
42*cdf0e10cSrcweir	cp $(modulerepo)/Repository.mk $(gb_LOCALBUILDDIR)/srcdir/Repository.mk
43*cdf0e10cSrcweir	cp $(modulerepo)/RepositoryFixes.mk $(gb_LOCALBUILDDIR)/srcdir/RepositoryFixes.mk
44*cdf0e10cSrcweir	rsync --archive $(modulerepo)/$(MODULE)/ $(gb_LOCALBUILDDIR)/srcdir/$(MODULE)
45*cdf0e10cSrcweir	echo "gb_REPOS := $(gb_LOCALBUILDDIR)/srcdir $(filter-out $(patsubst %/$(MODULE),%,$(foreach repo,$(gb_REPOS),$(wildcard $(repo)/$(MODULE)))),$(gb_REPOS))" > $(gb_LOCALBUILDDIR)/SetupLocal.mk
46*cdf0e10cSrcweir	echo "#original gb_REPOS was $(gb_REPOS)" >> $(gb_LOCALBUILDDIR)/SetupLocal.mk
47*cdf0e10cSrcweir	echo "OUTDIR := $(gb_LOCALBUILDDIR)/outdir" >> $(gb_LOCALBUILDDIR)/SetupLocal.mk
48*cdf0e10cSrcweir	echo "#original OUTDIR was $(OUTDIR)" >> $(gb_LOCALBUILDDIR)/SetupLocal.mk
49*cdf0e10cSrcweir	echo "WORKDIR := $(gb_LOCALBUILDDIR)/workdir" >> $(gb_LOCALBUILDDIR)/SetupLocal.mk
50*cdf0e10cSrcweir	echo "#original WORKDIR was $(WORKDIR)" >> $(gb_LOCALBUILDDIR)/SetupLocal.mk
51*cdf0e10cSrcweir
52*cdf0e10cSrcweirendif
53*cdf0e10cSrcweir
54*cdf0e10cSrcweirremovelocal :
55*cdf0e10cSrcweir	$(eval $(call gb_Output_warn,removing directory $(gb_LOCALBUILDDIR).,SYC))
56*cdf0e10cSrcweir	sleep 10
57*cdf0e10cSrcweir	rm -rf $(gb_LOCALBUILDDIR)
58*cdf0e10cSrcweir
59*cdf0e10cSrcweirelse
60*cdf0e10cSrcweirsetuplocal:
61*cdf0e10cSrcweir	$(eval $(call gb_Output_error,setuplocal: gb_LOCALBUILDDIR is not set.))
62*cdf0e10cSrcweir
63*cdf0e10cSrcweirremovelocal:
64*cdf0e10cSrcweir	$(eval $(call gb_Output_error,setuplocal: gb_LOCALBUILDDIR is not set.))
65*cdf0e10cSrcweir
66*cdf0e10cSrcweirendif
67*cdf0e10cSrcweir
68*cdf0e10cSrcweir# vim: set noet sw=4 ts=4:
69