Subversion Repositories DevTools

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
227 dpurdie 1
###############################################################################
2
# File:         TOOLSET/csharp.rul[e]
3
# Contents:     Visual C/C++ CSHARP rules
4
#
5
#............................................................................#
6
 
7
###############################################################################
8
#..     Remove "undef" warnings
9
#
10
 
11
###############################################################################
12
#..     Parse user options
13
#       Global options already parsed
14
#       These options extend the global options
15
#
16
 
17
ifdef OPTIONS
18
 
19
ifneq "$(findstring wall,$(OPTIONS))" ""        # Enable all warnings
20
USE_WALL	= 1
21
endif
22
 
23
endif
24
 
25
 
26
###############################################################################
27
#   Standard library paths
28
#   Export LIB as this is used by the library generation process to determine
29
#   the locations of libraries. cmdfile will use 'LIB" for vglob resolving
30
#
31
#   Take care of spaces
32
#
33
#..
34
vc_libs		=\
35
		$(subst ;,$(space),$(subst \,/,$(subst $(space),$(spacealt),$(VC_LIB))))
36
 
37
ALL_LIBDIRS = $(LIBDIRS);$(vc_libs)
38
LIB		=\
39
		$(subst $(spacealt),$(space),$(subst $(space),$(empty),$(patsubst %,%;,$(subst /,\,$(ALL_LIBDIRS)))))
40
export LIB
41
 
42
###############################################################################
43
#
44
#.. Resource Genorator
45
#
46
define RESGEN
47
	@$(echo) [$@] Compile Resource ..
48
	@$(show_environment)
49
	$(XX_PRE) resgen $(subst /,\\,$(filter %.resx,$^)) $(subst /,\\,$@)
50
endef
51
 
52
#
53
#.. CSharp Compiler
54
#   Used to create Programs a DLLs
55
#
56
define CSC
57
	$(AA_PRE)$(csc_pre)
58
	@$(show_environment)
59
	$(csc) $(csc_flags) $(csc_o_switch)
60
	$(AA_PRE)$(csc_post)
61
endef
62
 
63
#
64
#   Definitions for the CSharp Compiler Macro
65
#       csc_pre                 - Before the CSC command
66
#       csc                     - The CSC command
67
#       csc_flags               - Command line options (visible)
68
#       csc_o_switch            - Command line output options (visible)
69
#       csc_post                - CSC command cleanup
70
#       csc_cmdfile             - Name of the generated response file
71
#       csc_defines             - Local definitions will be placed on cmd line
72
#
73
csc_pre =
74
csc = $(CC_PRE) csc
75
csc_flags =
76
csc_o_switch = $(csc_flags) @$(csc_cmdfile)
77
csc_post =
78
csc_cmdfile	= $(basename $@).ld
79
csc_defines =
80
 
81
define csc_pre
82
	$(cmdfile) -wkWeo$(csc_cmdfile) \
83
		"$(vc_ldflags)$($(notdir $(basename $@))_ld)"; \
84
	echo [$@] Compile CSharp Program ..;
85
endef
86
 
87
#
88
#   Command line flags
89
#
90
csc_flags += /nologo
91
csc_flags += /out:$@
92
 
93
ifndef ADDLINKLIBS
94
csc_flags += /noconfig
95
endif
96
 
97
ifdef NOWARNLIST
98
csc_flags += /nowarn:$(NOWARNLIST)
99
endif
100
 
101
#
102
#   Command line flags
103
#
104
ifdef ALVL
105
csc_defines	+= -DALVL=$(ALVL)
106
endif
107
ifdef DLVL
108
csc_defines	+= -DDLVL=$(DLVL)
109
endif
110
 
111
ifdef USE_WALL
112
csc_flags	+= /warn:4
113
else
114
csc_flags	+= /warn:3
115
endif
116
 
117
ifdef USE_OPTIMISE				# default for production
118
csc_flags	+=                  # Don't optimise production code. Ship what we test
119
else
120
csc_flags	+=
121
endif
122
 
123
ifdef USE_DEBUGINFO				# default for debug
124
csc_flags	+= /debug /debug:full
125
csc_defines	+= -DDEBUG
126
else
127
csc_flags	+= /debug /debug:pdbonly
128
csc_flags	+=
129
endif
130
 
131
ifeq "$(DEBUG)" "1"				# debug/prod specific
132
csc_defines	+= -D_DEBUG
133
else
134
csc_defines	+= -DNDEBUG
135
endif
136
 
137
#
138
#   Convert Definitions to a suitable format
139
#   Many users use -Dxxxx for Compiler definitions
140
#   Maintain this and convert them to a correct form
141
#
142
csc_flags += $(patsubst -D%,/define:%,$(CFLAGS)$(csc_defines))
143
 
144
 
145
#
146
#   Insert the library search paths into the start of the command file
147
#
148
vc_ldflags	= \
149
		$(subst $(spacealt),$(space),$(patsubst %,/lib:\"%\"\\n,$(subst /,\\\\,$(LIBDIRS))))\
150
		$(subst $(spacealt),$(space),$(patsubst %,/lib:\"%\"\\n,$(subst /,\\\\,$(vc_libs))))
151
 
152
 
153
#
154
#   Cleanup definitions
155
#
156
ifndef LEAVETMP
157
define csc_post
158
	$(rm) -f $(csc_cmdfile)
159
endef
160
else
161
define csc_post
162
endef
163
endif
164
 
165
 
166
#
167
#   Recipes to support the creation of Linker Dependency files
168
#   These will generate .dep files
169
#
170
#   The dependancy list is based an a makefile definition
171
#   The definition is named after the target
172
#
173
define LDDEPEND
174
	$(AA_PRE)$(cmdfile) -wkWeo$(@) \
175
		"$($(notdir $(basename $@))_dp)";
176
endef
177
 
178
define SHLDDEPEND
179
	$(AA_PRE)$(cmdfile) -wkWeo$(@) \
180
		"$($(notdir $(SHNAME))_shdp)";
181
endef
182
 
183
 
184
#
185
#       Recipe to create a file that contains the StrongNameKey assembly
186
#       Args:   $1 Tag of the definitiosn that will go into the file
187
#
188
#
189
define GenSnkWrapper
190
    @$(echo) "[$@] Create StrongKey Wrapper.."
191
    $(AA_PRE)$(cmdfile) -wkWeo$(@) "$($1)";
192
endef
193