bump product version to 7.2.5.1
[LibreOffice.git] / solenv / gbuild / CliLibrary.mk
blobe6af838919255a3c2c3f7aff537731dd226ce0c8
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 # CliLibrary class
12 gb_CliLibrary_EXT := $(gb_CliAssembly_POLICYEXT)
14 gb_CliLibrary_CSCFLAGS := \
15 -noconfig \
16 -nologo \
18 gb_CliLibrary_CSCFLAGS_DEBUG := \
19 -checked+ \
20 -define:DEBUG \
21 -define:TRACE \
23 ifeq ($(strip $(debug)),)
24 ifeq ($(strip $(ENABLE_DBGUTIL)),TRUE)
25 gb_CliLibrary__get_csflags = $(gb_CliLibrary_CSCFLAGS) $(gb_CliLibrary_CSCFLAGS_DEBUG)
26 else
27 gb_CliLibrary__get_csflags = $(gb_CliLibrary_CSCFLAGS) -o
28 endif
29 else
30 gb_CliLibrary__get_csflags = $(gb_CliLibrary_CSCFLAGS) $(gb_CliLibrary_CSCFLAGS_DEBUG) -debug+
31 endif
33 gb_CliLibrary__get_source = $(SRCDIR)/$(1).cs
34 gb_CliLibrary__get_generated_source = $(WORKDIR)/$(1).cs
36 # csc has silly problems handling files passed on command line
37 define gb_CliLibrary__command
38 csc \
39 $(call gb_CliLibrary__get_csflags) \
40 $(CLI_CSCFLAGS) \
41 -target:library \
42 -out:$(1) \
43 $(if $(call gb_LinkTarget__symbols_enabled,$(1)),\
44 -debug:pdbonly \
45 -pdb:$(call gb_LinkTarget__get_pdb_filename,$(WORKDIR)/LinkTarget/Library/$(notdir $(1)))) \
46 -keyfile:$(CLI_KEYFILE) \
47 -reference:System.dll \
48 $(foreach assembly,$(CLI_ASSEMBLIES),-reference:$(assembly)) \
49 $(subst /,\,$(CLI_SOURCES)) \
52 endef
54 .PHONY : $(call gb_CliLibrary_get_clean_target,%)
55 $(call gb_CliLibrary_get_clean_target,%) :
56 $(call gb_Output_announce,$*,$(false),CSC,3)
57 $(call gb_Helper_abbreviate_dirs,\
58 rm -f $(call gb_CliLibrary_get_target,$*) \
62 # Compiles one or more C# source files
64 # gb_CliLibrary_CliLibrary target
65 define gb_CliLibrary_CliLibrary
66 $(call gb_CliAssembly_CliAssembly,$(1),$(call gb_CliLibrary_get_target,$(1)))
68 $(call gb_CliLibrary_get_target,$(1)) : CLI_ASSEMBLIES :=
69 $(call gb_CliLibrary_get_target,$(1)) : CLI_SOURCES :=
70 $(call gb_CliLibrary_get_target,$(1)) : CLI_CSCFLAGS :=
71 $(call gb_CliLibrary_get_target,$(1)) : CLI_KEYFILE :=
74 $(call gb_CliLibrary_get_target,$(1)) :| $(call gb_CliAssembly_get_target,$(1))
75 $(call gb_CliLibrary_get_target,$(1)) :| $(dir $(call gb_CliLibrary_get_target,$(1))).dir
76 $(call gb_CliLibrary_get_clean_target,$(1)) : $(call gb_CliAssembly_get_clean_target,$(1))
78 $$(eval $$(call gb_Module_register_target,$(call gb_CliLibrary_get_target,$(1)),$(call gb_CliLibrary_get_clean_target,$(1))))
79 $(call gb_Helper_make_userfriendly_targets,$(1),CliLibrary)
81 $(call gb_CliLibrary_get_target,$(1)) :
82 $$(call gb_Output_announce,$(1),$(true),CSC,3)
83 $$(call gb_Trace_StartRange,$(1),CSC)
84 $$(call gb_CliLibrary__command,$$@,$(1))
85 $$(call gb_Trace_EndRange,$(1),CSC)
87 endef
89 define gb_CliLibrary_set_configfile
90 $(call gb_CliAssembly_set_configfile,$(1),$(2),$(3))
92 endef
94 define gb_CliLibrary_set_keyfile
95 $(call gb_CliLibrary_get_target,$(1)) : CLI_KEYFILE := $(2)
96 $(call gb_CliAssembly_set_keyfile,$(1),$(2))
98 endef
100 define gb_CliLibrary_set_policy
101 $(call gb_CliAssembly_set_policy,$(1),$(2),$(3))
103 endef
105 define gb_CliLibrary_use_assembly
106 $(call gb_CliLibrary_get_target,$(1)) : CLI_ASSEMBLIES += $(call gb_CliLibrary_get_target,$(2))
107 $(call gb_CliLibrary_get_target,$(1)) : $(call gb_CliLibrary_get_target,$(2))
109 endef
111 define gb_CliLibrary_use_assemblies
112 $(foreach assembly,$(2),$(call gb_CliLibrary_use_assembly,$(1),$(assembly)))
114 endef
116 # Add a source file to compile
117 define gb_CliLibrary_add_csfile
118 $(call gb_CliLibrary_get_target,$(1)) : CLI_SOURCES += $(call gb_CliLibrary__get_source,$(2))
119 $(call gb_CliLibrary_get_target,$(1)) : $(call gb_CliLibrary__get_source,$(2))
121 endef
123 # Add source files to compile
124 define gb_CliLibrary_add_csfiles
125 $(foreach csfile,$(2),$(call gb_CliLibrary_add_csfile,$(1),$(csfile)))
127 endef
129 # Add a generated source file to compile
130 define gb_CliLibrary_add_generated_csfile
131 $(call gb_CliLibrary_get_target,$(1)) : CLI_SOURCES += $(call gb_CliLibrary__get_generated_source,$(2))
132 $(call gb_CliLibrary_get_target,$(1)) : $(call gb_CliLibrary__get_generated_source,$(2))
134 endef
136 # Add generated source files to compile
137 define gb_CliLibrary_add_generated_csfiles
138 $(foreach csfile,$(2),$(call gb_CliLibrary_add_generated_csfile,$(1),$(csfile)))
140 endef
142 # Add flags used for compilation
143 define gb_CliLibrary_add_csflags
144 $(call gb_CliLibrary_get_target,$(1)) : CLI_CSCFLAGS += $(2)
146 endef
148 # vim: set noet sw=4 ts=4: