Branch libreoffice-5-0-4
[LibreOffice.git] / solenv / gbuild / CliAssembly.mk
bloba745e8e1ec6402fdf9e1cf1018d9b0b504754854
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 # CliConfigTarget class
12 gb_CliConfigTarget_TARGET := $(SRCDIR)/solenv/bin/clipatchconfig.pl
13 gb_CliConfigTarget_COMMAND := $(PERL) -w $(gb_CliConfigTarget_TARGET)
15 gb_CliConfigTarget_VERSIONFILE_DEFAULT := $(SRCDIR)/cli_ure/version/version.txt
17 define gb_CliConfigTarget__command
18 $(call gb_Output_announce,$(2),$(true),CPA,1)
19 $(call gb_Helper_abbreviate_dirs,\
20 $(gb_CliConfigTarget_COMMAND) $(3) $(CLI_CONFIG_VERSIONFILE) $(1) \
22 endef
24 $(dir $(call gb_CliConfigTarget_get_target,%))%/.dir :
25 $(if $(wildcard $(dir $@)),,mkdir -p $(dir $@))
27 $(call gb_CliConfigTarget_get_target,%) :
28 $(call gb_CliConfigTarget__command,$@,$*,$<)
30 $(call gb_CliConfigTarget_get_clean_target,%) :
31 $(call gb_Output_announce,$*,$(false),CPA,1)
32 rm -f $(call gb_CliConfigTarget_get_target,$*)
34 # Subst. variables in a config file
36 # gb_CliConfigTarget_CliConfigTarget target source
37 define gb_CliConfigTarget_CliConfigTarget
38 $(call gb_CliConfigTarget_get_target,$(1)) : CLI_CONFIG_VERSIONFILE := $(gb_CliConfigTarget_VERSIONFILE_DEFAULT)
40 $(call gb_CliConfigTarget_get_target,$(1)) : $(2)
41 $(call gb_CliConfigTarget_get_target,$(1)) : $(gb_CliConfigTarget_TARGET)
42 $(call gb_CliConfigTarget_get_target,$(1)) : $(gb_CliConfigTarget_VERSIONFILE_DEFAULT)
43 $(call gb_CliConfigTarget_get_target,$(1)) :| $(dir $(call gb_CliConfigTarget_get_target,$(1))).dir
45 endef
47 # CliAssemblyTarget class
49 # platform:
50 # CliAssemblyTarget_POLICYEXT
51 # CliAssemblyTarget_get_dll
53 gb_CliAssemblyTarget_KEYFILE_DEFAULT := $(SRCDIR)/cli_ure/source/cliuno.snk
55 define gb_CliAssemblyTarget__command
56 $(call gb_Output_announce,$(2),$(true),AL ,2)
57 $(call gb_Helper_abbreviate_dirs,\
58 al \
59 -nologo \
60 -out:$(CLI_ASSEMBLY_OUTFILE) \
61 -version:$(CLI_ASSEMBLY_VERSION) \
62 -keyfile:$(CLI_ASSEMBLY_KEYFILE) \
63 -link:$(CLI_ASSEMBLY_CONFIGFILE) \
64 $(if $(CLI_ASSEMBLY_PLATFORM),-platform:$(CLI_ASSEMBLY_PLATFORM)) && \
65 touch $(1) \
67 endef
69 $(dir $(call gb_CliAssemblyTarget_get_target,%)).dir :
70 $(if $(wildcard $(dir $@)),,mkdir -p $(dir $@))
72 $(dir $(call gb_CliAssemblyTarget_get_target,%))%/.dir :
73 $(if $(wildcard $(dir $@)),,mkdir -p $(dir $@))
75 $(call gb_CliAssemblyTarget_get_target,%) :
76 $(if $(strip $(CLI_ASSEMBLY_VERSION)),,$(call gb_Output_error,assembly version not set))
77 $(if $(strip $(CLI_ASSEMBLY_CONFIGFILE)),,$(call gb_Output_error,assembly configuration file not set))
78 $(if $(strip $(CLI_ASSEMBLY_OUTFILE)),,$(call gb_Output_error,assembly name not set))
79 $(call gb_CliAssemblyTarget__command,$@,$*,$<)
81 $(call gb_CliAssemblyTarget_get_assembly_target,%) :
82 touch $@
84 .PHONY : $(call gb_CliAssemblyTarget_get_clean_target,%)
85 $(call gb_CliAssemblyTarget_get_clean_target,%) :
86 $(call gb_Output_announce,$*,$(false),AL ,2)
87 $(call gb_Helper_abbreviate_dirs,\
88 rm -f $(call gb_CliAssemblyTarget_get_target,$*) $(CLI_ASSEMBLY_OUTFILE) \
91 # Create a CLI assembly
92 define gb_CliAssemblyTarget_CliAssemblyTarget
93 $(call gb_CliAssemblyTarget_get_target,$(1)) : CLI_ASSEMBLY_CONFIGFILE :=
94 $(call gb_CliAssemblyTarget_get_target,$(1)) : CLI_ASSEMBLY_KEYFILE := $(gb_CliAssemblyTarget_KEYFILE_DEFAULT)
95 $(call gb_CliAssemblyTarget_get_target,$(1)) : CLI_ASSEMBLY_OUTFILE :=
96 $(call gb_CliAssemblyTarget_get_target,$(1)) : CLI_ASSEMBLY_PLATFORM :=
97 $(call gb_CliAssemblyTarget_get_target,$(1)) : CLI_ASSEMBLY_VERSION :=
99 $(call gb_CliAssemblyTarget_get_clean_target,$(1)) : CLI_ASSEMBLY_OUTFILE :=
101 $(call gb_CliAssemblyTarget_get_target,$(1)) :| $(dir $(call gb_CliAssemblyTarget_get_target,$(1))).dir
103 endef
105 define gb_CliAssemblyTarget_set_configfile
106 $(call gb_CliAssemblyTarget_get_target,$(1)) : CLI_ASSEMBLY_CONFIGFILE := $(2)
107 $(call gb_CliAssemblyTarget_get_target,$(1)) : $(2)
109 endef
111 define gb_CliAssemblyTarget_set_keyfile
112 $(call gb_CliAssemblyTarget_get_target,$(1)) : CLI_ASSEMBLY_KEYFILE := $(2)
113 $(call gb_CliAssemblyTarget_get_target,$(1)) : $(2)
115 endef
117 define gb_CliAssemblyTarget_set_name
118 $(call gb_CliAssemblyTarget_get_target,$(1)) \
119 $(call gb_CliAssemblyTarget_get_clean_target,$(1)) : \
120 CLI_ASSEMBLY_OUTFILE := $(call gb_CliAssemblyTarget_get_assembly_target,$(2))
121 $(call gb_CliAssemblyTarget_get_assembly_target,$(2)) : $(call gb_CliAssemblyTarget_get_target,$(1))
123 endef
125 define gb_CliAssemblyTarget_set_platform
126 $(call gb_CliAssemblyTarget_get_target,$(1)) : CLI_ASSEMBLY_PLATFORM := $(2)
128 endef
130 define gb_CliAssemblyTarget_set_version
131 $(call gb_CliAssemblyTarget_get_target,$(1)) : CLI_ASSEMBLY_VERSION := $(2)
133 endef
135 # CliAssembly class
137 gb_CliAssembly_KEYFILE_DEFAULT := $(gb_CliAssemblyTarget_KEYFILE_DEFAULT)
138 gb_CliAssembly_POLICYEXT := $(gb_CliAssemblyTarget_POLICYEXT)
140 gb_CliAssembly_get_dll = $(call gb_CliAssemblyTarget_get_dll,$(1))
142 $(call gb_CliAssembly_get_target,%) :
143 $(call gb_Output_announce,$*,$(true),CLA,3)
144 mkdir -p $(dir $@) && touch $@
146 .PHONY : $(call gb_CliAssembly_get_clean_target,%)
147 $(call gb_CliAssembly_get_clean_target,%) :
148 $(call gb_Output_announce,$*,$(false),CLA,3)
149 rm -f $(call gb_CliAssembly_get_target,$*)
151 # call gb_CliAssembly_CliAssembly,dllname,dlltarget
152 define gb_CliAssembly_CliAssembly
153 $(call gb_CliAssemblyTarget_CliAssemblyTarget,$(1))
154 $(call gb_Package_Package_internal,$(1)_assembly,$(WORKDIR))
155 $(call gb_Package_set_outdir,$(1)_assembly,$(dir $(2)))
157 $(call gb_CliAssembly_get_target,$(1)) : $(call gb_CliAssemblyTarget_get_target,$(1))
158 $(call gb_CliAssembly_get_target,$(1)) :| $(call gb_Package_get_target,$(1)_assembly)
159 $(call gb_CliAssembly_get_clean_target,$(1)) : $(call gb_CliAssemblyTarget_get_clean_target,$(1))
160 $(call gb_CliAssembly_get_clean_target,$(1)) : $(call gb_Package_get_clean_target,$(1)_assembly)
162 endef
164 define gb_CliAssembly__add_file
165 $(call gb_Package_add_file,$(1)_assembly,$(notdir $(2)),$(subst $(WORKDIR)/,,$(2)))
167 endef
169 define gb_CliAssembly__set_configfile_impl
170 $(call gb_CliAssemblyTarget_set_configfile,$(1),$(2))
171 $(call gb_CliAssembly__add_file,$(1),$(2))
173 endef
175 define gb_CliAssembly__set_configfile
176 $(call gb_CliConfigTarget_CliConfigTarget,$(2),$(3))
177 $(call gb_CliAssembly__set_configfile_impl,$(1),$(call gb_CliConfigTarget_get_target,$(2)))
179 endef
181 define gb_CliAssembly_set_configfile
182 $(call gb_CliAssembly__set_configfile,$(1),$(patsubst %_config,%,$(2)),$(SRCDIR)/$(2))
184 endef
186 define gb_CliAssembly_set_keyfile
187 $(call gb_CliAssemblyTarget_set_keyfile,$(1),$(2))
189 endef
191 define gb_CliAssembly_set_platform
192 $(call gb_CliAssemblyTarget_set_platform,$(1),$(2))
194 endef
196 define gb_CliAssembly_set_policy
197 $(call gb_CliAssemblyTarget_set_version,$(1),$(3))
198 $(call gb_CliAssemblyTarget_set_name,$(1),$(2))
199 $(call gb_CliAssembly__add_file,$(1),$(call gb_CliAssemblyTarget_get_assembly_target,$(2)))
201 endef
203 # vim: set noet sw=4 ts=4: