1*7871dc3eSAndrew Rist#************************************************************** 2*7871dc3eSAndrew Rist# 3*7871dc3eSAndrew Rist# Licensed to the Apache Software Foundation (ASF) under one 4*7871dc3eSAndrew Rist# or more contributor license agreements. See the NOTICE file 5*7871dc3eSAndrew Rist# distributed with this work for additional information 6*7871dc3eSAndrew Rist# regarding copyright ownership. The ASF licenses this file 7*7871dc3eSAndrew Rist# to you under the Apache License, Version 2.0 (the 8*7871dc3eSAndrew Rist# "License"); you may not use this file except in compliance 9*7871dc3eSAndrew Rist# with the License. You may obtain a copy of the License at 10*7871dc3eSAndrew Rist# 11*7871dc3eSAndrew Rist# http://www.apache.org/licenses/LICENSE-2.0 12*7871dc3eSAndrew Rist# 13*7871dc3eSAndrew Rist# Unless required by applicable law or agreed to in writing, 14*7871dc3eSAndrew Rist# software distributed under the License is distributed on an 15*7871dc3eSAndrew Rist# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*7871dc3eSAndrew Rist# KIND, either express or implied. See the License for the 17*7871dc3eSAndrew Rist# specific language governing permissions and limitations 18*7871dc3eSAndrew Rist# under the License. 19*7871dc3eSAndrew Rist# 20*7871dc3eSAndrew Rist#************************************************************** 21*7871dc3eSAndrew Rist 22*7871dc3eSAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir.PHONY : setuplocal removelocal 25cdf0e10cSrcweirifneq ($(gb_LOCALBUILDDIR),) 26cdf0e10cSrcweirifneq ($(wildcard $(gb_LOCALBUILDDIR)/SetupLocal.mk),) 27cdf0e10cSrcweirsetuplocal : 28cdf0e10cSrcweir $(eval $(call gb_Output_error,$(gb_LOCALBUILDDIR) exists already.)) 29cdf0e10cSrcweir 30cdf0e10cSrcweirelse 31cdf0e10cSrcweir 32cdf0e10cSrcweirsetuplocal : 33cdf0e10cSrcweir $(eval MODULE := $(firstword $(MODULE) $(lastword $(subst /, ,$(dir $(realpath $(firstword $(MAKEFILE_LIST)))))))) 34cdf0e10cSrcweir $(eval modulerepo := $(patsubst %/$(MODULE),%,$(foreach repo,$(gb_REPOS),$(wildcard $(repo)/$(MODULE))))) 35cdf0e10cSrcweir $(eval $(call gb_Output_announce,setting up local build directory (module: $(MODULE)).,$(true),SYC,5)) 36cdf0e10cSrcweir mkdir -p $(gb_LOCALBUILDDIR)/srcdir $(gb_LOCALBUILDDIR)/workdir $(gb_LOCALBUILDDIR)/outdir 37cdf0e10cSrcweir rsync --archive --exclude 'workdir/**' $(SOLARVERSION)/$(INPATH)/ $(gb_LOCALBUILDDIR)/outdir 38cdf0e10cSrcweir cp $(modulerepo)/Repository.mk $(gb_LOCALBUILDDIR)/srcdir/Repository.mk 39cdf0e10cSrcweir cp $(modulerepo)/RepositoryFixes.mk $(gb_LOCALBUILDDIR)/srcdir/RepositoryFixes.mk 40cdf0e10cSrcweir rsync --archive $(modulerepo)/$(MODULE)/ $(gb_LOCALBUILDDIR)/srcdir/$(MODULE) 41cdf0e10cSrcweir echo "gb_REPOS := $(gb_LOCALBUILDDIR)/srcdir $(filter-out $(patsubst %/$(MODULE),%,$(foreach repo,$(gb_REPOS),$(wildcard $(repo)/$(MODULE)))),$(gb_REPOS))" > $(gb_LOCALBUILDDIR)/SetupLocal.mk 42cdf0e10cSrcweir echo "#original gb_REPOS was $(gb_REPOS)" >> $(gb_LOCALBUILDDIR)/SetupLocal.mk 43cdf0e10cSrcweir echo "OUTDIR := $(gb_LOCALBUILDDIR)/outdir" >> $(gb_LOCALBUILDDIR)/SetupLocal.mk 44cdf0e10cSrcweir echo "#original OUTDIR was $(OUTDIR)" >> $(gb_LOCALBUILDDIR)/SetupLocal.mk 45cdf0e10cSrcweir echo "WORKDIR := $(gb_LOCALBUILDDIR)/workdir" >> $(gb_LOCALBUILDDIR)/SetupLocal.mk 46cdf0e10cSrcweir echo "#original WORKDIR was $(WORKDIR)" >> $(gb_LOCALBUILDDIR)/SetupLocal.mk 47cdf0e10cSrcweir 48cdf0e10cSrcweirendif 49cdf0e10cSrcweir 50cdf0e10cSrcweirremovelocal : 51cdf0e10cSrcweir $(eval $(call gb_Output_warn,removing directory $(gb_LOCALBUILDDIR).,SYC)) 52cdf0e10cSrcweir sleep 10 53cdf0e10cSrcweir rm -rf $(gb_LOCALBUILDDIR) 54cdf0e10cSrcweir 55cdf0e10cSrcweirelse 56cdf0e10cSrcweirsetuplocal: 57cdf0e10cSrcweir $(eval $(call gb_Output_error,setuplocal: gb_LOCALBUILDDIR is not set.)) 58cdf0e10cSrcweir 59cdf0e10cSrcweirremovelocal: 60cdf0e10cSrcweir $(eval $(call gb_Output_error,setuplocal: gb_LOCALBUILDDIR is not set.)) 61cdf0e10cSrcweir 62cdf0e10cSrcweirendif 63cdf0e10cSrcweir 64cdf0e10cSrcweir# vim: set noet sw=4 ts=4: 65