Contents of file 'wiener/Makefile':
1 #
2 # Makefile designed for use with ctangle, cweave, gcc, and plain TeX.
3 #
4 # Copyright (C) 2002-2011, Fredrik Jonsson <http://jonsson.eu>
5 #
6 # The CTANGLE program converts a CWEB source document into a C program
7 # which may be compiled in the usual way. The output file includes #line
8 # specifications so that debugging can be done in terms of the CWEB source
9 # file.
10 #
11 # The CWEAVE program converts the same CWEB file into a TeX file that may
12 # be formatted and printed in the usual way. It takes appropriate care of
13 # typographic details like page layout and the use of indentation, italics,
14 # boldface, etc., and it supplies extensive cross-index information that it
15 # gathers automatically.
16 #
17 # CWEB allows you to prepare a single document containing all the informa-
18 # tion that is needed both to produce a compilable C program and to produce
19 # a well-formatted document describing the program in as much detail as the
20 # writer may desire. The user of CWEB ought to be familiar with TeX as well
21 # as C.
22 #
23 PROJECT = wiener
24 FIGURES = fig1.eps fig2.eps fig3.eps
25
26 CTANGLE = ctangle
27 CWEAVE = cweave
28 CC = gcc
29 CCOPTS = -O2 -Wall -ansi -std=iso9899:1990 -pedantic
30 LNOPTS = -lm
31 TEX = tex
32 DVIPS = dvips
33 DVIPSOPT = -ta4 -D1200
34 PS2PDF = ps2pdf
35 METAPOST = mpost
36
37 all: $(PROJECT) $(FIGURES) $(PROJECT).pdf
38
39 $(PROJECT): $(PROJECT).o
40 $(CC) $(CCOPTS) -o $(PROJECT) $(PROJECT).o $(LNOPTS)
41
42 $(PROJECT).o: $(PROJECT).c
43 $(CC) $(CCOPTS) -c $(PROJECT).c
44
45 $(PROJECT).c: $(PROJECT).w
46 $(CTANGLE) $(PROJECT)
47
48 $(PROJECT).pdf: $(PROJECT).ps
49 $(PS2PDF) $(PROJECT).ps $(PROJECT).pdf
50
51 $(PROJECT).ps: $(PROJECT).dvi
52 $(DVIPS) $(DVIPSOPT) $(PROJECT).dvi -o $(PROJECT).ps
53
54 $(PROJECT).dvi: $(PROJECT).tex
55 $(TEX) $(PROJECT).tex
56
57 $(PROJECT).tex: $(PROJECT).w
58 $(CWEAVE) $(PROJECT)
59
60 #
61 # Generate the Encapsulated PostScript image fig1.eps for the documentation.
62 # This is a 2D scatter plot of the uniformly distributed pseudo-random numbers
63 # prior to having been fed into the Box-Muller transform.
64 #
65 fig1.eps: Makefile $(PROJECT).w
66 ./wiener --uniform -D 2 -M 10000 > fig1.dat;
67 @echo 'input graph;\
68 def mpdot = btex\
69 {\\vrule height 0.5pt width 1.0pt depth 0.5pt}\
70 etex enddef;\
71 beginfig(1);\
72 draw begingraph(86mm,86mm);\
73 setrange(0,0,1,1);\
74 pickup pencircle scaled .5pt;\
75 gdraw "fig1.dat" plot mpdot;\
76 pickup pencircle scaled .25pt;\
77 autogrid(itick bot,itick lft);\
78 glabel.bot(btex $$ x$$ etex,OUT);\
79 glabel.lft(btex $$ y$$ etex,OUT);\
80 endgraph; endfig; end' > fig1.mp
81 $(METAPOST) fig1.mp
82 $(TEX) -jobname=fig1 "\input epsf\nopagenumbers\
83 \centerline{\epsfbox{fig1.1}}\bye"
84 $(DVIPS) -D1200 -E fig1.dvi -o fig1.eps
85
86 #
87 # Generate the Encapsulated PostScript image fig2.eps for the documentation.
88 # This is a 2D scatter plot of the normally distributed pseudo-random numbers
89 # resulting from the Box-Muller transform.
90 #
91 fig2.eps: Makefile $(PROJECT).w
92 ./wiener --normal -D 2 -M 10000 > fig2.dat;
93 @echo 'input graph;\
94 def mpdot = btex\
95 {\\vrule height 0.5pt width 1.0pt depth 0.5pt}\
96 etex enddef;\
97 beginfig(1);\
98 draw begingraph(86mm,86mm);\
99 setrange(whatever,whatever,whatever,whatever);\
100 pickup pencircle scaled .5pt;\
101 gdraw "fig2.dat" plot mpdot;\
102 pickup pencircle scaled .25pt;\
103 autogrid(itick bot,itick lft);\
104 glabel.bot(btex $$ x$$ etex,OUT);\
105 glabel.lft(btex $$ y$$ etex,OUT);\
106 endgraph; endfig; end' > fig2.mp
107 $(METAPOST) fig2.mp
108 $(TEX) -jobname=fig2 "\input epsf\nopagenumbers\
109 \centerline{\epsfbox{fig2.1}}\bye"
110 $(DVIPS) -D1200 -E fig2.dvi -o fig2.eps
111
112 #
113 # Generate the Encapsulated PostScript image fig3.eps for the documentation.
114 # This is a 2D graph showing the resulting simulated Wiener process.
115 #
116 fig3.eps: Makefile $(PROJECT).w
117 ./wiener -D 2 -M 10000 > fig3.dat;
118 @echo 'input graph;\
119 beginfig(1);\
120 draw begingraph(86mm,86mm);\
121 setrange(whatever,whatever,whatever,whatever);\
122 pickup pencircle scaled .5pt;\
123 gdraw "fig3.dat";\
124 pickup pencircle scaled .25pt;\
125 autogrid(itick bot,itick lft);\
126 glabel.bot(btex $$ x$$ etex,OUT);\
127 glabel.lft(btex $$ y$$ etex,OUT);\
128 endgraph; endfig; end' > fig3.mp
129 $(METAPOST) fig3.mp
130 $(TEX) -jobname=fig3 "\input epsf\nopagenumbers\
131 \centerline{\epsfbox{fig3.1}}\bye"
132 $(DVIPS) -D1200 -E fig3.dvi -o fig3.eps
133
134 clean:
135 -rm -Rf $(PROJECT) *~ *.c *.o *.exe *.dat *.pdf *.mp *.trj *.mpx
136 -rm -Rf *.tex *.aux *.log *.toc *.idx *.scn *.dvi *.ps *.1 *.eps
137
138 archive:
139 make -ik clean
140 tar --gzip --directory=../ -cf ../$(PROJECT).tar.gz $(PROJECT)
141
Generated by ::viewsrc::