Version 4.0.0.1, tag libreoffice-4.0.0.1
[LibreOffice.git] / solenv / gbuild / AllLangZip.mk
blobfa3b9debfbab611fb5898b6431a9c91b9b55140d
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 # AllLangZip class
12 # Handles creation of a bunch of zip files with content dependent on
13 # language
15 gb_AllLangZip_LANGS := $(if $(strip $(gb_WITH_LANG)),$(gb_WITH_LANG),en-US)
17 $(dir $(call gb_AllLangZip_get_target,%)).dir :
18 $(if $(wildcard $(dir $@)),,mkdir -p $(dir $@))
20 $(call gb_AllLangZip_get_target,%) :
21 $(call gb_Output_announce,$*,$(true),ALZ,4)
22 touch $@
24 .PHONY : $(call gb_AllLangZip_get_clean_target,%)
25 $(call gb_AllLangZip_get_clean_target,%) :
26 $(call gb_Output_announce,$*,$(true),ALZ,4)
27 rm -f $(call gb_AllLangZip_get_target,$*)
29 # Define a new zip group
31 # NOTE: we cannot add dependencies on the child zips here: Zip fails if
32 # the source directory does not exist and we cannot test its existence
33 # because the directory might be generated. So we postpone the
34 # dependency creation to gb_AllLangZip_add_file.
36 # gb_AllLangZip_AllLangZip group srcdir
37 define gb_AllLangZip_AllLangZip
38 $(foreach lang,$(gb_AllLangZip_LANGS),$(call gb_Zip_Zip_internal,$(1)_$(lang),$(2)/$(lang)))
40 $(call gb_AllLangZip_get_target,$(1)) :| $(dir $(call gb_AllLangZip_get_target,$(1))).dir
42 $$(eval $$(call gb_Module_register_target,$(call gb_AllLangZip_get_target,$(1)),$(call gb_AllLangZip_get_clean_target,$(1))))
44 endef
46 define gb_AllLangZip__add_to_zip
47 $(call gb_Zip_add_file,$(2),$(3))
48 $(call gb_AllLangZip_get_target,$(1)) : $(call gb_Zip_get_outdir_target,$(2))
49 $(call gb_AllLangZip_get_clean_target,$(1)) : $(call gb_Zip_get_clean_target,$(2))
51 endef
53 define gb_AllLangZip__add_file_impl
54 $(if $(filter $(2),$(gb_AllLangZip_LANGS)),$(call gb_AllLangZip__add_to_zip,$(1),$(1)_$(2),$(3)))
56 endef
58 define gb_AllLangZip__add_file
59 $(call gb_AllLangZip__add_file_impl,$(1),$(firstword $(2)),$(subst $() $(),/,$(wordlist 2,$(words $(2)),$(2))))
61 endef
63 # Add a file to one of the child zips
65 # The language is taken from the first component of the file name. The
66 # file is only added if there is a zip defined for the language (i.e.,
67 # if we are building with the language).
69 # gb_AllLangZip_add_file target file
70 define gb_AllLangZip_add_file
71 $(call gb_AllLangZip__add_file,$(1),$(subst /, ,$(2)))
73 endef
75 # Add several files to the child zips at once
77 # gb_AllLangZip_add_files target file(s)
78 define gb_AllLangZip_add_files
79 $(foreach file,$(2),$(call gb_AllLangZip_add_file,$(1),$(file)))
81 endef
83 # Add extra dependency that must exist before the archives can be created
85 # gb_AllLangZip_add_dependency target dep
86 define gb_AllLangZip_add_dependency
87 $(foreach lang,$(gb_AllLangZip_LANGS),$(call gb_Zip_add_dependency,$(1)_$(lang),$(2)))
89 endef
91 # Add extra dependencies that must exist before the archives can be created
93 # gb_AllLangZip_add_dependencies target dep(s)
94 define gb_AllLangZip_add_dependencies
95 $(foreach dependency,$(2),$(call gb_AllLangZip_add_dependency,$(1),$(dependency)))
97 endef
99 # vim: set noet sw=4 ts=4: