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
#   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)"; \
112
	echo [$@] Compile CSharp Program ..;
113
endef
114
 
115
#
116
#   Command line flags
117
#
118
csc_flags += /nologo
119
csc_flags += /out:$@
120
 
121
ifndef ADDLINKLIBS
122
csc_flags += /noconfig
123
endif
124
 
125
ifdef NOWARNLIST
126
csc_flags += /nowarn:$(NOWARNLIST)
127
endif
128
 
129
#
130
#   Command line flags
131
#
132
ifdef ALVL
133
csc_defines	+= -DALVL=$(ALVL)
134
endif
135
ifdef DLVL
136
csc_defines	+= -DDLVL=$(DLVL)
137
endif
138
 
139
ifdef USE_WALL
140
csc_flags	+= /warn:4
141
else
142
csc_flags	+= /warn:3
143
endif
144
 
145
ifdef USE_OPTIMISE				# default for production
146
csc_flags	+=                  # Don't optimise production code. Ship what we test
147
else
148
csc_flags	+=
149
endif
150
 
151
ifdef USE_DEBUGINFO				# default for debug
152
csc_flags	+= /debug /debug:full
153
csc_defines	+= -DDEBUG
154
else
155
csc_flags	+= /debug /debug:pdbonly
156
csc_flags	+=
157
endif
158
 
159
ifeq "$(DEBUG)" "1"				# debug/prod specific
160
csc_defines	+= -D_DEBUG
161
else
162
csc_defines	+= -DNDEBUG
163
endif
164
 
165
#
166
#   Convert Definitions to a suitable format
167
#   Many users use -Dxxxx for Compiler definitions
168
#   Maintain this and convert them to a correct form
169
#
170
csc_flags += $(patsubst -D%,/define:%,$(CFLAGS)$(csc_defines))
171
 
172
 
173
#
174
#   Insert the library search paths into the start of the command file
255 dpurdie 175
#   Create lines of the form: "/lib:<pathname>"
176
#       Put all in quotes to allow for paths with spaces
227 dpurdie 177
#
255 dpurdie 178
vc_ldflags	= $(subst $(spacealt),$(space),$(patsubst %,\"/lib:%\"\\n,$(subst /,\\\\,$(ALL_LIBDIRS))))
227 dpurdie 179
 
180
#
181
#   Cleanup definitions
182
#
183
ifndef LEAVETMP
184
define csc_post
185
	$(rm) -f $(csc_cmdfile)
186
endef
187
else
188
define csc_post
189
endef
190
endif
191
 
192
 
193
#
194
#   Recipes to support the creation of Linker Dependency files
195
#   These will generate .dep files
196
#
197
#   The dependancy list is based an a makefile definition
198
#   The definition is named after the target
199
#
200
define LDDEPEND
201
	$(AA_PRE)$(cmdfile) -wkWeo$(@) \
202
		"$($(notdir $(basename $@))_dp)";
203
endef
204
 
205
define SHLDDEPEND
206
	$(AA_PRE)$(cmdfile) -wkWeo$(@) \
207
		"$($(notdir $(SHNAME))_shdp)";
208
endef
209
 
210
 
211
#
212
#       Recipe to create a file that contains the StrongNameKey assembly
213
#       Args:   $1 Tag of the definitiosn that will go into the file
214
#
215
#
216
define GenSnkWrapper
217
    @$(echo) "[$@] Create StrongKey Wrapper.."
218
    $(AA_PRE)$(cmdfile) -wkWeo$(@) "$($1)";
219
endef
220