######## # TODO ######## # Requiert gmake 3.80 # Fusionner avec AutoMake # 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 # ajouter la detection de TOC et IND # mieux gérer les images en input # | grep "\e\[1m" pour n'avoir que les message du Makefile default: pdf ########################### # Déclaration des sources. ########################### ALL := report report_TEX := report.tex \ AUTHORS.tex \ intro.tex \ lois.tex \ critique.tex \ libre.tex \ internationnal.tex \ definition.tex \ applications.tex \ annexes_lois.tex #report_TEX := $(wildcard *.tex) report_EXT := report_HVA := #report.hva report_CSS := #report.css # 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 ## BROKEN :-( report_IMS := report_BIB := report.bib report_TOC := yes #report_IND := yes #USE_DRAFT := yes EXTRA_CLEAN = AUTHORS.tex EXTRA_SUFFIX = 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; }' > $@ # Pour les images, uniquement si elle depende de plusieurs fichiers. #img1.eps: img1.gpl img1.dat ######################## # Progammes à utiliser ######################## RM = rm -f VIEWDVI = xdvi VIEWPDF = xpdf VIEWPS = gv LYNX = elinks PDFLATEX = pdflatex --interaction errorstopmode --file-line-error-style LATEX = latex --interaction errorstopmode --file-line-error-style DVIPS = dvips -z -Ppdf MAKEINDEX= makeindex HEVEA = hevea -francais # Density for vectorial to bitmap convertion DENSITY1 = 300x300 # Density for bitmap to vectorial convertion DENSITY2 = 144x144 ########################### # 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] *~ *.tmp $(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 .ind .idx .lof .lot,$(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: rm -f $(ALL_TEX:.tex=.check) make 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 .dot .eps .png .jpg .tif .bmp .pnm \ .toc .mtc .aux .bbl .idx .ind \ .check .haux .htoc $(EXTRA_SUFFIXES) .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 ifdef $(1)_BIB $(1)_BBL=$$($(1)_BIB:.bib=.bbl) endif ifdef $(1)_TOC $(1)_TOC=$(1).toc endif ifdef $(1)_IND $(1)_IND=$(1).ind endif $(1)_IMG=$(basename $($(1)_IMS)) $(1).toc: $$($(1)_TEX) $$($(1)_EXT) $$($(1)_IMG:=.png) | $$($(1)_BBL) $$($(1)_IND) $(1).ind: $$($(1)_TEX) $$($(1)_EXT) $$($(1)_IMG:=.png) | $$($(1)_BBL) $(1).bbl: $$($(1)_TEX) $$($(1)_EXT) $$($(1)_IMG:=.png) $$($(1)_BIB) $(1).dvi: $$($(1)_TEX) $$($(1)_EXT) $$($(1)_IMG:=.eps) $$($(1)_BBL) $$($(1)_IND) $$($(1)_TOC) $(1).pdf: $$($(1)_TEX) $$($(1)_EXT) $$($(1)_IMG:=.png) $$($(1)_BBL) $$($(1)_IND) $$($(1)_TOC) $(1).html: $$($(1)_TEX) $$($(1)_EXT) $$($(1)_IMG:=.png) $$($(1)_BBL) $$($(1)_IND) $$($(1)_HVA) $(1).info: $$($(1)_TEX) $$($(1)_EXT) $$($(1)_BBL) $$($(1)_IND) $$($(1)_HVA) $(1).txt: $$($(1)_CSS) $$($(1)_IMG:.png) check: $$($(1)_TEX:.tex=.check) ALL_TEX += $$($(1)_TEX) ALL_BIB += $$($(1)_BIB) endef $(foreach prog,$(ALL),$(eval $(call DOCtemplate,$(prog)))) # Règles générales #################### # Branche commune .tex.bbl: ifeq '$(USE_DRAFT)' '' @echo -e "\e[1mCreation of $@ from $<\e[0m" $(PDFLATEX) $< else @echo -e "\e[1mCreation of $@ from $< (draft mode)\e[0m" $(PDFLATEX) '\def\draft{1}\input $<' endif $(RM) $(<:.tex=.toc) bibtex $(<:.tex=) .tex.ind: ifeq '$(USE_DRAFT)' '' @echo -e "\e[1mCreation of $@ from $<\e[0m" $(PDFLATEX) $< else @echo -e "\e[1mCreation of $@ from $< (draft mode)\e[0m" $(PDFLATEX) '\def\draft{1}\input $<' endif $(MAKEINDEX) $(<:.tex=) .tex.toc: ifeq '$(USE_DRAFT)' '' @echo -e "\e[1mCreation of $@ from $<\e[0m" $(PDFLATEX) $< || { $(RM) $@; exit 1; } else @echo -e "\e[1mCreation of $@ from $< (draft mode)\e[0m" $(PDFLATEX) '\def\draft{1}\input $<' || { $(RM) $@; exit 1; } endif .tex.pdf: @echo -e "\e[1mCreation of $@ from $<\e[0m" $(PDFLATEX) $< ifneq '$(<:.tex=)_TOC' '' touch $(<:.tex=.toc) $@ endif .tex.dvi: @echo -e "\e[1mCreation of $@ from $<\e[0m" $(LATEX) $< ifneq '$(<:.pdf=)_TOC' '' touch $(<:.tex=.toc) $@ endif .dvi.ps: dvips $< # Branche hevea .tex.info: $(RM) *.haux *.htoc hevea -fix -info $($(@:.info=)_HVA) $< || { $(RM) $@; exit 1; } .tex.html: $(RM) *.haux *.htoc hevea -fix $($(@:.html=)_HVA) $< || { $(RM) $@; exit 1; } .html.txt: $(LYNX) -dump $(@:.txt=.html) > $@ # Check .tex.check: aspell check --lang=francais $< touch $@ # Images .plot.eps .gpl.eps: @echo -e "\e[1mCreation of $@ from $<\e[0m" gnuplot $< > $@ .dot.png: @echo -e "\e[1mCreation of $@ from $<\e[0m" dot -Tpng $< > $@ .dot.eps: @echo -e "\e[1mCreation of $@ from $<\e[0m" dot -Teps $< > $@ .dia.png: @echo -e "\e[1mCreation of $@ from $<\e[0m" dia -n -t png $< .dia.eps: @echo -e "\e[1mCreation of $@ from $<\e[0m" dia -n -t eps $< .jpg.png .gif.png .bmp.png: @echo -e "\e[1mConversion of $< to $@\e[0m" convert $< $@ .eps.jpg .eps.gif .eps.bmp .eps.png: @echo -e "\e[1mConversion of $< to $@\e[0m" -[ "$<" ] && convert -density $(DENSITY1) $< $@ .jpg.eps .gif.eps .bmp.eps .png.eps: @echo -e "\e[1mConversion of $< to $@\e[0m" -[ "$<" ] && convert -density $(DENSITY2) $< $@ .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