bump product version to 4.1.6.2
[LibreOffice.git] / solenv / gbuild / CliLibrary.mk
blob2513494b66e3806ab938044828d72a421bad45ff
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 # CliLibraryTarget class
12 gb_CliLibraryTarget_EXT := $(gb_CliAssembly_POLICYEXT)
14 gb_CliLibraryTarget_CSCFLAGS := \
15 -noconfig \
16 -nologo \
18 gb_CliLibraryTarget_CSCFLAGS_DEBUG := \
19 -checked+ \
20 -define:DEBUG \
21 -define:TRACE \
23 ifeq ($(strip $(debug)),)
24 ifeq ($(strip $(ENABLE_DBGUTIL)),TRUE)
25 gb_CliLibraryTarget__get_csflags = $(gb_CliLibraryTarget_CSCFLAGS) $(gb_CliLibraryTarget_CSCFLAGS_DEBUG)
26 else
27 gb_CliLibraryTarget__get_csflags = $(gb_CliLibraryTarget_CSCFLAGS) -o
28 endif
29 else
30 gb_CliLibraryTarget__get_csflags = $(gb_CliLibraryTarget_CSCFLAGS) $(gb_CliLibraryTarget_CSCFLAGS_DEBUG) -debug+
31 endif
33 gb_CliLibraryTarget__get_source = $(SRCDIR)/$(1).cs
34 gb_CliLibraryTarget__get_generated_source = $(WORKDIR)/$(1).cs
36 define gb_CliLibraryTarget__command
37 $(call gb_Output_announce,$(2),$(true),CSC,3)
38 $(call gb_Helper_abbreviate_dirs,\
39 csc $(call gb_Helper_windows_path, \
40 $(call gb_CliLibraryTarget__get_csflags) \
41 $(CLI_CSCFLAGS) \
42 -target:library \
43 -out:$(1) \
44 -keyfile:$(call gb_Helper_windows_path,$(CLI_KEYFILE)) \
45 -reference:System.dll \
46 $(foreach assembly,$(CLI_ASSEMBLIES),-reference:$(assembly)) \
47 $(CLI_SOURCES) \
48 ) \
50 endef
52 $(dir $(call gb_CliLibraryTarget_get_target,%)).dir :
53 $(if $(wildcard $(dir $@)),,mkdir -p $(dir $@))
55 $(dir $(call gb_CliLibraryTarget_get_target,%))%/.dir :
56 $(if $(wildcard $(dir $@)),,mkdir -p $(dir $@))
58 $(call gb_CliLibraryTarget_get_target,%) :
59 $(call gb_CliLibraryTarget__command,$@,$*,$<,$?,$^)
61 .PHONY : $(call gb_CliLibraryTarget_get_clean_target,%)
62 $(call gb_CliLibraryTarget_get_clean_target,%) :
63 $(call gb_Output_announce,$*,$(false),CSC,3)
64 $(call gb_Helper_abbreviate_dirs,\
65 rm -f $(call gb_CliLibraryTarget_get_target,$*) \
68 # Compiles one or more C# source files
70 # gb_CliLibraryTarget_CliLibraryTarget target
71 define gb_CliLibraryTarget_CliLibraryTarget
72 $(call gb_CliLibraryTarget_get_target,$(1)) : CLI_ASSEMBLIES :=
73 $(call gb_CliLibraryTarget_get_target,$(1)) : CLI_SOURCES :=
74 $(call gb_CliLibraryTarget_get_target,$(1)) : CLI_CSCFLAGS :=
75 $(call gb_CliLibraryTarget_get_target,$(1)) : CLI_KEYFILE :=
77 $(call gb_CliLibraryTarget_get_target,$(1)) :| $(dir $(call gb_CliLibraryTarget_get_target,$(1))).dir
79 endef
81 define gb_CliLibraryTarget_use_assembly
82 $(call gb_CliLibraryTarget_get_target,$(1)) : CLI_ASSEMBLIES += $(call gb_CliLibrary_get_target,$(2))
83 $(call gb_CliLibraryTarget_get_target,$(1)) : $(call gb_CliLibrary_get_target,$(2))
85 endef
87 define gb_CliLibraryTarget_use_assemblies
88 $(foreach assembly,$(2),$(call gb_CliLibraryTarget_use_assembly,$(1),$(assembly)))
90 endef
92 # Add a source file to compile
93 define gb_CliLibraryTarget_add_csfile
94 $(call gb_CliLibraryTarget_get_target,$(1)) : CLI_SOURCES += $(call gb_CliLibraryTarget__get_source,$(2))
95 $(call gb_CliLibraryTarget_get_target,$(1)) : $(call gb_CliLibraryTarget__get_source,$(2))
97 endef
99 # Add source files to compile
100 define gb_CliLibraryTarget_add_csfiles
101 $(foreach csfile,$(2),$(call gb_CliLibraryTarget_add_csfile,$(1),$(csfile)))
103 endef
105 # Add a generated source file to compile
106 define gb_CliLibraryTarget_add_generated_csfile
107 $(call gb_CliLibraryTarget_get_target,$(1)) : CLI_SOURCES += $(call gb_CliLibraryTarget__get_generated_source,$(2))
108 $(call gb_CliLibraryTarget_get_target,$(1)) : $(call gb_CliLibraryTarget__get_generated_source,$(2))
110 endef
112 # Add generated source files to compile
113 define gb_CliLibraryTarget_add_generated_csfiles
114 $(foreach csfile,$(2),$(call gb_CliLibraryTarget_add_generated_csfile,$(1),$(csfile)))
116 endef
118 # Add flags used for compilation
119 define gb_CliLibraryTarget_add_csflags
120 $(call gb_CliLibraryTarget_get_target,$(1)) : CLI_CSCFLAGS += $(2)
122 endef
124 # CliLibrary class
126 gb_CliLibrary_EXT := $(gb_CliLibraryTarget_EXT)
128 # Compiles one or more C# source files
130 # gb_CliLibrary_CliLibrary target
131 define gb_CliLibrary_CliLibrary
132 $(call gb_CliLibraryTarget_CliLibraryTarget,$(1))
133 $(call gb_CliAssembly_CliAssembly,$(1))
135 $(call gb_CliLibrary_get_target,$(1)) : $(call gb_CliLibraryTarget_get_target,$(1))
136 $(call gb_CliLibrary_get_target,$(1)) :| $(call gb_CliAssembly_get_target,$(1))
137 $(call gb_CliLibrary_get_target,$(1)) :| $(dir $(call gb_CliLibrary_get_target,$(1))).dir
138 $(call gb_CliLibrary_get_clean_target,$(1)) : $(call gb_CliLibraryTarget_get_clean_target,$(1))
139 $(call gb_CliLibrary_get_clean_target,$(1)) : $(call gb_CliAssembly_get_clean_target,$(1))
141 $(call gb_Deliver_add_deliverable,$(call gb_CliLibrary_get_target,$(1)),$(call gb_CliLibraryTarget_get_target,$(1)),$(1))
143 $$(eval $$(call gb_Module_register_target,$(call gb_CliLibrary_get_target,$(1)),$(call gb_CliLibrary_get_clean_target,$(1))))
144 $(call gb_Helper_make_userfriendly_targets,$(1),CliLibrary)
146 endef
148 define gb_CliLibrary_set_configfile
149 $(call gb_CliAssembly_set_configfile,$(1),$(2))
151 endef
153 define gb_CliLibrary_set_keyfile
154 $(call gb_CliLibraryTarget_get_target,$(1)) : CLI_KEYFILE := $(2)
155 $(call gb_CliAssembly_set_keyfile,$(1),$(2))
157 endef
159 define gb_CliLibrary_set_policy
160 $(call gb_CliAssembly_set_policy,$(1),$(2),$(3))
162 endef
164 define gb_CliLibrary_use_assembly
165 $(call gb_CliLibraryTarget_use_assembly,$(1),$(2))
167 endef
169 define gb_CliLibrary_use_assemblies
170 $(call gb_CliLibraryTarget_use_assemblies,$(1),$(2))
172 endef
174 # Add a source file to compile
175 define gb_CliLibrary_add_csfile
176 $(call gb_CliLibraryTarget_add_csfile,$(1),$(2))
178 endef
180 # Add source files to compile
181 define gb_CliLibrary_add_csfiles
182 $(call gb_CliLibraryTarget_add_csfiles,$(1),$(2))
184 endef
186 # Add a generated source file to compile
187 define gb_CliLibrary_add_generated_csfile
188 $(call gb_CliLibraryTarget_add_generated_csfile,$(1),$(2))
190 endef
192 # Add generated source files to compile
193 define gb_CliLibrary_add_generated_csfiles
194 $(call gb_CliLibraryTarget_add_generated_csfiles,$(1),$(2))
196 endef
198 # Add flags used for compilation
199 define gb_CliLibrary_add_csflags
200 $(call gb_CliLibraryTarget_add_csflags,$(1),$(2))
202 endef
204 # vim: set noet sw=4 ts=4: