1#**************************************************************
2#
3#  Licensed to the Apache Software Foundation (ASF) under one
4#  or more contributor license agreements.  See the NOTICE file
5#  distributed with this work for additional information
6#  regarding copyright ownership.  The ASF licenses this file
7#  to you under the Apache License, Version 2.0 (the
8#  "License"); you may not use this file except in compliance
9#  with the License.  You may obtain a copy of the License at
10#
11#    http://www.apache.org/licenses/LICENSE-2.0
12#
13#  Unless required by applicable law or agreed to in writing,
14#  software distributed under the License is distributed on an
15#  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16#  KIND, either express or implied.  See the License for the
17#  specific language governing permissions and limitations
18#  under the License.
19#
20#**************************************************************
21
22
23
24gb_ComponentTarget_REPOS := $(gb_REPOS)
25
26gb_ComponentTarget_XSLTCOMMANDFILE := $(SOLARENV)/bin/createcomponent.xslt
27gb_ComponentTarget_get_source = $(1)/$(2).component
28
29define gb_ComponentTarget__command
30$(call gb_Output_announce,$(3),$(true),CMP,1)
31$(call gb_Helper_abbreviate_dirs_native,\
32	mkdir -p $(dir $(1)) && \
33	$(gb_XSLTPROC) --nonet --stringparam uri \
34    	'$(subst \d,$$,$(COMPONENTPREFIX))$(LIBFILENAME)' -o $(1) \
35		$(gb_ComponentTarget_XSLTCOMMANDFILE) $(2))
36
37endef
38
39define gb_ComponentTarget__rules
40$$(call gb_ComponentTarget_get_target,%) : $$(call gb_ComponentTarget_get_source,$(1),%) | $(gb_XSLTPROCTARGET)
41	$$(call gb_ComponentTarget__command,$$@,$$<,$$*)
42
43$$(call gb_ComponentTarget_get_clean_target,%) :
44	$$(call gb_Output_announce,$$*,$(false),CMP,1)
45	rm -f $$(call gb_ComponentTarget_get_outdir_target,$$*) $$(call gb_ComponentTarget_get_target,$$*)
46
47endef
48
49$(foreach repo,$(gb_ComponentTarget_REPOS),$(eval $(call gb_ComponentTarget__rules,$(repo))))
50
51$(call gb_ComponentTarget_get_target,%) :
52	$(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.))
53
54$(call gb_ComponentTarget_get_external_target,%) :
55	$(call gb_Deliver_deliver,$<,$@)
56
57define gb_ComponentTarget_ComponentTarget
58$(call gb_ComponentTarget_get_target,$(1)) : LIBFILENAME := $(3)
59$(call gb_ComponentTarget_get_target,$(1)) : COMPONENTPREFIX := $(2)
60$(call gb_ComponentTarget_get_outdir_target,$(1)) : $(call gb_ComponentTarget_get_target,$(1))
61$(call gb_Deliver_add_deliverable,$(call gb_ComponentTarget_get_outdir_target,$(1)),$(call gb_ComponentTarget_get_target,$(1)))
62
63endef
64
65# vim: set noet sw=4 ts=4:
66