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/.
10 # AllLangPackage class
12 # Handles creation of a bunch of packages with content dependent on
13 # language. The package files are placed into $(INSTROOT).
15 gb_AllLangPackage_LANGS
:= $(if
$(strip $(gb_WITH_LANG
)),$(gb_WITH_LANG
),en-US
)
17 $(dir $(call gb_AllLangPackage_get_target
,%)).
dir :
18 $(if
$(wildcard $(dir $@
)),,mkdir
-p
$(dir $@
))
20 $(call gb_AllLangPackage_get_target
,%) :
21 $(call gb_Output_announce
,$*,$(true
),ALP
,3)
24 .PHONY
: $(call gb_AllLangPackage_get_clean_target
,%)
25 $(call gb_AllLangPackage_get_clean_target
,%) :
26 $(call gb_Output_announce
,$*,$(true
),ALP
,3)
27 rm -f
$(call gb_AllLangPackage_get_target
,$*)
29 # Define a new package group.
31 # gb_AllLangPackage_AllLangPackage group srcdir
32 define gb_AllLangPackage_AllLangPackage
33 $(foreach lang
,$(gb_AllLangPackage_LANGS
),$(call gb_AllLangPackage__AllLangPackage_onelang
,$(1),$(1)_
$(lang
),$(2)))
35 $(call gb_AllLangPackage_get_target
,$(1)) :|
$(dir $(call gb_AllLangPackage_get_target
,$(1))).
dir
37 $$(eval
$$(call gb_Module_register_target
,$(call gb_AllLangPackage_get_target
,$(1)),$(call gb_AllLangPackage_get_clean_target
,$(1))))
38 $(call gb_Helper_make_userfriendly_targets
,$(1),AllLangPackage
)
42 # Define a package for one lang.
44 # gb_AllLangPackage__AllLangPackage_lang group package srcdir
45 define gb_AllLangPackage__AllLangPackage_onelang
46 $(call gb_Package_Package_internal
,$(2),$(3))
47 $(call gb_AllLangPackage_get_target
,$(1)) : $(call gb_Package_get_target
,$(2))
48 $(call gb_AllLangPackage_get_clean_target
,$(1)) : $(call gb_Package_get_clean_target
,$(2))
52 # gb_AllLangPackage__add_to_package target package destination source
53 define gb_AllLangPackage__add_to_package
54 $(call gb_Package_add_file
,$(2),$(3),$(4))
58 # gb_AllLangPackage__add_file target destination source lang
59 define gb_AllLangPackage__add_file
60 $(if
$(filter $(4),$(gb_AllLangPackage_LANGS
)),$(call gb_AllLangPackage__add_to_package
,$(1),$(1)_
$(4),$(2),$(3)))
64 # Add a file to one of the child packages.
66 # The language is taken from the first component of the file name. The
67 # file is only added if there is a package defined for the language
68 # (i.e., if we are building with the language).
70 # gb_AllLangPackage_add_file target destination source
71 gb_AllLangPackage_ALLDIRS
:=
72 define gb_AllLangPackage_add_file
73 gb_AllLangPackage_ALLDIRS
:= $(sort $(gb_AllLangPackage_ALLDIRS
) $(patsubst %$(3),%,$(2)))
74 $(call gb_AllLangPackage__add_file
,$(1),$(2),$(3),$(firstword $(subst /, ,$(3))))
78 # Add several files to the child packages at once.
80 # gb_AllLangPackage_add_files target destination-dir file(s)
81 define gb_AllLangPackage_add_files
82 $(if
$(strip $(2)),,$(call gb_Output_error
,gb_AllLangPackage_add_files
: destination
dir cannot be empty
))
83 $(foreach file
,$(3),$(call gb_AllLangPackage_add_file
,$(1),$(2)/$(file
),$(file
)))
87 # Add several files to the child packages at once.
89 # The files are placed into subdir under the language-dependent path.
92 # $(eval $(call # gb_AllLangPackage_add_files_with_subdir,foo,destdir,subdir,cs/file.ext))
93 # # -> destdir/cs/subdir/file.ext
95 # gb_AllLangPackage_add_files_with_subdir target destination-dir subdir file(s)
96 define gb_AllLangPackage_add_files_with_subdir
97 $(if
$(strip $(2)),,$(call gb_Output_error
,gb_AllLangPackage_add_files_with_subdir
: destination
dir cannot be empty
))
98 $(if
$(strip $(3)),,$(call gb_Output_error
,gb_AllLangPackage_add_files_with_subdir
: there is no subdir
, just use gb_AllLangPackage_add_files
))
99 $(foreach file
,$(4),$(call gb_AllLangPackage_add_file
,$(1),$(2)/$(dir $(file
))$(3)/$(notdir $(file
)),$(file
)))
103 # Use unpacked tarball.
105 # gb_AllLangPackage_add_dependency target unpacked
106 define gb_AllLangPackage_use_unpacked
107 $(foreach lang
,$(gb_AllLangPackage_LANGS
),$(call gb_Package_use_unpacked
,$(1)_
$(lang
),$(2)))
111 # vim: set noet sw=4 ts=4: