Catch exceptions in WvDBI_MSSQL constructor and call Dispose().
[versaplex.git] / wvdotnet / monorules.mk
blobe066ec985cea65bfa910f2ed418b4b59fafaae33
1 default: all
3 SHELL=/bin/bash
5 # cc -E tries to guess by extension what to do with the file.
6 # And it does other weird things. cpp seems to Just Work(tm), so use that for
7 # our C# (.cs) files
8 CSCPP=cpp
10 # Cygwin supports symlinks, but they aren't actually useful outside cygwin,
11 # so let's just copy instead. We also use Microsoft's .net compiler instead
12 # of mono.
13 ifeq ($(OS),Windows_NT)
14 CSC?=csc
15 SYMLINK=cp
16 MONORUN=
17 else
18 CSC?=gmcs -langversion:linq
19 SYMLINK=ln -sf
20 PKGS += /r:Mono.Posix
21 MONORUN=mono --debug
22 endif
24 CSFLAGS=/warn:4 /debug
25 #CSFLAGS += /warnaserror
27 TESTRUNNER=$(WVDOTNET)/wvtestrunner.pl
29 # Rules for generating autodependencies on header files
30 $(patsubst %.cs.E,%.d,$(filter %.cs.E,$(FILES))): %.d: %.cs
31 @echo Generating dependency file $@ for $<
32 @set -e; set -o pipefail; rm -f $@; (\
33 ($(CSCPP) -M -MM -MQ '$@' $(CPPFLAGS) $< && echo Makefile) \
34 | paste -s -d ' ' - && \
35 $(CSCPP) -M -MM -MQ '$<'.E $(CPPFLAGS) $< \
36 ) > $@ \
37 || (rm -f $@ && echo "Error generating dependency file." && exit 1)
39 include $(patsubst %.cs.E,%.d,$(filter %.cs.E,$(FILES)))
41 # Rule for actually preprocessing source files with headers
42 %.cs.E: %.cs
43 @rm -f $@
44 set -o pipefail; $(CSCPP) $(CPPFLAGS) -C -dI $< \
45 | expand -8 \
46 | sed -e 's,^#include,//#include,' \
47 | grep -v '^# [0-9]' \
48 >$@ || (rm -f $@ && exit 1)
51 define csbuild
52 @for d in $(filter ../%.dll,$^); do \
53 rm -f $$(basename $$d); \
54 $(SYMLINK) -v $$d .; \
55 done
56 $(CSC) $(CSFLAGS) /target:$1 /out:$@ \
57 $(PKGS) \
58 $(filter %.cs.E %.cs,$^) \
59 $(patsubst %.dll,/r:%.dll,$(filter %.dll,$^))
60 endef
63 %.dll: assemblyinfo.cs
64 $(call csbuild,library)
66 # This must come before the %.cs rule, since %.cs.E files are better.
67 %.exe: %.cs.E
68 $(call csbuild,exe)
70 %.exe: %.cs
71 $(call csbuild,exe)
73 %: %.exe
74 rm -f $@
75 $(SYMLINK) $< $@
77 %.pass: %.exe
78 rm -f $@
79 $(TESTRUNNER) $(MONORUN) ./$^
80 touch $@
82 clean::
83 rm -f *~ *.E *.d *.exe *.dll *.mdb *.pdb