Return to previous page

Contents of file 'sgfilter/Makefile':




Deprecated: Function split() is deprecated in /storage/content/45/2011745/jonsson.eu/public_html/php/htmlicise.php on line 46
    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  = sgfilter
   24   EXAMPLE  = example
   25   FIGURES  = fig0 fig1 fig2 fig3 fig4 fig5 fig6
   26   CTANGLE  = ctangle
   27   CWEAVE   = cweave
   28   CC       = gcc
   29   CCOPTS   = -O2 -Wall -ansi -std=iso9899:1999 -pedantic
   30   LNOPTS   = -lm
   31   TEX      = tex
   32   DVIPS    = dvips
   33   DVIPSOPT = -ta4 -D1200
   34   PS2PDF   = ps2pdf
   35   METAPOST = mpost
   36   
   37   # all: $(PROJECT) $(PROJECT).pdf
   38   
   39   all: $(PROJECT) $(EXAMPLE) $(FIGURES) $(PROJECT).pdf
   40   
   41   $(PROJECT): $(PROJECT).o
   42   	$(CC) $(CCOPTS) -o $(PROJECT) $(PROJECT).o $(LNOPTS)
   43   
   44   $(PROJECT).o: $(PROJECT).c
   45   	$(CC) $(CCOPTS) -c $(PROJECT).c
   46   
   47   $(PROJECT).c: $(PROJECT).w
   48   	$(CTANGLE) $(PROJECT) $(PROJECT).c
   49   
   50   $(PROJECT).pdf: $(PROJECT).ps
   51   	$(PS2PDF) $(PROJECT).ps $(PROJECT).pdf
   52   
   53   $(PROJECT).ps: $(PROJECT).dvi
   54   	$(DVIPS) $(DVIPSOPT) $(PROJECT).dvi -o $(PROJECT).ps
   55   
   56   $(PROJECT).dvi: $(PROJECT).tex
   57   	$(TEX) $(PROJECT).tex
   58   
   59   $(PROJECT).tex: $(PROJECT).w
   60   	$(CWEAVE) $(PROJECT)
   61   
   62   example: example.o example.m
   63   	$(CC) $(CCOPTS) -o example example.o $(LNOPTS)
   64   	./example 0.0 > example-0.0.dat
   65   	./example 0.5 > example-0.5.dat
   66   	./example 1.0 > example-1.0.dat
   67   	./example 2.0 > example-2.0.dat
   68   	./sgfilter -m 4 -v -nl 60 -nr 60 -i example-0.0.dat -o example-0.0-f-60.dat
   69   	./sgfilter -m 4 -v -nl 10 -nr 10 -i example-0.0.dat -o example-0.0-f-10.dat
   70   	./sgfilter -m 4 -v -nl 60 -nr 60 -i example-0.5.dat -o example-0.5-f-60.dat
   71   	./sgfilter -m 4 -v -nl 10 -nr 10 -i example-0.5.dat -o example-0.5-f-10.dat
   72   	./sgfilter -m 4 -v -nl 60 -nr 60 -i example-1.0.dat -o example-1.0-f-60.dat
   73   	./sgfilter -m 4 -v -nl 10 -nr 10 -i example-1.0.dat -o example-1.0-f-10.dat
   74   	./sgfilter -m 4 -v -nl 60 -nr 60 -i example-2.0.dat -o example-2.0-f-60.dat
   75   	./sgfilter -m 4 -v -nl 10 -nr 10 -i example-2.0.dat -o example-2.0-f-10.dat
   76   
   77   example.o: example.c
   78   	$(CC) $(CCOPTS) -c example.c
   79   
   80   example.c: $(PROJECT).w
   81   	$(CTANGLE) $(PROJECT)
   82   
   83   example.m:
   84   	@echo "clear all; close all;\
   85   		figure(1);\
   86   		hold on;\
   87   		u=load('example-2.0.dat'); plot(u(:,1),u(:,2),'-b');\
   88   		u=load('example-0.0.dat'); plot(u(:,1),u(:,2),'--k');\
   89   		u=load('example-2.0-f-60.dat'); plot(u(:,1),u(:,2),'-r');\
   90   		u=load('example-2.0-f-10.dat'); plot(u(:,1),u(:,2),'-m');\
   91   		legend('var(f(x))=2.0','f(x)','SG-filtered, nl=nr=60',\
   92   			'SG-filtered, nl=nr=10');\
   93   		hold off;\
   94   		title('Artificial data generated for examples of Savitzky-Golay filtering');\
   95   		xlabel('x');\
   96   		ylabel('f(x)');\
   97   		figure(2);\
   98   		hold on;\
   99   		u=load('example-1.0.dat'); plot(u(:,1),u(:,2),'-b');\
  100   		u=load('example-0.0.dat'); plot(u(:,1),u(:,2),'--k');\
  101   		u=load('example-1.0-f-60.dat'); plot(u(:,1),u(:,2),'-r');\
  102   		u=load('example-1.0-f-10.dat'); plot(u(:,1),u(:,2),'-m');\
  103   		legend('var(f(x))=1.0','f(x)','SG-filtered, nl=nr=60','SG-filtered, nl=nr=10');\
  104   		hold off;\
  105   		title('Artificial data generated for examples of Savitzky-Golay filtering');\
  106   		xlabel('x');\
  107   		ylabel('f(x)');\
  108   		figure(3);\
  109   		hold on;\
  110   		u=load('example-0.5.dat'); plot(u(:,1),u(:,2),'-b');\
  111   		u=load('example-0.0.dat'); plot(u(:,1),u(:,2),'--k');\
  112   		u=load('example-0.5-f-60.dat'); plot(u(:,1),u(:,2),'-r');\
  113   		u=load('example-0.5-f-10.dat'); plot(u(:,1),u(:,2),'-m');\
  114   		legend('var(f(x))=0.5','f(x)','SG-filtered, nl=nr=60','SG-filtered, nl=nr=10');\
  115   		hold off;\
  116   		title('Artificial data generated for examples of Savitzky-Golay filtering');\
  117   		xlabel('x');\
  118   		ylabel('f(x)');">example.m
  119   
  120   fig00: example
  121   	@echo "input graph;\
  122   		beginfig(1);\
  123   		draw begingraph(40mm,40mm);\
  124   		setrange(0.0,-4.0,2.5,7.0);\
  125   		pickup pencircle scaled .5pt;\
  126   		gdraw \"example-1.0.dat\" withcolor .6[black,white];\
  127   		pickup pencircle scaled .8pt;\
  128   		gdraw \"example-1.0-f-10.dat\" withcolor black;\
  129   		gdraw \"example-1.0-f-60.dat\" withcolor black;\
  130   		pickup pencircle scaled .25pt;\
  131   		autogrid(itick bot,itick lft);\
  132   		glabel.bot(btex $$ x$$ etex,OUT);\
  133   		glabel.lft(btex $$ y$$ etex,OUT);\
  134   		endgraph; endfig; end" > fig00.mp
  135   		$(METAPOST) fig00.mp
  136   	$(TEX) -jobname=fig00 "\input epsf\nopagenumbers\
  137   		\centerline{\epsfbox{fig00.1}}\bye"
  138   	$(DVIPS) -D1200 -E fig00.dvi -o fig00.eps
  139   	$(PS2PDF) fig00.eps fig00.pdf
  140   
  141   fig0: example
  142   	@echo "input graph;\
  143   		beginfig(1);\
  144   		draw begingraph(120mm,50mm);\
  145   		setrange(0.0,-4.0,2.5,7.0);\
  146   		pickup pencircle scaled .5pt;\
  147   		gdraw \"example-1.0.dat\" withcolor .6[black,white];\
  148   		pickup pencircle scaled .8pt;\
  149   		gdraw \"example-1.0-f-10.dat\" withcolor blue;\
  150   		gdraw \"example-1.0-f-60.dat\" withcolor red;\
  151   		pickup pencircle scaled .25pt;\
  152   		autogrid(itick bot,itick lft);\
  153   		glabel.bot(btex $$ x$$ etex,OUT);\
  154   		glabel.lft(btex $$ y$$ etex,OUT);\
  155   		endgraph; endfig; end" > fig0.mp
  156   		$(METAPOST) fig0.mp
  157   	$(TEX) -jobname=fig0 "\input epsf\nopagenumbers\
  158   		\centerline{\epsfbox{fig0.1}}\bye"
  159   	$(DVIPS) -D1200 -E fig0.dvi -o fig0.eps
  160   	$(PS2PDF) fig0.eps fig0.pdf
  161   
  162   fig1: example
  163   	@echo "input graph;\
  164   		beginfig(1);\
  165   		draw begingraph(120mm,50mm);\
  166   		setrange(0.0,-2.0,2.5,5.0);\
  167   		pickup pencircle scaled .5pt;\
  168   		gdraw \"example-0.0.dat\" withcolor black;\
  169   		pickup pencircle scaled .25pt;\
  170   		autogrid(itick bot,itick lft);\
  171   		glabel.bot(btex $$ x$$ etex,OUT);\
  172   		glabel.lft(btex $$ y$$ etex,OUT);\
  173   		endgraph; endfig; end" > fig1.mp
  174   		$(METAPOST) fig1.mp
  175   	$(TEX) -jobname=fig1 "\input epsf\nopagenumbers\
  176   		\centerline{\epsfbox{fig1.1}}\bye"
  177   	$(DVIPS) -D1200 -E fig1.dvi -o fig1.eps
  178   	$(PS2PDF) fig1.eps fig1.pdf
  179   
  180   fig2: example
  181   	@echo "input graph;\
  182   		beginfig(1);\
  183   		draw begingraph(120mm,50mm);\
  184   		setrange(0.0,-7.0,2.5,7.0);\
  185   		pickup pencircle scaled .5pt;\
  186   		gdraw \"example-2.0.dat\" withcolor black;\
  187   		pickup pencircle scaled .8pt;\
  188   		gdraw \"example-0.0.dat\" withcolor red;\
  189   		gdraw (0.1,-5.2)--(0.3,-5.2) withcolor red;\
  190   		glabel.rt(btex Underlying function $$ g(x)$$ etex,(0.3,-5.2));\
  191   		pickup pencircle scaled .5pt;\
  192   		gdraw (0.1,-6.2)--(0.3,-6.2) withcolor black;\
  193   		glabel.rt(btex $$ g(x)$$ with added Gaussian noise of variance $$ {\rm var}(u(x))=2.0$$ etex,(0.3,-6.2));\
  194   		pickup pencircle scaled .25pt;\
  195   		autogrid(itick bot,itick lft);\
  196   		glabel.bot(btex $$ x$$ etex,OUT);\
  197   		glabel.lft(btex $$ y$$ etex,OUT);\
  198   		endgraph; endfig; end" > fig2.mp
  199   		$(METAPOST) fig2.mp
  200   	$(TEX) -jobname=fig2 "\input epsf\nopagenumbers\
  201   		\centerline{\epsfbox{fig2.1}}\bye"
  202   	$(DVIPS) -D1200 -E fig2.dvi -o fig2.eps
  203   	$(PS2PDF) fig2.eps fig2.pdf
  204   
  205   fig3: example
  206   	@echo "input graph;\
  207   		beginfig(1);\
  208   		draw begingraph(120mm,50mm);\
  209   		setrange(0.0,-7.0,2.5,7.0);\
  210   		pickup pencircle scaled .5pt;\
  211   		gdraw \"example-2.0.dat\" withcolor .6[black,white];\
  212   		pickup pencircle scaled .8pt;\
  213   		gdraw \"example-0.0.dat\" dashed evenly withcolor black;\
  214   		gdraw \"example-2.0-f-10.dat\" withcolor blue;\
  215   		gdraw \"example-2.0-f-60.dat\" withcolor red;\
  216   		gdraw (0.1,-3.2)--(0.3,-3.2) dashed evenly withcolor black;\
  217   		glabel.rt(btex Underlying function $$ g(x)$$ etex,(0.3,-3.2));\
  218   		gdraw (0.1,-4.2)--(0.3,-4.2) withcolor .6[black,white];\
  219   		glabel.rt(btex $$ g(x)$$ with added Gaussian noise of variance $$ {\rm var}(u(x))=2.0$$ etex,(0.3,-4.2));\
  220   		gdraw (0.1,-5.2)--(0.3,-5.2) withcolor blue;\
  221   		glabel.rt(btex Filtered with $$ m=4$$ and $$ {\it nl}={\it nr}=10$$ etex,(0.3,-5.2));\
  222   		gdraw (0.1,-6.2)--(0.3,-6.2) withcolor red;\
  223   		glabel.rt(btex Filtered with $$ m=4$$ and $$ {\it nl}={\it nr}=60$$ etex,(0.3,-6.2));\
  224   		pickup pencircle scaled .25pt;\
  225   		autogrid(itick bot,itick lft);\
  226   		glabel.bot(btex $$ x$$ etex,OUT);\
  227   		glabel.lft(btex $$ y$$ etex,OUT);\
  228   		endgraph; endfig; end" > fig3.mp
  229   		$(METAPOST) fig3.mp
  230   	$(TEX) -jobname=fig3 "\input epsf\nopagenumbers\
  231   		\centerline{\epsfbox{fig3.1}}\bye"
  232   	$(DVIPS) -D1200 -E fig3.dvi -o fig3.eps
  233   	$(PS2PDF) fig3.eps fig3.pdf
  234   
  235   fig4: example
  236   	@echo "input graph;\
  237   		beginfig(1);\
  238   		draw begingraph(120mm,50mm);\
  239   		setrange(0.0,-7.0,2.5,7.0);\
  240   		pickup pencircle scaled .5pt;\
  241   		gdraw \"example-1.0.dat\" withcolor .6[black,white];\
  242   		pickup pencircle scaled .8pt;\
  243   		gdraw \"example-0.0.dat\" dashed evenly withcolor black;\
  244   		gdraw \"example-1.0-f-10.dat\" withcolor blue;\
  245   		gdraw \"example-1.0-f-60.dat\" withcolor red;\
  246   		gdraw (0.1,-3.2)--(0.3,-3.2) dashed evenly withcolor black;\
  247   		glabel.rt(btex Underlying function $$ g(x)$$ etex,(0.3,-3.2));\
  248   		gdraw (0.1,-4.2)--(0.3,-4.2) withcolor .6[black,white];\
  249   		glabel.rt(btex $$ g(x)$$ with added Gaussian noise of variance $$ {\rm var}(u(x))=1.0$$ etex,(0.3,-4.2));\
  250   		gdraw (0.1,-5.2)--(0.3,-5.2) withcolor blue;\
  251   		glabel.rt(btex Filtered with $$ m=4$$ and $$ {\it nl}={\it nr}=10$$ etex,(0.3,-5.2));\
  252   		gdraw (0.1,-6.2)--(0.3,-6.2) withcolor red;\
  253   		glabel.rt(btex Filtered with $$ m=4$$ and $$ {\it nl}={\it nr}=60$$ etex,(0.3,-6.2));\
  254   		pickup pencircle scaled .25pt;\
  255   		autogrid(itick bot,itick lft);\
  256   		glabel.bot(btex $$ x$$ etex,OUT);\
  257   		glabel.lft(btex $$ y$$ etex,OUT);\
  258   		endgraph; endfig; end" > fig4.mp
  259   		$(METAPOST) fig4.mp
  260   	$(TEX) -jobname=fig4 "\input epsf\nopagenumbers\
  261   		\centerline{\epsfbox{fig4.1}}\bye"
  262   	$(DVIPS) -D1200 -E fig4.dvi -o fig4.eps
  263   	$(PS2PDF) fig4.eps fig4.pdf
  264   
  265   fig5: example
  266   	@echo "input graph;\
  267   		beginfig(1);\
  268   		draw begingraph(120mm,50mm);\
  269   		setrange(0.0,-7.0,2.5,7.0);\
  270   		pickup pencircle scaled .5pt;\
  271   		gdraw \"example-0.5.dat\" withcolor .6[black,white];\
  272   		pickup pencircle scaled .8pt;\
  273   		gdraw \"example-0.0.dat\" dashed evenly withcolor black;\
  274   		gdraw \"example-0.5-f-10.dat\" withcolor blue;\
  275   		gdraw \"example-0.5-f-60.dat\" withcolor red;\
  276   		gdraw (0.1,-3.2)--(0.3,-3.2) dashed evenly withcolor black;\
  277   		glabel.rt(btex Underlying function $$ g(x)$$ etex,(0.3,-3.2));\
  278   		gdraw (0.1,-4.2)--(0.3,-4.2) withcolor .6[black,white];\
  279   		glabel.rt(btex $$ g(x)$$ with added Gaussian noise of variance $$ {\rm var}(u(x))=0.5$$ etex,(0.3,-4.2));\
  280   		gdraw (0.1,-5.2)--(0.3,-5.2) withcolor blue;\
  281   		glabel.rt(btex Filtered with $$ m=4$$ and $$ {\it nl}={\it nr}=10$$ etex,(0.3,-5.2));\
  282   		gdraw (0.1,-6.2)--(0.3,-6.2) withcolor red;\
  283   		glabel.rt(btex Filtered with $$ m=4$$ and $$ {\it nl}={\it nr}=60$$ etex,(0.3,-6.2));\
  284   		pickup pencircle scaled .25pt;\
  285   		autogrid(itick bot,itick lft);\
  286   		glabel.bot(btex $$ x$$ etex,OUT);\
  287   		glabel.lft(btex $$ y$$ etex,OUT);\
  288   		endgraph; endfig; end" > fig5.mp
  289   		$(METAPOST) fig5.mp
  290   	$(TEX) -jobname=fig5 "\input epsf\nopagenumbers\
  291   		\centerline{\epsfbox{fig5.1}}\bye"
  292   	$(DVIPS) -D1200 -E fig5.dvi -o fig5.eps
  293   	$(PS2PDF) fig5.eps fig5.pdf
  294   
  295   fig6: example
  296   	@echo "input graph;\
  297   		beginfig(1);\
  298   		draw begingraph(120mm,50mm);\
  299   		setrange(0.0,-7.0,2.5,7.0);\
  300   		pickup pencircle scaled .8pt;\
  301   		gdraw \"example-0.0.dat\" dashed evenly withcolor black;\
  302   		gdraw \"example-0.0-f-10.dat\" withcolor blue;\
  303   		gdraw \"example-0.0-f-60.dat\" withcolor red;\
  304   		gdraw (0.1,-3.2)--(0.3,-3.2) dashed evenly withcolor black;\
  305   		glabel.rt(btex Underlying function $$ g(x)$$ etex,(0.3,-3.2));\
  306   		gdraw (0.1,-4.2)--(0.3,-4.2) withcolor blue;\
  307   		glabel.rt(btex Filtered with $$ m=4$$ and $$ {\it nl}={\it nr}=10$$ etex,(0.3,-4.2));\
  308   		gdraw (0.1,-5.2)--(0.3,-5.2) withcolor red;\
  309   		glabel.rt(btex Filtered with $$ m=4$$ and $$ {\it nl}={\it nr}=60$$ etex,(0.3,-5.2));\
  310   		pickup pencircle scaled .25pt;\
  311   		autogrid(itick bot,itick lft);\
  312   		glabel.bot(btex $$ x$$ etex,OUT);\
  313   		glabel.lft(btex $$ y$$ etex,OUT);\
  314   		endgraph; endfig; end" > fig6.mp
  315   		$(METAPOST) fig6.mp
  316   	$(TEX) -jobname=fig6 "\input epsf\nopagenumbers\
  317   		\centerline{\epsfbox{fig6.1}}\bye"
  318   	$(DVIPS) -D1200 -E fig6.dvi -o fig6.eps
  319   	$(PS2PDF) fig6.eps fig6.pdf
  320   
  321   clean:
  322   	-rm -Rf $(PROJECT) *~ *.c *.h *.o *.exe *.dat *.pdf *.mp *.trj *.mpx
  323   	-rm -Rf *.tex *.aux *.log *.toc *.idx *.scn *.dvi *.ps *.1 *.eps
  324   	-rm -Rf example *.m
  325   
  326   archive:
  327   	make -ik clean
  328   	tar --gzip --directory=../ -cf ../$(PROJECT).tar.gz $(PROJECT)
  329   

Return to previous page

Generated by ::viewsrc::

Last modified Saturday 17 Dec 2011