# set here all the sources files
# required to build anr.pdf
SOURCES=	anr.tex anr.bib section-1.tex \
			section-2.tex section-2.1.tex section-2.2.tex \
		 	flow.pdf section-3.1.tex section-3.2.tex \
			task-0.tex task-1.tex task-2.tex task-3.tex \
			task-4.tex task-5.tex task-6.tex \
			section-4.1.tex section-4.4.tex \
			architecture-csg.pdf architecture-hls.pdf architecture-hpc.pdf \
			dependence-task-h.pdf \
			section-4.2.tex section-5.tex \
			section-6.1.tex section-6.2.tex section-7.tex

TABLES= table_upmc_full.tex table_upmc_short.tex \
		table_tima_full.tex table_tima_short.tex \
		table_lip_full.tex table_lip_short.tex \
		table_ubs_full.tex table_ubs_short.tex \
		table_xilinx_full.tex table_xilinx_short.tex \

# PROGRAMS
FIG2DEV = fig2dev

%.pdf: %.fig
	@echo "Converting $< to $@"
	@$(FIG2DEV) -L pdf -p aaa $< $@

anr.pdf: $(SOURCES) gantt1.tex gantt2.tex gantt $(TABLES)
	@echo "Generating pdf file"
	@pdflatex anr.tex 
	@bibtex anr 
	@./gantt < anr.gantt
	@pdflatex anr.tex 
	@pdflatex anr.tex 
	@grep ndefine anr.log

anr.bbl:anr.aux anr.bib
	bibtex anr || true

anr.aux gantt1.tex gantt2.tex $(TABLES):
	touch $@

gantt: gantt.l
	@flex gantt.l && gcc -g lex.yy.c -o gantt
	@rm lex.yy.c

clean:
	rm -f $(TABLES) anr.aux gantt1.tex gantt2.tex anr.pdf anr.gantt
