# basic definitions
vortrag = vortrag.pdf
vortrag_DATA = vortrag.org data.txt dist-tarball.png
vortragdir = .
# dist_pkgdata_DATA = rohdaten 
EXTRA_DIST = ${vortrag_DATA} ${vortrag}
# kill editor backups and latex stuff
MOSTLYCLEANFILES = \\\#* *~ *.bak *.vrb *.bbl \
                   *.blg *_flymake.*
CLEANFILES = ${vortrag}
DISTCLEANFILES = ${CLEANFILES} \\\#* *~ *.bak *.vrb *.bbl \
                               *.blg *_flymake.* auto/*el

all : ${vortrag}

# emacs org-mode beamer build instructions
${vortrag} : ${vortrag_DATA}
	if test "$<" != "$(notdir $<)"; then \
            cp -u "$<" "$(notdir $<)"; fi
	echo yes | @emacs@ --batch --load "~/.emacs" \
               --visit "$(notdir $<)" \
               --funcall org-beamer-export-to-pdf
	if test "$<" != "$(notdir $<)"; \
       then rm -f "$(notdir $<)"; \
            rm -f $(basename $(notdir $<)).tex \
                  $(basename $(notdir $<)).tex~ \
                  auto/$(basename $(notdir $<)).el; \
       else rm -f $(basename $<).tex \
                  $(basename $<).tex~ \
                  auto/$(basename $<).el; \
    fi