# Unix Gnu Makefile za Simulacije sistemov
SHELL=/bin/sh
CC=gcc
CFLAGS= -O2 -ansi -Wall -fomit-frame-pointer -Wstrict-prototypes
#CFLAGS= -g -ansi -Wall -Wstrict-prototypes
# Gnuplot opcije
XSIZE=6.0
YSIZE=4.5
FONT= \"Helvetica\" 150
GRID=nogrid
.c.o :
$(CC) -c $(CFLAGS) $< -o $*.o
% : %.o
$(CC) $(CFLAGS) $^ -o $@
%.rez : %
$^ > $@
%.aux : %.tex
latex $<
%.dvi : %.tex
latex $<
%.tex : %.c
c2latex $< $*.tex
%.bbl : %.bib
bibtex $<
%.ps : %.dvi
dvips -t a4 $< -o $*.ps
%.odd : %.dvi
dvips -t a4 -A $< -o $*.odd
%.eve : %.dvi
dvips -t a4 -B $< -o $*.eve
%.pcl : %.ps
gs -sDEVICE=ljet3 -r300 -sOutputFile=$*.pcl \
-sPAPERSIZE=a4 -dNOPAUSE $< quit.ps
# skupne definicije za vse Gnuplot datoteke
%.gpl :
@ echo set terminal postscript eps $(FONT) > $@
@ echo set nokey >> $@
@ echo set size $(XSIZE), $(YSIZE) >> $@
@ echo set $(GRID) >> $@
%.tx1 : %.rez %.gpl
@ echo set offsets 0, 0, 0.2, 0.2 >> $*.gpl
@ echo set output \"$@\" >> $*.gpl
@ echo plot \"$<\" using 1:2 with lines >> $*.gpl
@ echo exit >> $*.gpl
gnuplot $*.gpl
%.tx2 : %.rez %.gpl
@ echo set offsets 0, 0, 0.2, 0.2 >> $*.gpl
@ echo set output \"$@\" >> $*.gpl
@ echo plot \"$<\" u 1:2 w l 1,\"$<\" u 1:3 w l 3 >> $*.gpl
@ echo exit >> $*.gpl
gnuplot $*.gpl
%.tx3 : %.rez %.gpl
@ echo set offsets 0, 0, 0.2, 0.2 >> $*.gpl
@ echo set output \"$@\" >> $*.gpl
@ echo plot \"$<\" u 1:2 w l 1, \
\"$<\" u 1:3 w l 2,\"$<\" u 1:4 w l 3 >> $*.gpl
@ echo exit >> $*.gpl
gnuplot $*.gpl
%.tp1 : %.rez %.gpl
@ echo set offsets 0.2, 0.2, 0.2, 0.2 >> $*.gpl
@ echo set output \"$@\" >> $*.gpl
@ echo plot \"$<\" u 2:3 w l 1 >> $*.gpl
@ echo exit >> $*.gpl
gnuplot $*.gpl
%.tp2 : %.rez %.gpl
@ echo set offsets 0.2, 0.2, 0.2, 0.2 >> $*.gpl
@ echo set output \"$@\" >> $*.gpl
@ echo plot \"$<\" u 2:4 w l 1 >> $*.gpl
@ echo exit >> $*.gpl
gnuplot $*.gpl
%.dvi : %.rez
echo \\ documentstyle\{article\} > $*.tmp
echo \\ begin\{document\} >> $*.tmp
echo \\ input\{$<\} >> $*.tmp
echo \\ end{document} >> $*.tmp
latex $*.tmp
rm -f $*.tmp
all : sim3
# ---- Simulacije 1 -------
sim1: sim1.ps
sim1.dvi : sim1a.tx2 sim1ba.tx2 sim1bb.tx2 sim1c.tp1 sim1c.tp2 \
sim1c.tx3
# ---- Simulacije 2 -------
sim1: sim1.ps
# ---- Simulacije 3 -------
sim3: sim3a sim3a.rez sim3b sim3b.rez sim3c sim3c.rez sim3d sim3d.rez \
sim3b.txu sim3c.txu sim3.dvi sim3.ps sim3.odd sim3.eve
sim3.tex: sim3b.txu sim3c.txu sim3d.txu sim3e.txu
sim3b.txu : sim3a.rez sim3b.rez sim3b.gpl
@ echo set offsets 0, 0, 0.2, 0.2 >> sim3b.gpl
@ echo set output \"$@\" >> sim3b.gpl
@ echo plot [0:100] \"sim3a.rez\" u 1:3 w l, \
\"sim3b.rez\" u 1:3 w l \
>> sim3b.gpl
@ echo exit >> sim3b.gpl
gnuplot sim3b.gpl
sim3c.txu : sim3a.rez sim3b.rez sim3c.gpl
@ echo set offsets 0, 0, 0.2, 0.2 >> sim3c.gpl
@ echo set output \"$@\" >> sim3c.gpl
@ echo plot \"sim3a.rez\" u 1:4 w l, \"sim3b.rez\" u 1:4 w l \
>> sim3c.gpl
@ echo exit >> sim3c.gpl
gnuplot sim3c.gpl
sim3d.txu : sim3c.rez sim3d.rez sim3d.gpl
@ echo set offsets 0, 0, 0.2, 0.2 >> sim3d.gpl
@ echo set output \"$@\" >> sim3d.gpl
@ echo plot [0:100] \"sim3c.rez\" u 1:3 w l, \
\"sim3d.rez\" u 1:3 w l >> sim3d.gpl
@ echo exit >> sim3d.gpl
gnuplot sim3d.gpl
sim3e.txu : sim3c.rez sim3d.rez sim3e.gpl
@ echo set offsets 0, 0, 0.2, 0.2 >> sim3e.gpl
@ echo set output \"$@\" >> sim3e.gpl
@ echo plot [0:100] \"sim3c.rez\" u 1:2 w l, \
\"sim3d.rez\" u 1:2 w l >> sim3e.gpl
@ echo exit >> sim3e.gpl
gnuplot sim3e.gpl
clean:
rm -f *.dvi *.o *.aux *.log *.log *.ps *.pcl *.bbl *.blg *.dlg
rm -f izpis* core a.out *.tx[123u] *.tp[12] *.dat *.tmp
rm -f *.eve *.odd sim3? sim3?.gpl sim3?.rez