xref: /aoo42x/main/solenv/gbuild/Ant.mk (revision 41f03cd9)
1*41f03cd9SDamjan Jovanovic###############################################################
2*41f03cd9SDamjan Jovanovic#
3*41f03cd9SDamjan Jovanovic#  Licensed to the Apache Software Foundation (ASF) under one
4*41f03cd9SDamjan Jovanovic#  or more contributor license agreements.  See the NOTICE file
5*41f03cd9SDamjan Jovanovic#  distributed with this work for additional information
6*41f03cd9SDamjan Jovanovic#  regarding copyright ownership.  The ASF licenses this file
7*41f03cd9SDamjan Jovanovic#  to you under the Apache License, Version 2.0 (the
8*41f03cd9SDamjan Jovanovic#  "License"); you may not use this file except in compliance
9*41f03cd9SDamjan Jovanovic#  with the License.  You may obtain a copy of the License at
10*41f03cd9SDamjan Jovanovic#
11*41f03cd9SDamjan Jovanovic#    http://www.apache.org/licenses/LICENSE-2.0
12*41f03cd9SDamjan Jovanovic#
13*41f03cd9SDamjan Jovanovic#  Unless required by applicable law or agreed to in writing,
14*41f03cd9SDamjan Jovanovic#  software distributed under the License is distributed on an
15*41f03cd9SDamjan Jovanovic#  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*41f03cd9SDamjan Jovanovic#  KIND, either express or implied.  See the License for the
17*41f03cd9SDamjan Jovanovic#  specific language governing permissions and limitations
18*41f03cd9SDamjan Jovanovic#  under the License.
19*41f03cd9SDamjan Jovanovic#
20*41f03cd9SDamjan Jovanovic###############################################################
21*41f03cd9SDamjan Jovanovic
22*41f03cd9SDamjan Jovanovic
23*41f03cd9SDamjan Jovanovic
24*41f03cd9SDamjan Jovanovic# Ant class
25*41f03cd9SDamjan Jovanovic
26*41f03cd9SDamjan Jovanovicgb_Ant_ANTCOMMAND := $(ANT)
27*41f03cd9SDamjan Jovanovic
28*41f03cd9SDamjan Jovanovic# clean target
29*41f03cd9SDamjan Jovanovic$(call gb_Ant_get_clean_target,%) :
30*41f03cd9SDamjan Jovanovic	$(call gb_Output_announce,$*,$(false),ANT,3)
31*41f03cd9SDamjan Jovanovic	$(call gb_Helper_abbreviate_dirs,\
32*41f03cd9SDamjan Jovanovic		rm -f $(call gb_Ant_get_target,$*) $(call gb_Jar_get_outdir_target,$*) && \
33*41f03cd9SDamjan Jovanovic		$(gb_Ant_ANTCOMMAND) -f $(ANTBUILDFILE) clean)
34*41f03cd9SDamjan Jovanovic
35*41f03cd9SDamjan Jovanovic# the outdir target depends on the workdir target and is built by delivering the latter
36*41f03cd9SDamjan Jovanovic
37*41f03cd9SDamjan Jovanovic# rule for creating the jar file
38*41f03cd9SDamjan Jovanovic# creates the target folder of the jar file if it doesn't exist
39*41f03cd9SDamjan Jovanovic# creates the jar file
40*41f03cd9SDamjan Jovanovic$(call gb_Ant_get_target,%) : FORCE
41*41f03cd9SDamjan Jovanovic	$(call gb_Output_announce,$*,$(true),ANT,3)
42*41f03cd9SDamjan Jovanovic	$(call gb_Helper_abbreviate_dirs_native,\
43*41f03cd9SDamjan Jovanovic	mkdir -p $(dir $@) && \
44*41f03cd9SDamjan Jovanovic	$(gb_Ant_ANTCOMMAND) -f $(ANTBUILDFILE) )
45*41f03cd9SDamjan Jovanovic
46*41f03cd9SDamjan JovanovicFORCE:
47*41f03cd9SDamjan Jovanovic
48*41f03cd9SDamjan Jovanovic
49*41f03cd9SDamjan Jovanovic# registers target and clean target
50*41f03cd9SDamjan Jovanovic# adds jar files to DeliverLogTarget
51*41f03cd9SDamjan Jovanovic# adds dependency for outdir target to workdir target (pattern rule for delivery is in Package.mk)
52*41f03cd9SDamjan Jovanovicdefine gb_Ant_Ant
53*41f03cd9SDamjan Jovanovic$(call gb_Ant_get_target,$(1)) : ANTBUILDFILE := $(2)
54*41f03cd9SDamjan Jovanovic$(call gb_Ant_get_clean_target,$(1)) : ANTBUILDFILE := $(2)
55*41f03cd9SDamjan Jovanovic$(eval $(call gb_Module_register_target,$(call gb_Jar_get_outdir_target,$(1)),$(call gb_Ant_get_clean_target,$(1))))
56*41f03cd9SDamjan Jovanovic$(call gb_Deliver_add_deliverable,$(call gb_Jar_get_outdir_target,$(1)),$(call gb_Ant_get_target,$(1)),$(1))
57*41f03cd9SDamjan Jovanovic$(call gb_Jar_get_outdir_target,$(1)) : $(call gb_Ant_get_target,$(1))
58*41f03cd9SDamjan Jovanovic
59*41f03cd9SDamjan Jovanovicendef
60*41f03cd9SDamjan Jovanovic
61*41f03cd9SDamjan Jovanovic
62*41f03cd9SDamjan Jovanovic# possible directories for jar files containing UNO services
63*41f03cd9SDamjan Jovanovicgb_Ant_COMPONENTPREFIXES := \
64*41f03cd9SDamjan Jovanovic    OOO:vnd.sun.star.expand:\dOOO_BASE_DIR/program/classes/ \
65*41f03cd9SDamjan Jovanovic    URE:vnd.sun.star.expand:\dURE_INTERNAL_JAVA_DIR/ \
66*41f03cd9SDamjan Jovanovic    INTERN:vnd.sun.star.expand:\dOOO_INBUILD_JAVA_DIR/
67*41f03cd9SDamjan Jovanovic
68*41f03cd9SDamjan Jovanovic# get component prefix from layer name ("OOO", "URE", "INTERN")
69*41f03cd9SDamjan Jovanovicgb_Ant__get_componentprefix = \
70*41f03cd9SDamjan Jovanovic    $(patsubst $(1):%,%,$(or \
71*41f03cd9SDamjan Jovanovic        $(filter $(1):%,$(gb_Ant_COMPONENTPREFIXES)), \
72*41f03cd9SDamjan Jovanovic        $(call gb_Output_error,no ComponentTarget native prefix for layer '$(1)')))
73*41f03cd9SDamjan Jovanovic
74*41f03cd9SDamjan Jovanovic# layer must be specified explicitly in this macro (different to libraries)
75*41f03cd9SDamjan Jovanovicdefine gb_Ant_set_componentfile
76*41f03cd9SDamjan Jovanovic$(call gb_ComponentTarget_ComponentTarget,$(2),$(call gb_Ant__get_componentprefix,$(3)),$(notdir $(call gb_Ant_get_target,$(1))))
77*41f03cd9SDamjan Jovanovic$(call gb_Ant_get_target,$(1)) : $(call gb_ComponentTarget_get_outdir_target,$(2))
78*41f03cd9SDamjan Jovanovic$(call gb_Ant_get_clean_target,$(1)) : $(call gb_ComponentTarget_get_clean_target,$(2))
79*41f03cd9SDamjan Jovanovic
80*41f03cd9SDamjan Jovanovicendef
81*41f03cd9SDamjan Jovanovic
82*41f03cd9SDamjan Jovanovic# vim: set noet sw=4 ts=4:
83