17871dc3eSAndrew Rist#************************************************************** 27871dc3eSAndrew Rist# 37871dc3eSAndrew Rist# Licensed to the Apache Software Foundation (ASF) under one 47871dc3eSAndrew Rist# or more contributor license agreements. See the NOTICE file 57871dc3eSAndrew Rist# distributed with this work for additional information 67871dc3eSAndrew Rist# regarding copyright ownership. The ASF licenses this file 77871dc3eSAndrew Rist# to you under the Apache License, Version 2.0 (the 87871dc3eSAndrew Rist# "License"); you may not use this file except in compliance 97871dc3eSAndrew Rist# with the License. You may obtain a copy of the License at 107871dc3eSAndrew Rist# 117871dc3eSAndrew Rist# http://www.apache.org/licenses/LICENSE-2.0 127871dc3eSAndrew Rist# 137871dc3eSAndrew Rist# Unless required by applicable law or agreed to in writing, 147871dc3eSAndrew Rist# software distributed under the License is distributed on an 157871dc3eSAndrew Rist# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 167871dc3eSAndrew Rist# KIND, either express or implied. See the License for the 177871dc3eSAndrew Rist# specific language governing permissions and limitations 187871dc3eSAndrew Rist# under the License. 197871dc3eSAndrew Rist# 207871dc3eSAndrew Rist#************************************************************** 217871dc3eSAndrew Rist 227871dc3eSAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweirgb_CustomTarget_REPOSITORYNAMES := $(gb_Helper_REPOSITORYNAMES) 25cdf0e10cSrcweir 26cdf0e10cSrcweir# N.B.: putting the "+" there at the start activates the GNU make job server 27cdf0e10cSrcweirdefine gb_CustomTarget__command 28cdf0e10cSrcweir+$(call gb_Helper_abbreviate_dirs,\ 29cdf0e10cSrcweir mkdir -p $(call gb_CustomTarget_get_workdir,$(2)) && \ 30cdf0e10cSrcweir $(MAKE) -C $(call gb_CustomTarget_get_workdir,$(2)) -f $< && \ 31cdf0e10cSrcweir touch $(1)) 32cdf0e10cSrcweir 33cdf0e10cSrcweirendef 34cdf0e10cSrcweir 35*b63233d8Sdamjan$(call gb_CustomTarget_get_target,%) : 36*b63233d8Sdamjan $(call gb_Output_announce,$*,$(true),MAK,3) 37*b63233d8Sdamjan $(call gb_CustomTarget__command,$@,$*) 38cdf0e10cSrcweir 39cdf0e10cSrcweir.PHONY: $(call gb_CustomTarget_get_clean_target,%) 40cdf0e10cSrcweir$(call gb_CustomTarget_get_clean_target,%) : 41cdf0e10cSrcweir $(call gb_Output_announce,$*,$(false),MAK,3) 42cdf0e10cSrcweir $(call gb_Helper_abbreviate_dirs,\ 43cdf0e10cSrcweir rm -rf $(call gb_CustomTarget_get_workdir,$*) && \ 44*b63233d8Sdamjan rm -f $(call gb_CustomTarget_get_target,$*)) 45cdf0e10cSrcweir 46cdf0e10cSrcweirdefine gb_CustomTarget__get_makefile 47cdf0e10cSrcweir$(1)/$(2)/Makefile 48cdf0e10cSrcweirendef 49cdf0e10cSrcweir 50cdf0e10cSrcweirdefine gb_CustomTarget_CustomTarget 51*b63233d8Sdamjan$(if $(filter $(2),$(gb_CustomTarget_REPOSITORYNAMES)),,\ 52*b63233d8Sdamjan $(error CustomTarget: no or invalid repository given; known repositories: \ 53*b63233d8Sdamjan $(gb_JavaClassSet_REPOSITORYNAMES))) 54*b63233d8Sdamjangb_CustomTarget_REPO_$(1) := $(2) 55*b63233d8Sdamjan$(call gb_CustomTarget_get_target,$(1)) : \ 56*b63233d8Sdamjan $(call gb_CustomTarget__get_makefile,$($(2)),$(1)) 57*b63233d8Sdamjan$(call gb_CustomTarget_get_workdir,$(1))/% : \ 58*b63233d8Sdamjan $(call gb_CustomTarget_get_target,$(1)) 59cdf0e10cSrcweirendef 60cdf0e10cSrcweir 61cdf0e10cSrcweir 62cdf0e10cSrcweirdefine gb_CustomTarget_add_dependency 63*b63233d8Sdamjan$(eval $(call gb_CustomTarget_get_target,$(1)) : \ 64*b63233d8Sdamjan $($(gb_CustomTarget_REPO_$(1)))/$(2)) 65cdf0e10cSrcweirendef 66cdf0e10cSrcweir 67cdf0e10cSrcweirdefine gb_CustomTarget_add_dependencies 68cdf0e10cSrcweir$(foreach dependency,$(2),$(call gb_CustomTarget_add_dependency,$(1),$(dependency))) 69cdf0e10cSrcweirendef 70cdf0e10cSrcweir 71cdf0e10cSrcweirdefine gb_CustomTarget_add_outdir_dependency 72*b63233d8Sdamjan$(eval $(call gb_CustomTarget_get_target,$(1)) : $(2)) 73cdf0e10cSrcweirendef 74cdf0e10cSrcweir 75cdf0e10cSrcweirdefine gb_CustomTarget_add_outdir_dependencies 76cdf0e10cSrcweir$(foreach dependency,$(2),$(call gb_CustomTarget_add_outdir_dependency,$(1),$(dependency))) 77cdf0e10cSrcweir 78cdf0e10cSrcweirendef 79cdf0e10cSrcweir 80cdf0e10cSrcweir# vim: set noet sw=4 ts=4: 81