# # Makefile designed for use with ctangle, cweave, gcc, and plain TeX. # # Copyright (C) 2002-2011, Fredrik Jonsson # # The CTANGLE program converts a CWEB source document into a C program # which may be compiled in the usual way. The output file includes #line # specifications so that debugging can be done in terms of the CWEB source # file. # # The CWEAVE program converts the same CWEB file into a TeX file that may # be formatted and printed in the usual way. It takes appropriate care of # typographic details like page layout and the use of indentation, italics, # boldface, etc., and it supplies extensive cross-index information that it # gathers automatically. # # CWEB allows you to prepare a single document containing all the informa- # tion that is needed both to produce a compilable C program and to produce # a well-formatted document describing the program in as much detail as the # writer may desire. The user of CWEB ought to be familiar with TeX as well # as C. # PROJECT = wiener FIGURES = fig1.eps fig2.eps fig3.eps CTANGLE = ctangle CWEAVE = cweave CC = gcc CCOPTS = -O2 -Wall -ansi -std=iso9899:1990 -pedantic LNOPTS = -lm TEX = tex DVIPS = dvips DVIPSOPT = -ta4 -D1200 PS2PDF = ps2pdf METAPOST = mpost all: $(PROJECT) $(FIGURES) $(PROJECT).pdf $(PROJECT): $(PROJECT).o $(CC) $(CCOPTS) -o $(PROJECT) $(PROJECT).o $(LNOPTS) $(PROJECT).o: $(PROJECT).c $(CC) $(CCOPTS) -c $(PROJECT).c $(PROJECT).c: $(PROJECT).w $(CTANGLE) $(PROJECT) $(PROJECT).pdf: $(PROJECT).ps $(PS2PDF) $(PROJECT).ps $(PROJECT).pdf $(PROJECT).ps: $(PROJECT).dvi $(DVIPS) $(DVIPSOPT) $(PROJECT).dvi -o $(PROJECT).ps $(PROJECT).dvi: $(PROJECT).tex $(TEX) $(PROJECT).tex $(PROJECT).tex: $(PROJECT).w $(CWEAVE) $(PROJECT) # # Generate the Encapsulated PostScript image fig1.eps for the documentation. # This is a 2D scatter plot of the uniformly distributed pseudo-random numbers # prior to having been fed into the Box-Muller transform. # fig1.eps: Makefile $(PROJECT).w ./wiener --uniform -D 2 -M 10000 > fig1.dat; @echo 'input graph;\ def mpdot = btex\ {\\vrule height 0.5pt width 1.0pt depth 0.5pt}\ etex enddef;\ beginfig(1);\ draw begingraph(86mm,86mm);\ setrange(0,0,1,1);\ pickup pencircle scaled .5pt;\ gdraw "fig1.dat" plot mpdot;\ pickup pencircle scaled .25pt;\ autogrid(itick bot,itick lft);\ glabel.bot(btex $$ x$$ etex,OUT);\ glabel.lft(btex $$ y$$ etex,OUT);\ endgraph; endfig; end' > fig1.mp $(METAPOST) fig1.mp $(TEX) -jobname=fig1 "\input epsf\nopagenumbers\ \centerline{\epsfbox{fig1.1}}\bye" $(DVIPS) -D1200 -E fig1.dvi -o fig1.eps # # Generate the Encapsulated PostScript image fig2.eps for the documentation. # This is a 2D scatter plot of the normally distributed pseudo-random numbers # resulting from the Box-Muller transform. # fig2.eps: Makefile $(PROJECT).w ./wiener --normal -D 2 -M 10000 > fig2.dat; @echo 'input graph;\ def mpdot = btex\ {\\vrule height 0.5pt width 1.0pt depth 0.5pt}\ etex enddef;\ beginfig(1);\ draw begingraph(86mm,86mm);\ setrange(whatever,whatever,whatever,whatever);\ pickup pencircle scaled .5pt;\ gdraw "fig2.dat" plot mpdot;\ pickup pencircle scaled .25pt;\ autogrid(itick bot,itick lft);\ glabel.bot(btex $$ x$$ etex,OUT);\ glabel.lft(btex $$ y$$ etex,OUT);\ endgraph; endfig; end' > fig2.mp $(METAPOST) fig2.mp $(TEX) -jobname=fig2 "\input epsf\nopagenumbers\ \centerline{\epsfbox{fig2.1}}\bye" $(DVIPS) -D1200 -E fig2.dvi -o fig2.eps # # Generate the Encapsulated PostScript image fig3.eps for the documentation. # This is a 2D graph showing the resulting simulated Wiener process. # fig3.eps: Makefile $(PROJECT).w ./wiener -D 2 -M 10000 > fig3.dat; @echo 'input graph;\ beginfig(1);\ draw begingraph(86mm,86mm);\ setrange(whatever,whatever,whatever,whatever);\ pickup pencircle scaled .5pt;\ gdraw "fig3.dat";\ pickup pencircle scaled .25pt;\ autogrid(itick bot,itick lft);\ glabel.bot(btex $$ x$$ etex,OUT);\ glabel.lft(btex $$ y$$ etex,OUT);\ endgraph; endfig; end' > fig3.mp $(METAPOST) fig3.mp $(TEX) -jobname=fig3 "\input epsf\nopagenumbers\ \centerline{\epsfbox{fig3.1}}\bye" $(DVIPS) -D1200 -E fig3.dvi -o fig3.eps clean: -rm -Rf $(PROJECT) *~ *.c *.o *.exe *.dat *.pdf *.mp *.trj *.mpx -rm -Rf *.tex *.aux *.log *.toc *.idx *.scn *.dvi *.ps *.1 *.eps archive: make -ik clean tar --gzip --directory=../ -cf ../$(PROJECT).tar.gz $(PROJECT)