ICE 3.4.2
[php5-ice-freebsdport.git] / cs / config / Make.rules.cs
blob1526489435a42a6291a84c19501b32f88a1fe94b
1 # **********************************************************************
3 # Copyright (c) 2003-2011 ZeroC, Inc. All rights reserved.
5 # This copy of Ice is licensed to you under the terms described in the
6 # ICE_LICENSE file included in this distribution.
8 # **********************************************************************
11 # Select an installation base directory. The directory will be created
12 # if it does not exist.
15 prefix ?= /opt/Ice-$(VERSION)
18 # The default behavior of 'make install' is to install the Ice for .NET
19 # libraries in the 'bin' directory. If you would prefer to
20 # install these libraries in the GAC, set GACINSTALL to yes.
23 #GACINSTALL = yes
26 # Ice invokes unmanaged code to implement the following features:
28 # - Protocol compression
29 # - Signal processing in the Ice.Application class (Windows only)
31 # Enable MANAGED below if you do not require these features and prefer that
32 # the Ice run time use only managed code.
35 #MANAGED = yes
38 # Define DEBUG as yes if you want to build with debug information and
39 # assertions enabled.
42 DEBUG = yes
45 # Define OPTIMIZE as yes if you want to build with optmization.
48 #OPTIMIZE = yes
51 # Set the key file used to sign assemblies.
54 KEYFILE ?= $(top_srcdir)/../config/IceDevKey.snk
56 # ----------------------------------------------------------------------
57 # Don't change anything below this line!
58 # ----------------------------------------------------------------------
61 # Common definitions
63 ice_language = cs
64 slice_translator = slice2cs
66 ifeq ($(shell test -f $(top_srcdir)/config/Make.common.rules && echo 0),0)
67 include $(top_srcdir)/config/Make.common.rules
68 else
69 include $(top_srcdir)/../config/Make.common.rules
70 endif
72 DSEP = /
74 bindir = $(top_srcdir)/bin
76 install_bindir = $(prefix)/bin
78 install_libdir = $(prefix)/lib
80 install_pkgconfigdir = $(prefix)/lib/pkgconfig
82 ifeq ($(ice_dir),/usr)
83 ref = -pkg:$(1)
84 else
85 ifdef ice_src_dist
86 ref = -r:$(bindir)/$(1).dll
87 else
88 ifeq ($(shell test -d $(ice_dir)/lib/pkgconfig && echo 0),0)
89 export PKG_CONFIG_PATH := $(ice_dir)/lib/pkgconfig:$(PKG_CONFIG_PATH)
90 ref = -pkg:$(1)
91 else
92 ref = -r:$(ice_dir)/bin/$(1).dll
93 endif
94 endif
95 endif
97 GACUTIL = gacutil
99 # MDB files are generated only for debug builds. For debug, with a GAC
100 # install gacutil installs the .mdb into the GAC.
101 installmdb = /bin/true
103 ifeq ($(GACINSTALL),yes)
104 ifeq ($(GAC_ROOT),)
105 installassembly = ([ -n "$(2)" ] && pkgopt="-package $(2)"; $(GACUTIL) -i $(1) -f $$pkgopt)
106 installpolicy = $(GACUTIL) -i $(1).dll -f
107 else
108 installassembly = ([ -n "$(2)" ] && pkgopt="-package $(2)"; $(GACUTIL) -i $(1) -f $$pkgopt -root $(GAC_ROOT))
109 installpolicy = $(GACUTIL) -i $(1).dll -f -root $(GAC_ROOT)
110 endif
111 else
112 installassembly = $(INSTALL_LIBRARY) $(1) $(install_bindir); \
113 chmod a+rx $(install_bindir)/$(notdir $(1))
114 installpolicy = $(INSTALL_LIBRARY) $(1).dll $(install_bindir); \
115 $(INSTALL_LIBRARY) $(1) $(install_bindir); \
116 chmod a+rx $(install_bindir)/$(notdir $(1).dll); \
117 chmod a+r $(install_bindir)/$(notdir $(1))
118 ifeq ($(DEBUG),yes)
119 installmdb = $(INSTALL_LIBRARY) $(1) $(install_bindir); \
120 chmod a+rx $(install_bindir)/$(notdir $(1))
121 endif
122 endif
125 # Do not generate policy files for beta (x.y.51) or minor (x.y.0) releases.
127 generate_policies = $(shell test $(VERSION_PATCH) -gt 0 -a $(VERSION_PATCH) -lt 51 && echo "yes")
129 ifneq ($(generate_policies),yes)
130 installpolicy = /bin/true
131 endif
133 MCS = gmcs
135 MCSFLAGS = -warnaserror -d:MAKEFILE_BUILD
136 ifeq ($(DEBUG),yes)
137 MCSFLAGS := $(MCSFLAGS) -debug -define:DEBUG
138 endif
140 ifeq ($(OPTIMIZE),yes)
141 MCSFLAGS := $(MCSFLAGS) -optimize+
142 endif
144 ifdef ice_src_dist
145 ifeq ($(ice_cpp_dir), $(ice_dir)/cpp)
146 SLICE2CS = $(ice_cpp_dir)/bin/slice2cs
147 SLICEPARSERLIB = $(ice_cpp_dir)/lib/$(call mklibfilename,Slice,$(VERSION))
148 else
149 SLICE2CS = $(ice_cpp_dir)/$(binsubdir)/slice2cs
150 SLICEPARSERLIB = $(ice_cpp_dir)/$(libsubdir)/$(call mklibfilename,Slice,$(VERSION))
151 endif
152 else
153 SLICE2CS = $(ice_dir)/$(binsubdir)/slice2cs
154 SLICEPARSERLIB = $(ice_dir)/$(libsubdir)/$(call mklibfilename,Slice,$(VERSION))
155 endif
157 AL = al
158 POLICY = policy.$(SHORT_VERSION).$(PKG)
160 ifeq ($(generate_policies),yes)
162 ifneq ($(PUBLIC_KEY_TOKEN),)
163 publicKeyToken = $(PUBLIC_KEY_TOKEN)
164 else
165 ifneq ($(ice_src_dist),)
166 publicKeyToken = $(shell sn -q -p $(KEYFILE) tmp.pub; \
167 sn -q -t tmp.pub | sed 's/^.* //'; \
168 rm tmp.pub)
169 else
170 publicKeyToken = $(shell sn -q -T $(bindir)/Ice.dll >tmp.pub; \
171 sed 's/^.* //' <tmp.pub; \
172 rm tmp.pub)
173 endif
174 endif
176 ifneq ($(POLICY_TARGET),)
178 $(bindir)/$(POLICY_TARGET):
179 @echo -e " \
180 <configuration> \n \
181 <runtime> \n \
182 <assemblyBinding xmlns=\"urn:schemas-microsoft-com:asm.v1\"> \n \
183 <dependentAssembly> \n \
184 <assemblyIdentity name=\"$(PKG)\" publicKeyToken=\"$(publicKeyToken)\" culture=\"\"/> \n \
185 <publisherPolicy apply=\"yes\"/> \n \
186 <bindingRedirect oldVersion=\"$(SHORT_VERSION).0.0 - $(SHORT_VERSION).1.0\" newVersion=\"$(VERSION).0\"/> \n \
187 </dependentAssembly> \n \
188 </assemblyBinding> \n \
189 </runtime> \n \
190 </configuration>" >$(POLICY)
191 $(AL) /link:$(POLICY) /version:0.0.0.0 /out:$(POLICY_TARGET) /keyfile:$(KEYFILE)
192 chmod a+r $(POLICY)
193 chmod a+rx $(POLICY_TARGET)
194 mv $(POLICY) $(POLICY_TARGET) $(bindir)
196 clean::
197 -rm -f $(bindir)/$(POLICY) $(bindir)/$(POLICY_TARGET)
199 endif
201 endif
203 GEN_SRCS = $(subst .ice,.cs,$(addprefix $(GDIR)/,$(notdir $(SLICE_SRCS))))
204 CGEN_SRCS = $(subst .ice,.cs,$(addprefix $(GDIR)/,$(notdir $(SLICE_C_SRCS))))
205 SGEN_SRCS = $(subst .ice,.cs,$(addprefix $(GDIR)/,$(notdir $(SLICE_S_SRCS))))
206 GEN_AMD_SRCS = $(subst .ice,.cs,$(addprefix $(GDIR)/,$(notdir $(SLICE_AMD_SRCS))))
207 SAMD_GEN_SRCS = $(subst .ice,.cs,$(addprefix $(GDIR)/,$(notdir $(SLICE_SAMD_SRCS))))
210 EVERYTHING = all depend clean install
212 .SUFFIXES:
213 .SUFFIXES: .cs .ice
215 %.cs: %.ice
216 $(SLICE2CS) $(SLICE2CSFLAGS) $<
218 $(GDIR)/%.cs: $(SDIR)/%.ice
219 $(SLICE2CS) --output-dir $(GDIR) $(SLICE2CSFLAGS) $<
221 all:: $(TARGETS)
223 ifeq ($(generate_policies),yes)
224 ifneq ($(POLICY_TARGET),)
225 all:: $(bindir)/$(POLICY_TARGET)
226 endif
227 endif
229 ifneq ($(TARGETS_CONFIG),)
230 all:: $(TARGETS_CONFIG)
231 endif
233 depend:: $(SLICE_SRCS) $(SLICE_C_SRCS) $(SLICE_S_SRCS) $(SLICE_AMD_SRCS) $(SLICE_SAMD_SRCS)
234 -rm -f .depend .depend.mak
235 if test -n "$(SLICE_SRCS)" ; then \
236 $(SLICE2CS) --depend $(SLICE2CSFLAGS) $(SLICE_SRCS) | $(ice_dir)/config/makedepend.py; \
238 if test -n "$(SLICE_C_SRCS)" ; then \
239 $(SLICE2CS) --depend $(SLICE2CSFLAGS) $(SLICE_C_SRCS) | $(ice_dir)/config/makedepend.py; \
241 if test -n "$(SLICE_S_SRCS)" ; then \
242 $(SLICE2CS) --depend $(SLICE2CSFLAGS) $(SLICE_S_SRCS) | $(ice_dir)/config/makedepend.py; \
244 if test -n "$(SLICE_AMD_SRCS)" ; then \
245 $(SLICE2CS) --depend $(SLICE2CSFLAGS) $(SLICE_AMD_SRCS) | $(ice_dir)/config/makedepend.py; \
247 if test -n "$(SLICE_SAMD_SRCS)" ; then \
248 $(SLICE2CS) --depend $(SLICE2CSFLAGS) $(SLICE_SAMD_SRCS) | $(ice_dir)/config/makedepend.py; \
251 clean::
252 -rm -f $(TARGETS) $(patsubst %,%.mdb,$(TARGETS)) *.bak *.dll *.pdb *.mdb
254 ifneq ($(SLICE_SRCS),)
255 clean::
256 -rm -f $(GEN_SRCS)
257 endif
258 ifneq ($(SLICE_C_SRCS),)
259 clean::
260 -rm -f $(CGEN_SRCS)
261 endif
262 ifneq ($(SLICE_S_SRCS),)
263 clean::
264 -rm -f $(SGEN_SRCS)
265 endif
266 ifneq ($(SLICE_AMD_SRCS),)
267 clean::
268 -rm -f $(GEN_AMD_SRCS)
269 endif
270 ifneq ($(SLICE_SAMD_SRCS),)
271 clean::
272 -rm -f $(SAMD_GEN_SRCS)
273 endif
275 ifneq ($(TARGETS_CONFIG),)
276 clean::
277 -rm -f $(TARGETS_CONFIG)
278 endif
280 install::