Avoid potential negative array index access to cached text.
[LibreOffice.git] / solenv / gbuild / Pyuno.mk
blob3e5cb820fcd553d4dc71d1c9fab8e466b5ab5d53
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 # class Pyuno
12 # Handles creation and delivery of Python UNO components.
14 # Provides one filelist, called Pyuno/<name>.
16 $(dir $(call gb_Pyuno_get_target,%)).dir :
17 $(if $(wildcard $(dir $@)),,mkdir -p $(dir $@))
19 $(dir $(call gb_Pyuno_get_target,%))%/.dir :
20 $(if $(wildcard $(dir $@)),,mkdir -p $(dir $@))
22 $(call gb_Pyuno_get_target,%) :
23 $(call gb_Output_announce,$*,$(true),PYU,3)
24 $(call gb_Trace_MakeMark,$*,PYU)
25 touch $@
27 $(call gb_Pyuno_get_final_target,%) :
28 touch $@
30 .PHONY : $(call gb_Pyuno_get_clean_target,%)
31 $(call gb_Pyuno_get_clean_target,%) :
32 $(call gb_Output_announce,$*,$(false),PYU,3)
33 rm -f $(call gb_Pyuno_get_target,$*) $(call gb_Pyuno_get_final_target,$*)
35 gb_Pyuno_get_packagename = Pyuno/$(1)
37 # gb_Pyuno_Pyuno component
38 define gb_Pyuno_Pyuno
39 $(call gb_Package_Package_internal,$(call gb_Pyuno_get_packagename,$(1)),$(2))
41 $(call gb_Pyuno_get_final_target,$(1)) : $(call gb_Pyuno_get_target,$(1))
42 $(call gb_Pyuno_get_target,$(1)) : $(call gb_Package_get_target,$(call gb_Pyuno_get_packagename,$(1)))
43 $(call gb_Pyuno_get_target,$(1)) :| $(dir $(call gb_Pyuno_get_target,$(1))).dir
44 $(call gb_Pyuno_get_clean_target,$(1)) : $(call gb_Package_get_clean_target,$(call gb_Pyuno_get_packagename,$(1)))
46 $$(eval $$(call gb_Module_register_target,$(call gb_Pyuno_get_final_target,$(1)),$(call gb_Pyuno_get_clean_target,$(1))))
47 $(call gb_Helper_make_userfriendly_targets,$(1),Pyuno,$(call gb_Pyuno_get_final_target,$(1)))
49 endef
51 # gb_Pyuno_add_file component destination source
52 define gb_Pyuno_add_file
53 $(call gb_Package_add_file,$(call gb_Pyuno_get_packagename,$(1)),$(LIBO_LIB_PYUNO_FOLDER)/$(2),$(3))
55 endef
57 # gb_Pyuno_add_files component destdir source
58 define gb_Pyuno_add_files
59 $(foreach file,$(3),$(call gb_Pyuno_add_file,$(1),$(if $(strip $(2)),$(strip $(2))/)$(file),$(file)))
61 endef
63 gb_Pyuno__COMPONENTPREFIX := vnd.openoffice.pymodule:
65 define gb_Pyuno_set_componentfile_full
66 $(call gb_ComponentTarget_ComponentTarget,$(2),$(3),$(4),$(5))
67 $(call gb_Pyuno_get_final_target,$(1)) : $(call gb_ComponentTarget_get_target,$(2))
68 $(call gb_ComponentTarget_get_target,$(2)) : $(call gb_Pyuno_get_target,$(1))
69 $(call gb_Pyuno_get_clean_target,$(1)) : $(call gb_ComponentTarget_get_clean_target,$(2))
71 endef
73 # Set .component file for the component.
74 define gb_Pyuno_set_componentfile
75 $(call gb_Pyuno_set_componentfile_full,$(1),$(2),$(gb_Pyuno__COMPONENTPREFIX),$(1),$(3))
77 endef
79 # vim:set shiftwidth=4 tabstop=4 noexpandtab: