E.3
Using nmake
You can use nmake to automate many tasks
that build assemblies and modules. Here's an example
that shows many of the previous command lines in a cohesive manner.
Particular nmake features to note are the use of
the.SUFFIXES keyword to add a
definition for the .cs file extension and the
use of the response file with the C# compiler, for when more source
file names are supplied than can be listed on the command line.
REF=/r:c.dll
DEBUG=/debug
.SUFFIXES: .exe .dll .cs .netmodule
.cs.netmodule:
csc /t:module $*.cs
.cs.exe:
csc $(DEBUG) $(REF) @<<big.tmp
$*.cs $(SRCLIST)
<<
all : d.exe f.exe
d.exe : d.cs c.dll
c.dll : a.netmodule b.netmodule
al /out:c.dll a.netmodule b.netmodule
b.netmodule : b.cs
a.netmodule : a.cs
key.snk :
sn -k $*.snk
e.dll : a.netmodule b.netmodule key.snk
al /out:$*.dll /keyfile:key.snk a.netmodule b.netmodule
gacutil /i $*.dll
f.exe : f.cs e.dll
csc $(DEBUG) /r:.\e.dll f.cs
clean:
gacutil /u e
del key.snk *.netmodule c.dll d.exe e.dll f.exe *.pdb /q