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
38 $(call gb_Output_announce
,$(2),$(true
),CSC
,3)
40 $(call gb_CliLibrary__get_csflags
) \
44 -keyfile
:$(CLI_KEYFILE
) \
45 -reference
:System.dll \
46 $(foreach assembly
,$(CLI_ASSEMBLIES
),-reference
:$(assembly
)) \
47 $(subst /,\
,$(CLI_SOURCES
)) \
52 .PHONY
: $(call gb_CliLibrary_get_clean_target
,%)
53 $(call gb_CliLibrary_get_clean_target
,%) :
54 $(call gb_Output_announce
,$*,$(false
),CSC
,3)
55 $(call gb_Helper_abbreviate_dirs
,\
56 rm -f
$(call gb_CliLibrary_get_target
,$*) \
60 # Compiles one or more C# source files
62 # gb_CliLibrary_CliLibrary target
63 define gb_CliLibrary_CliLibrary
64 $(call gb_CliAssembly_CliAssembly
,$(1),$(call gb_CliLibrary_get_target
,$(1)))
66 $(call gb_CliLibrary_get_target
,$(1)) : CLI_ASSEMBLIES
:=
67 $(call gb_CliLibrary_get_target
,$(1)) : CLI_SOURCES
:=
68 $(call gb_CliLibrary_get_target
,$(1)) : CLI_CSCFLAGS
:=
69 $(call gb_CliLibrary_get_target
,$(1)) : CLI_KEYFILE
:=
72 $(call gb_CliLibrary_get_target
,$(1)) :|
$(call gb_CliAssembly_get_target
,$(1))
73 $(call gb_CliLibrary_get_target
,$(1)) :|
$(dir $(call gb_CliLibrary_get_target
,$(1))).
dir
74 $(call gb_CliLibrary_get_clean_target
,$(1)) : $(call gb_CliAssembly_get_clean_target
,$(1))
76 $$(eval
$$(call gb_Module_register_target
,$(call gb_CliLibrary_get_target
,$(1)),$(call gb_CliLibrary_get_clean_target
,$(1))))
77 $(call gb_Helper_make_userfriendly_targets
,$(1),CliLibrary
)
79 $(call gb_CliLibrary_get_target
,$(1)) :
80 $$(call gb_CliLibrary__command
,$$@
,$(1))
84 define gb_CliLibrary_set_configfile
85 $(call gb_CliAssembly_set_configfile
,$(1),$(2))
89 define gb_CliLibrary_set_keyfile
90 $(call gb_CliLibrary_get_target
,$(1)) : CLI_KEYFILE
:= $(2)
91 $(call gb_CliAssembly_set_keyfile
,$(1),$(2))
95 define gb_CliLibrary_set_policy
96 $(call gb_CliAssembly_set_policy
,$(1),$(2),$(3))
100 define gb_CliLibrary_use_assembly
101 $(call gb_CliLibrary_get_target
,$(1)) : CLI_ASSEMBLIES
+= $(call gb_CliLibrary_get_target
,$(2))
102 $(call gb_CliLibrary_get_target
,$(1)) : $(call gb_CliLibrary_get_target
,$(2))
106 define gb_CliLibrary_use_assemblies
107 $(foreach assembly
,$(2),$(call gb_CliLibrary_use_assembly
,$(1),$(assembly
)))
111 # Add a source file to compile
112 define gb_CliLibrary_add_csfile
113 $(call gb_CliLibrary_get_target
,$(1)) : CLI_SOURCES
+= $(call gb_CliLibrary__get_source
,$(2))
114 $(call gb_CliLibrary_get_target
,$(1)) : $(call gb_CliLibrary__get_source
,$(2))
118 # Add source files to compile
119 define gb_CliLibrary_add_csfiles
120 $(foreach csfile
,$(2),$(call gb_CliLibrary_add_csfile
,$(1),$(csfile
)))
124 # Add a generated source file to compile
125 define gb_CliLibrary_add_generated_csfile
126 $(call gb_CliLibrary_get_target
,$(1)) : CLI_SOURCES
+= $(call gb_CliLibrary__get_generated_source
,$(2))
127 $(call gb_CliLibrary_get_target
,$(1)) : $(call gb_CliLibrary__get_generated_source
,$(2))
131 # Add generated source files to compile
132 define gb_CliLibrary_add_generated_csfiles
133 $(foreach csfile
,$(2),$(call gb_CliLibrary_add_generated_csfile
,$(1),$(csfile
)))
137 # Add flags used for compilation
138 define gb_CliLibrary_add_csflags
139 $(call gb_CliLibrary_get_target
,$(1)) : CLI_CSCFLAGS
+= $(2)
143 # vim: set noet sw=4 ts=4: