Makefile


Per salvare il file listato qui avanti, scaricatelo direttamente da questo link (right-click, Save Link As ...).


# Author: Maurizio Loreti, aka MLO or (HAM) I3NOO
# Work:   University of Padova - Department of Physics
#         Via F. Marzolo, 8 - 35131 PADOVA - Italy
# Phone:  +39 (049) 827-7216   FAX: +39 (049) 827-7102
# EMail:  loreti@pd.infn.it
# WWW:    http://www.pd.infn.it/~loreti/mlo.html
#
######################################################################
#
# USUAL TARGETS:
# ##############
#
# - make book.ps    , make book.pdf    : one-block version, 1-up
# - make book2up.ps , make book2up.pdf : one-block version, 2-up
# - make book       , make pdf         : 50-pages blocks,   1-up
# - make 2up        , make pdf2up      : 40-pages blocks,   2-up
#
# "make all" is equivalent to "make book pdf"
#
######################################################################
# $Id: Makefile,v 1.14 2006/11/08 11:00:56 loreti Exp $
######################################################################

# Building rules
# ##############

%.dvi:%.tex
	latex $<
	while grep Rerun $*.log ; do latex $< ; done

%.ps:%.dvi
	dvips -o $@ $<

%.pdf:%.dvi
	dvips <$< -f -q | ps2pdf - $@

%.eps.gz:%.eps
	grep > $<.bb BoundingBox $<; gzip -fv9 $<

%.pstex:%.fig
	fig2dev -L pstex -m 0.73 $< $@
	fig2dev -L pstex_t -m 0.73 -p $@ $< $@_t

# Commands to build the index (1-up and 2-up versions)
# ####################################################

DOIDX		= makeindex -s book.ist book.idx
DOIDX2UP	= makeindex -s book.ist book2up.idx

# Commands to build tabout.tex (included in the Appendix F)
# #########################################################

# /usr/soft/include and /usr/soft/lib host the include files and
# libraries of the Gnu Scientific Library (GSL)

CC		= gcc
CPPFLAGS	= -std=c99 -pedantic -W -Wall -O2
CFLAGS		= -I/usr/soft/include
LDFLAGS		= -L/usr/soft/lib -lgsl -lgslcblas -lm
OBJS		= table.o

# Style file dependencies
# #######################

STYS	= bsheaders.sty book.ist Makefile

# .tex files needed (not "book.tex")
# ##################################

TEX0	= definitions.tex preambolo.tex prefazione.tex \
	  chapter1.tex chapter2.tex chapter3.tex chapter4.tex \
	  chapter5.tex chapter6.tex chapter7.tex chapter8.tex \
	  chapter9.tex chapter10.tex chapter11.tex chapter12.tex \
	  chapter13.tex chaptera.tex chapterb.tex chapterc.tex \
	  chapterd.tex chaptere.tex chapterf.tex tabelle.tex
TEXS	= $(TEX0) tabout.tex

# Figure files
# ############

# - bo.eps has been scanned from a printed copy
# - all other figures are generated by xfig with LaTeX output; the
#   original files or were produced directly using xfig, or were
#   generated by paw kumac macros, then processed with:
#   paw >/dev/null 2>&1 -b file.kumac		# generate file.eps
#   pstoedit -f fig file.eps file.fig		# generate file.fig
#   xfig file.fig				# edit file.fig
# - in the last step all text has been changed to LaTeX default font
#   with the 'special' flag set.

EGZS	= bo.eps.gz

FIGS	= isto.pstex cumul.pstex modes.pstex maxbol.pstex istgau.pstex \
	  polar.pstex riget.pstex gauss.pstex cauchy.pstex binom.pstex \
	  poisson.pstex lognor.pstex trigau.pstex tremis.pstex stime.pstex \
	  chi.pstex scat.pstex student.pstex duegau.pstex runfig.pstex \
	  bigau1.pstex bigau2.pstex bigau3.pstex poisint.pstex \
	  chicdf.pstex chirid.pstex

# PostScript files (1-up version): 50-page blocks
# ###############################################

PSS	= book1.ps book2.ps book3.ps book4.ps book5.ps book6.ps book7.ps

# Postscript files (2-up version): 40-page blocks
# ###############################################

# The LaTeX main file for the 2-up version is book2up.tex and not
# book.tex; they differ in the values of \odd- and \evensidemargin,
# and for a blank page at the beginning (to print the front cover on
# the right side of the first sheet)

PSS2	= bup1.ps bup2.ps bup3.ps bup4.ps bup5.ps bup6.ps bup7.ps \
	  bup8.ps bup9.ps

# Phony targets
# #############

.PHONY: all clean veryclean brown install VERSION

# PostScript files, 1-up version
# ##############################

book: $(PSS)
	touch book

book.ps: book.dvi

book1.ps: book.dvi
	dvips -o $@ -p   1 -l 50 $<

book2.ps: book.dvi
	dvips -o $@ -p  51 -n 50 $<

book3.ps: book.dvi
	dvips -o $@ -p 101 -n 50 $<

book4.ps: book.dvi
	dvips -o $@ -p 151 -n 50 $<

book5.ps: book.dvi
	dvips -o $@ -p 201 -n 50 $<

book6.ps: book.dvi
	dvips -o $@ -p 251 -n 50 $<

book7.ps: book.dvi
	dvips -o $@ -p 301       $<

book.dvi: book.tex $(TEXS) $(STYS) $(EGZS) $(FIGS)
	latex book.tex
	$(DOIDX)
	while grep Rerun book.log; do latex book.tex; $(DOIDX); done
	latex book.tex

# PDF files, 1-up version
# #######################

book.pdf: book.dvi

pdf: book.dvi
	dvips <$< -f -q -p   1 -l 50 | ps2pdf - book1.pdf
	dvips <$< -f -q -p  51 -n 50 | ps2pdf - book2.pdf
	dvips <$< -f -q -p 101 -n 50 | ps2pdf - book3.pdf
	dvips <$< -f -q -p 151 -n 50 | ps2pdf - book4.pdf
	dvips <$< -f -q -p 201 -n 50 | ps2pdf - book5.pdf
	dvips <$< -f -q -p 251 -n 50 | ps2pdf - book6.pdf
	dvips <$< -f -q -p 301       | ps2pdf - book7.pdf
	touch pdf

# PostScript files, 2-up version
# ##############################

twoup: $(PSS2)
	touch twoup

book2up.ps: book2up.dvi
	dvips <$< -q -f | psnup >$@ -pa4 -2

bup1.ps: book2up.dvi
	dvips <$< -n 40         -q -f | psnup >$@ -pa4 -2

bup2.ps: book2up.dvi
	dvips <$< -n 40 -p  =41 -q -f | psnup >$@ -pa4 -2

bup3.ps: book2up.dvi
	dvips <$< -n 40 -p  =81 -q -f | psnup >$@ -pa4 -2

bup4.ps: book2up.dvi
	dvips <$< -n 40 -p =121 -q -f | psnup >$@ -pa4 -2

bup5.ps: book2up.dvi
	dvips <$< -n 40 -p =161 -q -f | psnup >$@ -pa4 -2

bup6.ps: book2up.dvi
	dvips <$< -n 40 -p =201 -q -f | psnup >$@ -pa4 -2

bup7.ps: book2up.dvi
	dvips <$< -n 40 -p =241 -q -f | psnup >$@ -pa4 -2

bup8.ps: book2up.dvi
	dvips <$< -n 40 -p =281 -q -f | psnup >$@ -pa4 -2

bup9.ps: book2up.dvi
	dvips <$<       -p =321 -q -f | psnup >$@ -pa4 -2

booklet.ps: book2up.dvi
	dvips <$< -p 2 -q -f | psbook | psnup >$@ -pa4 -2

book2up.dvi: book2up.tex bsheaders.sty $(TEXS) $(STYS) $(EGZS) $(FIGS)
	latex book2up.tex
	$(DOIDX2UP)
	while grep Rerun book2up.log; do latex book2up.tex; $(DOIDX2UP); done
	latex book2up.tex

book2up.tex: book.tex 2up.awk
	awk -f 2up.awk book.tex >$@

# PDF files, 2-up version
# #######################

book2up.pdf: book2up.dvi
	dvips <$< -f -q | psnup -pa4 -2 -q | ps2pdf - $@

pdf2up: book2up.dvi
	dvips <$< -f -q         -n 40 | psnup -pa4 -2 -q | ps2pdf - bup1.pdf
	dvips <$< -f -q -p  =41 -n 40 | psnup -pa4 -2 -q | ps2pdf - bup2.pdf
	dvips <$< -f -q -p  =81 -n 40 | psnup -pa4 -2 -q | ps2pdf - bup3.pdf
	dvips <$< -f -q -p =121 -n 40 | psnup -pa4 -2 -q | ps2pdf - bup4.pdf
	dvips <$< -f -q -p =161 -n 40 | psnup -pa4 -2 -q | ps2pdf - bup5.pdf
	dvips <$< -f -q -p =201 -n 40 | psnup -pa4 -2 -q | ps2pdf - bup6.pdf
	dvips <$< -f -q -p =241 -n 40 | psnup -pa4 -2 -q | ps2pdf - bup7.pdf
	dvips <$< -f -q -p =281 -n 40 | psnup -pa4 -2 -q | ps2pdf - bup8.pdf
	dvips <$< -f -q -p =321       | psnup -pa4 -2 -q | ps2pdf - bup9.pdf
	touch pdf2up

# "all": "book" && "pdf"
# ######################

all: book pdf

# Commands to build tabout.tex, i.e. the tables of the Appendix F,
# through the C program "table".  The source file "table.c" uses the
# mathematical procedures of the GNU Scientific Library (GSL); for
# more informations, see http://www.gnu.org/software/gsl/ .  If the
# GSL is not installed, I have left around the old version of the
# source code, "old_table.c", that do not need external libraries:
# just compile it first with the command
#
# gcc -std=c99 -pedantic -W -Wall -O2 -c -o table.o old_table.c
#
# before giving any "make" command.  The "old" tables differ from the
# "new" ones only for two lines in one of the Fisher's tables.
# ####################################################################

tabout.tex: table
	-rm tabout.tex
	./table >tabout.tex

table:  $(OBJS)
	$(CC) $(LDFLAGS) -o $@ $(OBJS)

table.o: table.c

# Commands to build chicdf.kumac and chirid.kumac
# ###############################################

chicdf.kumac: chicdf
	./chicdf >$@

chicdf: chicdf.c
	$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ $<

chirid.kumac: chirid
	./chirid >$@

chirid: chirid.c
	$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ $<

# xfig figures in LaTeX mode
# ##########################

poisint.pstex: poisint.fig
	fig2dev -L pstex -m 1.0 $< $@
	fig2dev -L pstex_t -m 1.0 -p $@ $< $@_t

polar.pstex: polar.fig
	fig2dev -L pstex -m 0.48 $< $@
	fig2dev -L pstex_t -m 0.48 -p $@ $< $@_t

runfig.pstex: runfig.fig
	fig2dev -L pstex -m 0.52 $< $@
	fig2dev -L pstex_t -m 0.52 -p $@ $< $@_t

scat.pstex: scat.fig
	fig2dev -L pstex -m 1.0 $< $@
	fig2dev -L pstex_t -m 1.0 -p $@ $< $@_t

# Cleanup
# #######

clean:
	@rm -fv *.ps *.pdf book pdf twoup pdf2up last.* paw.* *.bak VERSION
	@lintex
	@rm -fv book2up.tex Makefile.html

veryclean:
	make clean
	@rm -rfv brown/
	@rm -fv *.eps.bb $(PAWEPS) *.pstex*
	@rm -fv tabout.tex table chicdf chirid tohtml *.o
	@if [ "$$(find . -maxdepth 1 -name '*.eps.gz' | wc -l)" != "0" ]; \
	  then gzip -dv *.eps.gz; fi

# VERSION - The "VERSION" file, with last file revisions
# ######################################################

VERSION:
	echo >$@ "Revision status as of `date '+%d-%b-%Y %H:%M'` :"
	echo >>$@ ""
	for f in Makefile book.tex $(TEX0) ; \
	do grep '$$'"Id: " $${f} | awk -v file="$${f}" \
	   '{print file "\t\tRev. " $$4 "\t" $$5 " " $$6;}' >>$@ ; \
	done
	grep '$$'"Id: " table.c | awk \
	  '{print "table.c\t\t\tRev. " $$3 "\t" $$4 " " $$5;}' >> $@
	grep '$$'"Id: " chicdf.c | awk \
	  '{print "chicdf.c\t\tRev. " $$3 "\t" $$4 " " $$5;}' >> $@
	grep '$$'"Id: " chirid.c | awk \
	  '{print "chirid.c\t\tRev. " $$3 "\t" $$4 " " $$5;}' >> $@
	grep '$$'"Id: " tohtml.c | awk \
	  '{print "tohtml.c\t\tRev. " $$3 "\t" $$4 " " $$5;}' >> $@

# Makefile.html - a syntax highlighted copy of Makefile.  Needs
# "source-highlight", available under the URL
# http://www.gnu.org/software/src-highlite/source-highlight.html
# ##############################################################

Makefile.html: Makefile tohtml
	./tohtml Makefile "wwwcdf.pd.infn.it/labo/Source" \
	--lang-def makefile.lang

tohtml: tohtml.c
	$(CC) $(CPPFLAGS) -o $@ $<

# Install - Copies the pdf and the source files on the Web
# ########################################################

install: book.pdf book2up.pdf pdf pdf2up VERSION Makefile.html
	for f in bup*.pdf; do mv $$f $${f/bup/twoup}; done
	scp *.pdf VERSION INDEX.html Makefile.html lx:/www/cdf/html/labo/
	rm *.pdf VERSION pdf pdf2up
	-scp `ls | grep -v INDEX.html` lx:/www/cdf/html/labo/Source/
	make veryclean
	make brown
	make -C brown book.pdf book2up.pdf pdf pdf2up
	for f in brown/bup*.pdf; do mv $$f $${f/bup/twoup}; done
	scp brown/*.pdf lx:/www/cdf/html/labo/brown/
	ssh lx "cd /www/cdf/html/labo && tar cvzf Source.tar.gz Source/"
	ssh lx "cd /www/cdf/html/labo && tar cvjf Source.tar.bz2 Source/"

# Brown version
# #############

# "make brown" generates in a subdirectory ./brown versions of the TeX
# files and of all the figures suitable for printing in brown and not
# in black.  The three macros BROWN1, BROWN2 and BROWN3 define the RGB
# components of the printing color (here, "SaddleBrown") in three
# different ways; BROWN4 and BROWN5 refer the to color shades
# corresponding to "gray96" and "gray61", roughly estimated from the
# expression C=C+(1.0-C)*G: where "C" is the R, G or B component of
# the printing color as given in BROWN3, and G is the grayscale factor
# (0.96 or 0.61).
#
#				CAVEATS
#				=======
#
# 1) The conversion from black to brown of the bo.eps file requires
#    "convert", from the ImageMagick package, version *6* or later.
# 2) The conversion from black to brown of the .pstex and .pstex_t
#    files depends from the syntax of the fig2dev output; this may
#    change in the future.

BROWN1	= SaddleBrown
BROWN2	= 0.55,0.27,0.07
BROWN3	= 0.55 0.27 0.07
BROWN4	= 0.96 0.93 0.92
BROWN5	= 0.82 0.71 0.64

brown:
	rm -rf brown/
	mkdir brown
	if [ -r bo.eps.gz ]; then gzip -dc bo.eps.gz > bo.eps; fi
	convert bo.eps -fill $(BROWN1) -opaque Black brown/bo.eps
	if [ -r bo.eps.gz ]; then rm -f bo.eps; fi
	awk '{print} \
	  /\\begin{document}/ { \
	  print "\\renewcommand{\\normalcolor}{\\color[rgb]{$(BROWN2)}}"; \
	  print "\\normalcolor\n"}' book.tex > brown/book.tex
	make tabout.tex $(FIGS)
	cp *.c *.awk *.fig brown/
	cp *.o brown/
	cp table brown/
	cp $(TEXS) $(STYS) brown/
	for file in *.pstex; \
	  do sed -e "s/0.000 0.000 0.000/$(BROWN3)/" \
	  -e "s/0.00 setgray/col0/" \
	  -e "s/0.910 0.910 0.910/$(BROWN4)/" \
	  -e "s/0.608 0.608 0.608/$(BROWN5)/" \
	  $$file > brown/$$file; done
	for file in *.pstex_t; \
	  do sed -e "s/\[rgb\]{0,0,0}/\[rgb\]{$(BROWN2)}/" \
	  $$file > brown/$$file; done


File name: Makefile
File size: 12661 bytes
Last modified: Wed Nov 8 12:00:56 2006