1#*************************************************************************
2#
3# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4#
5# Copyright 2000, 2010 Oracle and/or its affiliates.
6#
7# OpenOffice.org - a multi-platform office productivity suite
8#
9# This file is part of OpenOffice.org.
10#
11# OpenOffice.org is free software: you can redistribute it and/or modify
12# it under the terms of the GNU Lesser General Public License version 3
13# only, as published by the Free Software Foundation.
14#
15# OpenOffice.org is distributed in the hope that it will be useful,
16# but WITHOUT ANY WARRANTY; without even the implied warranty of
17# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18# GNU Lesser General Public License version 3 for more details
19# (a copy is included in the LICENSE file that accompanied this code).
20#
21# You should have received a copy of the GNU Lesser General Public License
22# version 3 along with OpenOffice.org.  If not, see
23# <http://www.openoffice.org/license.html>
24# for a copy of the LGPLv3 License.
25#
26#*************************************************************************
27
28gb_ComponentTarget_REPOS := $(gb_REPOS)
29
30gb_ComponentTarget_XSLTCOMMANDFILE := $(SOLARENV)/bin/createcomponent.xslt
31gb_ComponentTarget_get_source = $(1)/$(2).component
32
33define gb_ComponentTarget__command
34$(call gb_Output_announce,$(3),$(true),CMP,1)
35$(call gb_Helper_abbreviate_dirs_native,\
36	mkdir -p $(dir $(1)) && \
37	$(gb_XSLTPROC) --nonet --stringparam uri \
38    	'$(subst \d,$$,$(COMPONENTPREFIX))$(LIBFILENAME)' -o $(1) \
39		$(gb_ComponentTarget_XSLTCOMMANDFILE) $(2))
40
41endef
42
43define gb_ComponentTarget__rules
44$$(call gb_ComponentTarget_get_target,%) : $$(call gb_ComponentTarget_get_source,$(1),%) | $(gb_XSLTPROCTARGET)
45	$$(call gb_ComponentTarget__command,$$@,$$<,$$*)
46
47$$(call gb_ComponentTarget_get_clean_target,%) :
48	$$(call gb_Output_announce,$$*,$(false),CMP,1)
49	rm -f $$(call gb_ComponentTarget_get_outdir_target,$$*) $$(call gb_ComponentTarget_get_target,$$*)
50
51endef
52
53$(foreach repo,$(gb_ComponentTarget_REPOS),$(eval $(call gb_ComponentTarget__rules,$(repo))))
54
55$(call gb_ComponentTarget_get_target,%) :
56	$(eval $(call gb_Outpt_error,Unable to find component file $(call gb_ComponentTarget_get_source,,$*) in the repositories: $(gb_ComponentTarget_REPOS) or xlstproc is missing.))
57
58$(call gb_ComponentTarget_get_external_target,%) :
59	$(call gb_Deliver_deliver,$<,$@)
60
61define gb_ComponentTarget_ComponentTarget
62$(call gb_ComponentTarget_get_target,$(1)) : LIBFILENAME := $(3)
63$(call gb_ComponentTarget_get_target,$(1)) : COMPONENTPREFIX := $(2)
64$(call gb_ComponentTarget_get_outdir_target,$(1)) : $(call gb_ComponentTarget_get_target,$(1))
65$(call gb_Deliver_add_deliverable,$(call gb_ComponentTarget_get_outdir_target,$(1)),$(call gb_ComponentTarget_get_target,$(1)))
66
67endef
68
69# vim: set noet sw=4 ts=4:
70