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 24# Ant class 25 26gb_Ant_ANTCOMMAND := $(ANT) 27 28# clean target 29$(call gb_Ant_get_clean_target,%) : 30 $(call gb_Output_announce,$*,$(false),ANT,3) 31 $(call gb_Helper_abbreviate_dirs,\ 32 rm -f $(call gb_Ant_get_target,$*) $(call gb_Jar_get_outdir_target,$*) && \ 33 $(gb_Ant_ANTCOMMAND) -f $(ANTBUILDFILE) clean) 34 35# the outdir target depends on the workdir target and is built by delivering the latter 36 37# rule for creating the jar file 38# creates the target folder of the jar file if it doesn't exist 39# creates the jar file 40$(call gb_Ant_get_target,%) : FORCE 41 $(call gb_Output_announce,$*,$(true),ANT,3) 42 $(call gb_Helper_abbreviate_dirs_native,\ 43 mkdir -p $(dir $@) && \ 44 $(gb_Ant_ANTCOMMAND) -f $(ANTBUILDFILE) ) 45 46FORCE: 47 48 49define gb_Ant_add_dependency 50$(1) : $(2) 51 52endef 53 54# registers target and clean target 55# adds jar files to DeliverLogTarget 56# adds dependency for outdir target to workdir target (pattern rule for delivery is in Package.mk) 57define gb_Ant_Ant 58ifeq ($(OS),WNT) 59$(call gb_Ant_get_target,$(1)) : ANTBUILDFILE := `cygpath -m $(2)` 60$(call gb_Ant_get_clean_target,$(1)) : ANTBUILDFILE := `cygpath -m $(2)` 61else 62$(call gb_Ant_get_target,$(1)) : ANTBUILDFILE := $(2) 63$(call gb_Ant_get_clean_target,$(1)) : ANTBUILDFILE := $(2) 64endif 65$(eval $(call gb_Module_register_target,$(call gb_Jar_get_outdir_target,$(1)),$(call gb_Ant_get_clean_target,$(1)))) 66$(call gb_Deliver_add_deliverable,$(call gb_Jar_get_outdir_target,$(1)),$(call gb_Ant_get_target,$(1)),$(1)) 67$(call gb_Jar_get_outdir_target,$(1)) : $(call gb_Ant_get_target,$(1)) 68 69__ant_out:=$(shell $(gb_Ant_ANTCOMMAND) -v -Ddependencies.outfile=$(WORKDIR)/Ant/$(1)/deps -f $(2) dependencies) 70$$(eval $(foreach dep,$(shell cat < $(WORKDIR)/Ant/$(1)/deps),$$(call gb_Ant_add_dependency,$(call gb_Ant_get_target,$(1)),$(dep)))) 71 72endef 73 74 75# possible directories for jar files containing UNO services 76gb_Ant_COMPONENTPREFIXES := \ 77 OOO:vnd.sun.star.expand:\dOOO_BASE_DIR/program/classes/ \ 78 URE:vnd.sun.star.expand:\dURE_INTERNAL_JAVA_DIR/ \ 79 INTERN:vnd.sun.star.expand:\dOOO_INBUILD_JAVA_DIR/ 80 81# get component prefix from layer name ("OOO", "URE", "INTERN") 82gb_Ant__get_componentprefix = \ 83 $(patsubst $(1):%,%,$(or \ 84 $(filter $(1):%,$(gb_Ant_COMPONENTPREFIXES)), \ 85 $(call gb_Output_error,no ComponentTarget native prefix for layer '$(1)'))) 86 87# layer must be specified explicitly in this macro (different to libraries) 88define gb_Ant_set_componentfile 89$(call gb_ComponentTarget_ComponentTarget,$(2),$(call gb_Ant__get_componentprefix,$(3)),$(notdir $(call gb_Ant_get_target,$(1)))) 90$(call gb_Ant_get_target,$(1)) : $(call gb_ComponentTarget_get_outdir_target,$(2)) 91$(call gb_Ant_get_clean_target,$(1)) : $(call gb_ComponentTarget_get_clean_target,$(2)) 92 93endef 94 95# vim: set noet sw=4 ts=4: 96