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/.
12 gb_CliLibrary_EXT
:= $(gb_CliAssembly_POLICYEXT
)
14 gb_CliLibrary_CSCFLAGS
:= \
18 gb_CliLibrary_CSCFLAGS_DEBUG
:= \
23 ifeq ($(strip $(debug
)),)
24 ifeq ($(strip $(ENABLE_DBGUTIL
)),TRUE
)
25 gb_CliLibrary__get_csflags
= $(gb_CliLibrary_CSCFLAGS
) $(gb_CliLibrary_CSCFLAGS_DEBUG
)
27 gb_CliLibrary__get_csflags
= $(gb_CliLibrary_CSCFLAGS
) -o
30 gb_CliLibrary__get_csflags
= $(gb_CliLibrary_CSCFLAGS
) $(gb_CliLibrary_CSCFLAGS_DEBUG
) -debug
+
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
39 $(call gb_CliLibrary__get_csflags
) \
43 $(if
$(call gb_LinkTarget__symbols_enabled
,$(1)),\
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
)) \
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
)
89 define gb_CliLibrary_set_configfile
90 $(call gb_CliAssembly_set_configfile
,$(1),$(2),$(3))
94 define gb_CliLibrary_set_keyfile
95 $(call gb_CliLibrary_get_target
,$(1)) : CLI_KEYFILE
:= $(2)
96 $(call gb_CliAssembly_set_keyfile
,$(1),$(2))
100 define gb_CliLibrary_set_policy
101 $(call gb_CliAssembly_set_policy
,$(1),$(2),$(3))
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))
111 define gb_CliLibrary_use_assemblies
112 $(foreach assembly
,$(2),$(call gb_CliLibrary_use_assembly
,$(1),$(assembly
)))
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))
123 # Add source files to compile
124 define gb_CliLibrary_add_csfiles
125 $(foreach csfile
,$(2),$(call gb_CliLibrary_add_csfile
,$(1),$(csfile
)))
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))
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
)))
142 # Add flags used for compilation
143 define gb_CliLibrary_add_csflags
144 $(call gb_CliLibrary_get_target
,$(1)) : CLI_CSCFLAGS
+= $(2)
148 # vim: set noet sw=4 ts=4: