bump product version to 4.2.0.1
[LibreOffice.git] / solenv / gbuild / CustomTarget.mk
blobe2dc2fdf622ab082efdd0763ea0293baef57580b
1 # -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
3 # This file is part of the LibreOffice project.
5 # This Source Code Form is subject to the terms of the Mozilla Public
6 # License, v. 2.0. If a copy of the MPL was not distributed with this
7 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 # This file incorporates work covered by the following license notice:
11 # Licensed to the Apache Software Foundation (ASF) under one or more
12 # contributor license agreements. See the NOTICE file distributed
13 # with this work for additional information regarding copyright
14 # ownership. The ASF licenses this file to you under the Apache
15 # License, Version 2.0 (the "License"); you may not use this file
16 # except in compliance with the License. You may obtain a copy of
17 # the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 # the .dir is for make 3.81, which ignores trailing /
21 $(call gb_CustomTarget_get_workdir,%)/.dir :
22 $(if $(wildcard $(dir $@)),,mkdir -p $(dir $@))
24 $(call gb_CustomTarget_get_target,%) :
25 $(call gb_Output_announce,$*,$(true),CUS,3)
26 touch $@
28 .PHONY: $(call gb_CustomTarget_get_clean_target,%)
29 $(call gb_CustomTarget_get_clean_target,%) :
30 $(call gb_Output_announce,$*,$(false),CUS,3)
31 $(call gb_Helper_abbreviate_dirs,\
32 rm -rf $(call gb_CustomTarget_get_workdir,$*) && \
33 rm -f $(call gb_CustomTarget_get_target,$*))
35 define gb_CustomTarget_CustomTarget
36 $(eval $(call gb_Module_register_target,$(call gb_CustomTarget_get_target,$(1)),$(call gb_CustomTarget_get_clean_target,$(1))))
37 $(call gb_Helper_make_userfriendly_targets,$(1),CustomTarget)
38 $(call gb_CustomTarget_get_target,$(1)) :| $(dir $(call gb_CustomTarget_get_target,$(1))).dir
40 endef
42 define gb_CustomTarget_register_target
43 $(call gb_CustomTarget_get_target,$(1)) : $(call gb_CustomTarget_get_workdir,$(1))/$(2)
44 $(call gb_CustomTarget_get_workdir,$(1))/$(2) :| $(dir $(call gb_CustomTarget_get_workdir,$(1))/$(2)).dir
46 endef
48 define gb_CustomTarget_register_targets
49 $(foreach target,$(2),$(call gb_CustomTarget_register_target,$(1),$(target)))
51 endef
53 ifneq ($(WITH_LANG),)
55 # $(call gb_CustomTarget_ulfex__command,ulftarget,ulfsource,pofiles)
56 define gb_CustomTarget_ulfex__command
57 $(call gb_Output_announce,$(1),$(true),ULF,1)
58 MERGEINPUT=`$(gb_MKTEMP)` && \
59 echo $(3) > $${MERGEINPUT} && \
60 $(call gb_Helper_abbreviate_dirs,\
61 $(call gb_Executable_get_command,ulfex) -i $(2) -o $(1) -m $${MERGEINPUT} -l all) && \
62 rm -rf $${MERGEINPUT}
63 endef
65 else
67 define gb_CustomTarget_ulfex__command
68 cp $(2) $(1)
69 endef
71 endif
73 # $(call gb_CustomTarget_ulfex_rule,ulftargetpattern,ulfsource,pofiles)
74 define gb_CustomTarget_ulfex_rule
75 $(1) : $(2) $(if $(WITH_LANG),$(call gb_Executable_get_runtime_dependencies,ulfex)) | $(dir $(1)).dir
76 $$(call gb_CustomTarget_ulfex__command,$$@,$(subst %,$$*,$(strip $(2))),$(strip $(3)))
78 endef
80 # vim: set noet sw=4: