Subversion Repositories DevTools

Rev

Rev 335 | Go to most recent revision | Details | Compare with Previous | 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
#   Standard library paths
255 dpurdie 27
#   Export CS_LIB as this is used by the library generation process to determine
28
#   the locations of libraries. cmdfile will use 'CS_LIB" for vglob resolving
29
#   process.
227 dpurdie 30
#
255 dpurdie 31
#	VC_LIB	    - Lib paths from Compiler toolkit
32
#		    - ';' seperated path list
33
#		    - Uses \ or / as a dir sep
34
#		    - Uses real spaces in pathnames
35
#		    - Should be Absolute Paths
36
#                   
37
#	LIBDIRS	    - Lib paths from JATS
38
#		    - Space seperated path list
39
#		    - Uses / as dir sep
40
#		    - Must not contain spaces
41
#		    - Will be Relative
227 dpurdie 42
#
255 dpurdie 43
#	ALL_LIBDIRS and LIB
44
#		    - Only contain valid paths
45
#		      VS2005 will complain about bad LIB entries
46
#		      Use $(wildcard ...) to limit to test for existence
47
#		    - Contain absolute paths
48
#		      msdev/devenv don't work with relative paths
49
#		      Use $(abspath ...) to convert
50
#
51
#	ALL_LIBDIRS - Used internally
52
#		    - Space seperated path list
53
#		    - Uses / as dir sep
54
#		    - Uses %20 as a altspace in pathnames
55
#                   
56
#	LIB         - Exported to tools
57
#		    - ';' seperated path list
58
#		    - Uses \ as a dir sep
59
#		    - Uses real spaces in pathnames
227 dpurdie 60
#..
61
 
255 dpurdie 62
vc_libs     := $(subst ;,$(space),$(subst \,/,$(subst $(space),$(spacealt),$(VC_LIB))))
63
ALL_LIBDIRS := $(wildcard $(call myabspath,$(LIBDIRS))) $(vc_libs)
64
CS_LIB      := $(subst $(spacealt),$(space),$(subst $(space),$(empty),$(patsubst %,%;,$(subst /,\,$(ALL_LIBDIRS)))))
65
export CS_LIB
66
 
67
#one_per_line = $(foreach aa,$2,$(info $1 :: $(subst $(spacealt),$(space),$(aa))))
68
#$(call one_per_line,Good LIBDIRS,$(ALL_LIBDIRS))
69
 
227 dpurdie 70
###############################################################################
71
#
255 dpurdie 72
#.. Resource Generator
227 dpurdie 73
#
74
define RESGEN
75
	@$(echo) [$@] Compile Resource ..
76
	@$(show_environment)
77
	$(XX_PRE) resgen $(subst /,\\,$(filter %.resx,$^)) $(subst /,\\,$@)
78
endef
79
 
80
#
81
#.. CSharp Compiler
82
#   Used to create Programs a DLLs
83
#
84
define CSC
85
	$(AA_PRE)$(csc_pre)
86
	@$(show_environment)
87
	$(csc) $(csc_flags) $(csc_o_switch)
88
	$(AA_PRE)$(csc_post)
89
endef
90
 
91
#
92
#   Definitions for the CSharp Compiler Macro
93
#       csc_pre                 - Before the CSC command
94
#       csc                     - The CSC command
95
#       csc_flags               - Command line options (visible)
96
#       csc_o_switch            - Command line output options (visible)
97
#       csc_post                - CSC command cleanup
98
#       csc_cmdfile             - Name of the generated response file
99
#       csc_defines             - Local definitions will be placed on cmd line
100
#
101
csc_pre =
102
csc = $(CC_PRE) csc
103
csc_flags =
255 dpurdie 104
csc_o_switch = @$(csc_cmdfile)
227 dpurdie 105
csc_post =
106
csc_cmdfile	= $(basename $@).ld
107
csc_defines =
108
 
109
define csc_pre
110
	$(cmdfile) -wkWeo$(csc_cmdfile) \
111
		"$(vc_ldflags)$($(notdir $(basename $@))_ld)"; \
351 dpurdie 112
	echo [$@] Compile CSharp Program ..;\
113
        $(call show_cmdfile,$(csc_cmdfile))
227 dpurdie 114
endef
115
 
116
#
117
#   Command line flags
118
#
119
csc_flags += /nologo
120
csc_flags += /out:$@
121
 
122
ifndef ADDLINKLIBS
123
csc_flags += /noconfig
124
endif
125
 
351 dpurdie 126
ifdef NET_PLATFORM
127
csc_flags += /platform:$(NET_PLATFORM)
128
endif
129
 
227 dpurdie 130
ifdef NOWARNLIST
131
csc_flags += /nowarn:$(NOWARNLIST)
132
endif
133
 
134
#
135
#   Command line flags
136
#
137
ifdef ALVL
138
csc_defines	+= -DALVL=$(ALVL)
139
endif
140
ifdef DLVL
141
csc_defines	+= -DDLVL=$(DLVL)
142
endif
143
 
144
ifdef USE_WALL
145
csc_flags	+= /warn:4
146
else
147
csc_flags	+= /warn:3
148
endif
149
 
150
ifdef USE_OPTIMISE				# default for production
351 dpurdie 151
csc_flags	+=                  		# Don't optimise production code. Ship what we test
227 dpurdie 152
else
153
csc_flags	+=
154
endif
155
 
156
ifdef USE_DEBUGINFO				# default for debug
157
csc_flags	+= /debug /debug:full
158
csc_defines	+= -DDEBUG
159
else
160
csc_flags	+= /debug /debug:pdbonly
161
csc_flags	+=
162
endif
163
 
164
ifeq "$(DEBUG)" "1"				# debug/prod specific
165
csc_defines	+= -D_DEBUG
166
else
167
csc_defines	+= -DNDEBUG
168
endif
169
 
170
#
171
#   Convert Definitions to a suitable format
172
#   Many users use -Dxxxx for Compiler definitions
173
#   Maintain this and convert them to a correct form
174
#
175
csc_flags += $(patsubst -D%,/define:%,$(CFLAGS)$(csc_defines))
176
 
177
 
178
#
179
#   Insert the library search paths into the start of the command file
255 dpurdie 180
#   Create lines of the form: "/lib:<pathname>"
181
#       Put all in quotes to allow for paths with spaces
227 dpurdie 182
#
255 dpurdie 183
vc_ldflags	= $(subst $(spacealt),$(space),$(patsubst %,\"/lib:%\"\\n,$(subst /,\\\\,$(ALL_LIBDIRS))))
227 dpurdie 184
 
185
#
186
#   Cleanup definitions
187
#
188
ifndef LEAVETMP
189
define csc_post
190
	$(rm) -f $(csc_cmdfile)
191
endef
192
else
193
define csc_post
194
endef
195
endif
196
 
197
 
198
#
199
#   Recipes to support the creation of Linker Dependency files
200
#   These will generate .dep files
201
#
202
#   The dependancy list is based an a makefile definition
203
#   The definition is named after the target
204
#
205
define LDDEPEND
335 dpurdie 206
	$(AA_PRE)$(cmdfile) -wkWeo$(@) "$($(DPLIST))"
227 dpurdie 207
endef
208
 
209
define SHLDDEPEND
335 dpurdie 210
	$(AA_PRE)$(cmdfile) -wkWeo$(@) "$($(DPLIST))"
227 dpurdie 211
endef
212
 
213
 
214
#
215
#       Recipe to create a file that contains the StrongNameKey assembly
216
#       Args:   $1 Tag of the definitiosn that will go into the file
217
#
218
#
219
define GenSnkWrapper
220
    @$(echo) "[$@] Create StrongKey Wrapper.."
221
    $(AA_PRE)$(cmdfile) -wkWeo$(@) "$($1)";
222
endef
223