LATEX = latex 
PDFLATEX = pdflatex
PSLATEX = pslatex
DVIPDF = dvipdf
DVIPS = dvips
PS2PDF = ps2pdf
GDATE := $(shell date +"-%Y-%m-%d_r%H")
GFILENAME := CDC$(GDATE).tar.bz2
LOCALDIR = $(shell pwd)
MAINFILE = rapport


#PNGFILES := $(shell ls *.png)
#EPSFILES := $(patsubst %.png,%.eps,$(PNGFILES))
#PNG2EPSCC = convert
TEXFILES := $(MAINFILE).tex
DVIFILES := $(MAINFILE).dvi
PDFFILES := $(MAINFILE).pdf
PSFILES := $(MAINFILE).ps

all: dvi dvi ps pdf pdf

#png2eps: $(EPSFILES)

#%.eps : %.png
#	@$(PNG2EPSCC) $< $@
#	@echo -e "png2eps\t$< $@"
		
clean: 
	@rm -f rapport.dvi rapport.rtf rapport.pdf rapport.ps 
	@rm -f *.out *.log *.toc *.aux
#	@rm -f *.eps
	@rm -f *~

pdf: $(TEXFILES)
	$(PDFLATEX) $(TEXFILES)

ps: $(TEXFILES)
	$(DVIPS) $(DVIFILES)

dvi: $(PRJFILES)
	$(LATEX) $(TEXFILES)

#mail: package sendmail
#
#pdfmail : 
#	make && make
#	echo "Et voila le dernier pdf" | mutt lsr-dev -a $(PDFFILES) -s "[CDC] Rev$(GDATE) (en PDF)"
#
#sendmail:
#	echo "Et voila" | mutt lsr-dev -a ../Archives/$(GFILENAME) -s "[CDC] Rev$(GDATE) (en TeX)"
#

package: clean storefile

#storefile:
#	tar -cjvf ../$(GFILENAME) -C ../ cdc
#	mv ../$(GFILENAME) ../Archives