######## # TODO ######## # require gmake 3.80 # Support pour makeindex # fusionner avec AutoMake # mieux gérer gnuplot (permettre le termail esplatex) # permettre de gérer les images/bibliographies dans des sous # repertoires/makefile # permettre de faire un syntax check sur les fichiers .tex # mettre des regles pour les dependances autoamtique sur les fichiers gnuplot default: pdf ######################## # Progammes à utiliser ######################## # Voulez vous générez la Table Of Content proprement? TOC = 1 RM = rm -f VIEWDVI = xdvi VIEWPDF = xpdf VIEWPS = gv LYNX = elinks PDFLATEX= pdflatex --interaction errorstopmode HEVEA = hevea -francais ########################### # Déclaration des sources. ########################### ALL := report report_TEX := report.tex AUTHORS.tex intro.tex bench.tex listing.tex \ gallery.tex conclu.tex #report_TEX := $(wildcard *.tex) #report_EXT := ../naive/counts.c ../naive/counts.h report_BIB := report.bib # Images sources # Put source name of your pictures. # Your sources must be convertable to eps or png format. # You must use $(basename source) in your document. # Don't put additionnal files used for picture generation report_IMS := bench/01in.gpl bench/01out.gpl bench/01error.gpl \ bench/02in.gpl bench/02out.gpl bench/02error.gpl \ bench/03in.gpl bench/03out.gpl bench/03error.gpl \ bench/04in.gpl bench/04out.gpl bench/04error.gpl \ bench/06in.gpl bench/06out.gpl bench/06error.gpl \ bench/07in.gpl bench/07out.gpl bench/07error.gpl \ bench/08in.gpl bench/08out.gpl bench/08error.gpl \ bench/09in.gpl bench/09out.gpl bench/09error.gpl \ bench/10in.gpl bench/10out.gpl bench/10error.gpl \ bench/11in.gpl bench/11out.gpl bench/11error.gpl \ bench/12in.gpl bench/12out.gpl bench/12error.gpl \ bench/13in.gpl bench/13out.gpl bench/13error.gpl \ bench/14in.gpl bench/14out.gpl bench/14error.gpl \ bench/15in.gpl bench/15out.gpl bench/15error.gpl \ bench/16in.gpl bench/16out.gpl bench/16error.gpl report_HVA := report.hva #report_CSS := report.css # Compatibilité avec Make < 3.80 :-( (sinon, automatique....) report_BBL := $(report_BIB:.bib=.bbl) report_IMG := $(basename $(report_IMS)) ALL_IMS := $(report_IMS) ALL_TEX := $(report_TEX) ALL_BIB := $(report_BIB) EXTRA_CLEAN = AUTHORS.tex bench/*.gpl EXTRA_SUFFIX = .dat #EXTRA_PHONY = ######################### # Règles suplementaires ######################### AUTHORS.tex: ../AUTHORS Makefile grep "^\* " $< | perl -e '$$i=1; for (<>){ @e = /\(([^\s]+)\s(.*)\)/ ; print " \\and\n" if ($$i != 1); print "@e[0] \\textsc{@e[1]}"; $$i=0; }' > $@ # Qui a dit c'est illisible? c n'importe quoi les Makefile? t un barbare? $(patsubst %_reds.dat,%.gpl,$(wildcard bench/[0-9][0-9]in_reds.dat)) \ $(patsubst %_reds.dat,%.gpl,$(wildcard bench/[0-9][0-9]out_reds.dat)): Makefile @echo "Creating $@..." @echo -e 'cat << EOF > $@ \n\ set terminal postscript eps enhanced color colortext solid \n\ set xlabel "X" \n\ set ylabel "Y" \n\ plot [-1:1] [-1:1] \\\\\n\ "$(@:.gpl=_greens.dat)" notitle, \\\\\n\ "$(@:.gpl=_reds.dat)" notitle \n' | sh $(patsubst %.dat,%.gpl,$(wildcard bench/[0-9][0-9]error.dat)): Makefile @echo "Creating $@..." @echo -e 'cat << EOF > $@ \n\ set terminal postscript eps enhanced color colortext solid \n\ set xlabel "Nombre d'\''itération" \n\ set ylabel "Erreur" \n\ plot \\\\\n\ "$(@:.gpl=.dat)" w linespoints notitle \n' | sh # Pour les images, uniquement si elle depende de plusieurs fichiers. # (gnuplot en particulier) 01out.eps: 01out_reds.dat 01out_greens.dat 01in.eps: 01in_reds.dat 01in_greens.dat 01error.eps: 01error.dat # ... trop reloud, je le fais pas .... ########################### # Fin de la configuration ########################### # Voila, c'est fini, on ne touche plus a rien au dela de cette ligne #### # Général ########## all: dvi pdf ps html txt info png view: viewpdf viewdvi:$(ALL:=.dvi) $(VIEWDVI) $< & viewps: $(ALL:=.ps) $(VIEWPS) $< & viewpdf:$(ALL:=.pdf) $(VIEWPDF) $< & print: $(ALL:=.pdf) $(PRINT) $< clean: $(RM) $(EXTRA_CLEAN) *.[0-9] *~ $(foreach s,.bbl .blg, \ $(addsuffix $(s),$(ALL_BIB:.bib=))) $(foreach s,.haux .aux .check \ .image.* .tex.bak,$(addsuffix $(s),$(ALL_TEX:.tex=))) $(foreach s, \ .htoc .toc .log .mtc* .out .bmt,$(addsuffix $(s),$(ALL))) $(foreach \ s,.png .ps .eps .pdf,$(filter-out $(ALL_IMS), $(addsuffix $(s), \ $(basename $(ALL_IMS))))) distclean: clean $(RM) $(foreach suffix,.dvi .ps .pdf .txt .info .[0-9][0-9][0-9].png \ .gif .jpg .bmp .pnm .tif,$(addsuffix $(suffix),$(ALL))) *.html #recheck: $(shell rm *.check) check ## Les regles s'appliquant sur toutes les detinations pdf: $(ALL:=.pdf) ps: $(ALL:=.ps) dvi: $(ALL:=.dvi) html: $(ALL:=.html) txt: $(ALL:=.txt) info: $(ALL:=.info) jpg: $(ALL:=.jpg) png: $(ALL:=.png) tif: $(ALL:=.tif) text: txt ## Les regles spéciales .SUFFIXES: .pdf .ps .dvi .txt .info .html .tex .bib \ .gpl .plot .dot .eps .png .jpg .tif .bmp .pnm \ .toc .aux .bbl .check .haux .htoc .mtc $(EXTRA_SUFFIX) .PHONY: default all clean distclean check recheck \ view viewpdf viewps viewdvi print \ pdf ps dvi html txt text info \ jpg tif bmp png pnm $(EXTRA_PHONY) # Génération des règles ####################### # Make 3.80 powered :-( # define DOCtemplate # $(1)_BBL = $$($(1)_BIB:.bib=.bbl) # $(1)_IMG := $$(basename $$($(1)_IMS)) # $(1).aux: $$($(1)_TEX) $$($(1)_EXT) Makefile # $(1).pdf: $$($(1)_BBL) $$($(1)_IMG:=.png) $$($(1)_TEX) $$($(1)_EXT) # $(1).dvi: $$($(1)_BBL) $$($(1)_IMG:=.eps) $$($(1)_TEX) $$($(1)_EXT) # $(1).txt: $$($(1)_CSS) $$($(1)_IMG:=.png) # $(1).bbl: $$($(1)_BIB) # $(1).html: $$($(1)_BBL) $$($(1)_IMG:=.png) $$($(1)_TEX) $$($(1)_EXT) $$($(1)_HVA) # $(1).info: $$($(1)_BBL) $$($(1)_TEX) $$($(1)_EXT) $$($(1)_HVA) # check: $$($(1)_TEX:.tex=.check) # ALL_IMS += $$($(1)_IMS) # ALL_TEX += $$($(1)_TEX) # ALL_BIB += $$($(1)_BIB) # #recheck: # Marche pas encore # endef # $(foreach prog,$(ALL),$(eval $(call DOCtemplate,$(prog)))) # Compatibilitie for Make < 3.80 #DOCtemplate = $(1)_BBL := $($(1)_BIB:.bib=.bbl) # Marche po #$(foreach prog,$(ALL),$(if $(prog)_BIB,$(call DOCtemplate,$(prog)))) DOCtemplate = $(1).aux: $($(1)_TEX) $($(1)_EXT) Makefile | $($(1)_IMG:=.png) $(foreach prog,$(ALL),$(call DOCtemplate,$(prog))) DOCtemplate = $(1).pdf: $($(1)_BBL) $($(1)_IMG:=.png) $($(1)_TEX) $($(1)_EXT) $(foreach prog,$(ALL),$(call DOCtemplate,$(prog))) DOCtemplate = $(1).dvi: $($(1)_BBL) $($(1)_IMG:=.eps) $($(1)_TEX) $($(1)_EXT) $(foreach prog,$(ALL),$(call DOCtemplate,$(prog))) DOCtemplate = $(1).txt: $($(1)_CSS) $($(1)_IMG:=.png) $(foreach prog,$(ALL),$(call DOCtemplate,$(prog))) DOCtemplate = $(1).bbl: $($(1)_BIB) $(foreach prog,$(ALL),$(call DOCtemplate,$(prog))) DOCtemplate = $(1).html: $($(1)_BBL) $($(1)_IMG:=.png) $($(1)_TEX) $($(1)_EXT) $($(1)_HVA) $(foreach prog,$(ALL),$(call DOCtemplate,$(prog))) DOCtemplate = $(1).info: $($(1)_BBL) $($(1)_TEX) $($(1)_EXT) $($(1)_HVA) $(foreach prog,$(ALL),$(call DOCtemplate,$(prog))) DOCtemplate = check: $($(1)_TEX:.tex=.check) $(foreach prog,$(ALL),$(call DOCtemplate,$(prog))) #DOCtemplate = recheck: # Marche pas encore #$(foreach prog,$(ALL),$(call DOCtemplate,$(prog))) # Règles générales #################### # Branche commune .tex.aux: $(PDFLATEX) --file-line-error-style $(@:.aux=.tex) || rm -f $@ $(RM) $(@:.aux=.toc) .aux.bbl: bibtex $(<:.aux=) # Branche pdf # Branche pdf .tex.pdf: $(PDFLATEX) --file-line-error-style $(@:.pdf=) || rm -f $@ # ifdef TOC && -e $(@:.dvi=.toc) ifdef TOC $(PDFLATEX) --file-line-error-style $(@:.pdf=) || rm -f $@ endif #ifneq "$(truc)" "" touch $($(@:.pdf=)_BBL) $@ #endif .tex.dvi: latex --file-line-error-style $(@:.dvi=) || rm -f $@ # ifdef TOC && -e $(@:.dvi=.toc) ifdef TOC latex --file-line-error-style $(@:.dvi=) || rm -f $@ endif #ifneq ($($(@:.dvi=)_BBL),) touch $($(@:.dvi=)_BBL) $@ #endif .dvi.ps: dvips $< # Branche hevea .tex.info: $(RM) *.haux *.htoc hevea -fix -info $($(@:.info=)_HVA) $< .tex.html: $(RM) *.haux *.htoc hevea -fix $($(@:.html=)_HVA) $< .html.txt: $(LYNX) -dump $(@:.txt=.html) > $@ # Check .tex.check: aspell check --lang=francais $< touch $@ # Images .plot.eps .gpl.eps: gnuplot $< > $@ .dot.png: dot -Tpng $< > $@ .dot.eps: dot -Teps $< > $@ .eps.jpg .eps.gif .eps.bmp .eps.png: convert -density 300x300 $< $@ .jpg.eps .gif.eps .bmp.eps .png.eps: convert -density 144x144 $< $@ .ps.png .ps.bmp .ps.pnm .ps.jpg .ps.tif: file=`echo $@ | sed 's/\(.*\)\.\(png\|bmp\|pnm\|jpg\|tif\)/\1/'`; \ suf=`echo $@ | sed 's/\(.*\)\.\(png\|bmp\|pnm\|jpg\|tif\)/\2/'`; \ rm -f $@.[0-9] $@ $$file-[0-9].$$suf convert -density 144x144 $< $@ if [ -f $@.0 ]; then \ for i in $@.[0-9]; do \ mv $$i `echo $$i | sed 's/\(.*\)\.\(png\|bmp\|pnm\|jpg\|tif\)\.\([0-9]\)/\1-\3.\2/'`; \ done; \ ln -s `echo $@ | sed 's/\(.*\)\.\(png\|bmp\|pnm\|jpg\|tif\)/\1-0.\2/'` $@; \ fi