xref: /aoo42x/main/solenv/gbuild/CustomTarget.mk (revision cdf0e10c)
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*cdf0e10cSrcweirgb_CustomTarget_REPOSITORYNAMES := $(gb_Helper_REPOSITORYNAMES)
29*cdf0e10cSrcweir
30*cdf0e10cSrcweir# N.B.: putting the "+" there at the start activates the GNU make job server
31*cdf0e10cSrcweirdefine gb_CustomTarget__command
32*cdf0e10cSrcweir+$(call gb_Helper_abbreviate_dirs,\
33*cdf0e10cSrcweir	mkdir -p $(call gb_CustomTarget_get_workdir,$(2)) && \
34*cdf0e10cSrcweir	$(MAKE) -C $(call gb_CustomTarget_get_workdir,$(2)) -f $< && \
35*cdf0e10cSrcweir	touch $(1))
36*cdf0e10cSrcweir
37*cdf0e10cSrcweirendef
38*cdf0e10cSrcweir
39*cdf0e10cSrcweirdefine gb_CustomTarget__rules
40*cdf0e10cSrcweir$$(call gb_CustomTarget_get_repo_target,$(1),%) :
41*cdf0e10cSrcweir	$$(call gb_Output_announce,$$*,$$(true),MAK,3)
42*cdf0e10cSrcweir	$$(call gb_CustomTarget__command,$$@,$$*)
43*cdf0e10cSrcweir
44*cdf0e10cSrcweir$$(call gb_CustomTarget_get_target,%) : $$(call gb_CustomTarget_get_repo_target,$(1),%)
45*cdf0e10cSrcweir	$$(call gb_Helper_abbreviate_dirs,\
46*cdf0e10cSrcweir		touch $$@)
47*cdf0e10cSrcweir
48*cdf0e10cSrcweirendef
49*cdf0e10cSrcweir
50*cdf0e10cSrcweir.PHONY: $(call gb_CustomTarget_get_clean_target,%)
51*cdf0e10cSrcweir$(call gb_CustomTarget_get_clean_target,%) :
52*cdf0e10cSrcweir	$(call gb_Output_announce,$*,$(false),MAK,3)
53*cdf0e10cSrcweir	$(call gb_Helper_abbreviate_dirs,\
54*cdf0e10cSrcweir		rm -rf $(call gb_CustomTarget_get_workdir,$*) && \
55*cdf0e10cSrcweir		rm -f $(call gb_CustomTarget_get_target,$*) \
56*cdf0e10cSrcweir			$(foreach reponame,$(gb_CustomTarget_REPOSITORYNAMES),$(call gb_CustomTarget_get_repo_target,$(reponame),$*)))
57*cdf0e10cSrcweir
58*cdf0e10cSrcweir
59*cdf0e10cSrcweir$(foreach reponame,$(gb_CustomTarget_REPOSITORYNAMES),$(eval $(call gb_CustomTarget__rules,$(reponame))))
60*cdf0e10cSrcweir
61*cdf0e10cSrcweirdefine gb_CustomTarget__get_makefile
62*cdf0e10cSrcweir$(1)/$(2)/Makefile
63*cdf0e10cSrcweirendef
64*cdf0e10cSrcweir
65*cdf0e10cSrcweirdefine gb_CustomTarget_CustomTarget
66*cdf0e10cSrcweir$(foreach reponame,$(gb_CustomTarget_REPOSITORYNAMES),\
67*cdf0e10cSrcweir	$(eval $(call gb_CustomTarget_get_repo_target,$(reponame),$(1)) : $(call gb_CustomTarget__get_makefile,$($(reponame)),$(1))))
68*cdf0e10cSrcweir
69*cdf0e10cSrcweir$(call gb_CustomTarget_get_workdir,$(1))/% : $(call gb_CustomTarget_get_target,$(1))
70*cdf0e10cSrcweir
71*cdf0e10cSrcweirendef
72*cdf0e10cSrcweir
73*cdf0e10cSrcweir
74*cdf0e10cSrcweirdefine gb_CustomTarget_add_dependency
75*cdf0e10cSrcweir$(foreach reponame,$(gb_CustomTarget_REPOSITORYNAMES),\
76*cdf0e10cSrcweir	$(eval $(call gb_CustomTarget_get_repo_target,$(reponame),$(1)) : $($(reponame))/$(2)))
77*cdf0e10cSrcweir
78*cdf0e10cSrcweirendef
79*cdf0e10cSrcweir
80*cdf0e10cSrcweirdefine gb_CustomTarget_add_dependencies
81*cdf0e10cSrcweir$(foreach dependency,$(2),$(call gb_CustomTarget_add_dependency,$(1),$(dependency)))
82*cdf0e10cSrcweir
83*cdf0e10cSrcweirendef
84*cdf0e10cSrcweir
85*cdf0e10cSrcweirdefine gb_CustomTarget_add_outdir_dependency
86*cdf0e10cSrcweir$(foreach reponame,$(gb_CustomTarget_REPOSITORYNAMES),\
87*cdf0e10cSrcweir	$(eval $(call gb_CustomTarget_get_repo_target,$(reponame),$(1)) : $(2)))
88*cdf0e10cSrcweir
89*cdf0e10cSrcweirendef
90*cdf0e10cSrcweir
91*cdf0e10cSrcweirdefine gb_CustomTarget_add_outdir_dependencies
92*cdf0e10cSrcweir$(foreach dependency,$(2),$(call gb_CustomTarget_add_outdir_dependency,$(1),$(dependency)))
93*cdf0e10cSrcweir
94*cdf0e10cSrcweirendef
95*cdf0e10cSrcweir
96*cdf0e10cSrcweir# vim: set noet sw=4 ts=4:
97