Avoid potential negative array index access to cached text.
[LibreOffice.git] / solenv / gbuild / AllLangMoTarget.mk
blobec05985d5ecc6578348cf11cb17b5057398aa098
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 # Overview of dependencies and tasks of AllLangMoTarget
22 # target task depends on
23 # AllLangMoTarget nothing MoTarget for all active langs
24 # MoTarget running msgfmt
26 # MoTarget
28 $(call gb_MoTarget_get_clean_target,%) :
29 $(call gb_Output_announce,$*,$(false),RES,2)
30 $(call gb_Helper_abbreviate_dirs,\
31 rm -f \
32 $(call gb_MoTarget_get_target,$*) \
33 $(call gb_MoTarget_get_install_target,$*))
35 $(call gb_MoTarget_get_target,%) : $(gb_Helper_MISCDUMMY)
36 $(call gb_Output_announce,$*,$(true),MO ,2)
37 $(call gb_Trace_StartRange,$*,MO )
38 $(call gb_Helper_abbreviate_dirs,\
39 mkdir -p $(dir $@) && \
40 $(MSGUNIQ) --force-po $(gb_POLOCATION)/$(LANGUAGE)/$(POLOCATION)/messages.po | $(MSGFMT) - -o $@)
41 $(call gb_Trace_EndRange,$*,MO )
43 #$(info $(call gb_MoTarget_get_target,$(1)))
44 define gb_MoTarget_MoTarget
45 $(call gb_MoTarget_get_target,$(1)) : LIBRARY = $(2)
46 $(call gb_MoTarget_get_target,$(1)) : LANGUAGE = $(3)
47 $(call gb_MoTarget_get_target,$(1)) : POLOCATION = $(2)
48 $(call gb_AllLangMoTarget_get_clean_target,$(2)) : $(call gb_MoTarget_get_clean_target,$(1))
50 endef
52 define gb_MoTarget_set_polocation
53 $(call gb_MoTarget_get_target,$(1)) : POLOCATION = $(2)
55 endef
57 # AllLangMoTarget
59 gb_AllLangMoTarget_LANGS := $(filter-out qtz,$(filter-out en-US,$(gb_WITH_LANG)))
61 define gb_AllLangMoTarget_set_langs
62 gb_AllLangMoTarget_LANGS := $(1)
63 endef
65 $(call gb_AllLangMoTarget_get_clean_target,%) :
66 $(call gb_Helper_abbreviate_dirs,\
67 rm -f $(call gb_AllLangMoTarget_get_target,$*))
69 $(call gb_AllLangMoTarget_get_target,%) :
70 $(call gb_Helper_abbreviate_dirs,\
71 mkdir -p $(dir $@) && touch $@)
73 gb_MoTarget_get_install_target = $(INSTROOT)/$(LIBO_SHARE_RESOURCE_FOLDER)/$(1).mo
75 define gb_AllLangMoTarget_AllLangMoTarget
76 ifeq (,$$(filter $(1),$$(gb_AllLangMoTarget_REGISTERED)))
77 $$(eval $$(call gb_Output_info,Currently known AllLangMoTargets are: $(sort $(gb_AllLangMoTarget_REGISTERED)),ALL))
78 $$(eval $$(call gb_Output_error,AllLangMoTarget $(1) must be registered in Repository.mk))
79 endif
80 $(foreach lang,$(gb_AllLangMoTarget_LANGS),\
81 $(call gb_MoTarget_MoTarget,$(1)$(lang),$(1),$(lang)))
83 $(foreach lang,$(gb_AllLangMoTarget_LANGS),\
84 $(call gb_Helper_install,$(call gb_AllLangMoTarget_get_target,$(1)), \
85 $(call gb_MoTarget_get_install_target,$(shell $(SRCDIR)/solenv/bin/localestr $(lang))/LC_MESSAGES/$(1)), \
86 $(call gb_MoTarget_get_target,$(1)$(lang))))
88 $$(eval $$(call gb_Module_register_target,$(call gb_AllLangMoTarget_get_target,$(1)),$(call gb_AllLangMoTarget_get_clean_target,$(1))))
89 $(call gb_Helper_make_userfriendly_targets,$(1),AllLangMoTarget)
90 $(call gb_Postprocess_register_target,AllResources,AllLangMoTarget,$(1))
92 endef
94 define gb_AllLangMoTarget_set_polocation
95 $(foreach lang,$(gb_AllLangMoTarget_LANGS),\
96 $(call gb_MoTarget_set_polocation,$(1)$(lang),$(2)))
98 endef
100 # vim: set noet sw=4: