BASE=MemoriaPFC TEXSOURCES=$(wildcard *.tex) BIBSOURCES=$(wildcard *.bib) LOGS=$(addprefix ${BASE}, .log .blg .out .ilg) TOCS=$(addprefix ${BASE}, .toc .lot .lof .tol .bbl .ind .brf) MEDS=$(addprefix ${BASE}, .aux .idx .old .idx.mak) DIAS=$(wildcard *.dia) DIAPNGS=$(patsubst %.dia, %.png, $(DIAS)) DIAEPSS=$(patsubst %.dia, %.eps, $(DIAS)) DIASVGS=$(patsubst %.dia, %.svg, $(DIAS)) DIAPDFS=$(patsubst %.dia, %.pdf, $(DIAS)) default: pdf viewvars: @echo -e "\033[45;30m$@\a\033[0m" @echo TexSources: ${TEXSOURCES} @echo BibSources: ${BIBSOURCES} @echo Logs: ${LOGS} @echo Tables: ${TOCS} @echo Diagrams: ${DIAS} clean: viewvars @echo -e "\033[45;30m$@\a\033[0m" @for file in ${LOGS} ${TOCS} ${MEDS} ${DIAPDFS} ${DIAPNGS} ${DIAEPSS} ${DIASVGS}; \ do \ if [ -f $$file ]; \ then \ echo Deleting $$file; \ rm $$file; \ fi; \ done pdf: viewvars pdfaux ${BASE.pdf} @echo -e "\033[45;30m$@\a\033[0m" pdfaux: ${BASE}.pdf @echo -e "\033[45;30m$@\a\033[0m" ${BASE}.old: ${DIAPDFS} ${TEXSOURCES} ${BIBSOURCES} @echo -e "\033[45;30m$@\a\033[0m" pdflatex ${BASE} diff -q ${BASE}.aux ${BASE}.old; \ if [ "$$?" != "0" ]; \ then \ echo "aux changed!"; \ cp ${BASE}.aux ${BASE}.old; \ fi ${BASE}.pdf: ${BASE}.old ${BASE}.bbl ${BASE}.ind @echo -e "\033[45;30m$@\a\033[0m" pdflatex ${BASE} diff ${BASE}.aux ${BASE}.old; \ if [ "$$?" != "0" ]; \ then \ echo "aux changed!"; \ cp ${BASE}.aux ${BASE}.old; \ fi # Quan es modifiquen les referčncies o la base de dades ${BASE}.bbl: ${BASE}.old ${BIBSOURCES} @echo -e "\033[45;30m$@\a\033[0m" bibtex ${BASE} pdflatex ${BASE} diff ${BASE}.aux ${BASE}.old; \ if [ "$$?" != "0" ]; \ then \ echo "aux changed!"; \ cp ${BASE}.aux ${BASE}.old; \ fi ${BASE}.ind: ${BASE}.idx @echo -e "\033[45;30m$@\a\033[0m" @diff ${BASE}.idx ${BASE}.idx.mak; \ if [ "$$?" != "0" ]; \ then \ echo "Alphabetical index changed!"; \ cp ${BASE}.idx ${BASE}.idx.mak; \ makeindex ${BASE}; \ fi $(DIAPNGS): %.png : %.dia @echo -e "\033[45;30m$@\a\033[0m" dia --nosplash -e $@ $< $(DIAEPSS): %.eps : %.dia @echo -e "\033[45;30m$@\a\033[0m" dia --nosplash -e $@ $< $(DIAPDFS): %.pdf : %.eps @echo -e "\033[45;30m$@\a\033[0m" epstopdf $< $(DIASVGS): %.svg : %.dia @echo -e "\033[45;30m$@\a\033[0m" dia --nosplash -e $@ $<