fancy new Makefile from Bens upstream
This commit is contained in:
parent
28ca034820
commit
da194305d2
|
@ -1,6 +1,5 @@
|
||||||
############################################################################
|
############################################################################
|
||||||
# based on Makefile by
|
# Copyright 2009-2013 Benjamin Kellermann, John #
|
||||||
# Copyright 2009, 2010, 2011 Benjamin Kellermann #
|
|
||||||
# #
|
# #
|
||||||
# This program is free software: you can redistribute it and/or modify it #
|
# This program is free software: you can redistribute it and/or modify it #
|
||||||
# under the terms of the GNU General Public License as published by the #
|
# under the terms of the GNU General Public License as published by the #
|
||||||
|
@ -23,9 +22,7 @@
|
||||||
############################################################################
|
############################################################################
|
||||||
|
|
||||||
# the documents to be compiled by default
|
# the documents to be compiled by default
|
||||||
#DOC=$(foreach i,$(filter-out $(wildcard *_notes.tex),$(shell grep -l documentclass *.tex)), $(basename $i))
|
DOC=$(foreach i,$(shell grep -l documentclass *.tex), $(basename $i))
|
||||||
DOC=schleuderbeispiel
|
|
||||||
|
|
||||||
|
|
||||||
# if svgs should be compiled as pdf or png
|
# if svgs should be compiled as pdf or png
|
||||||
SVG_TARGET_EXT=pdf
|
SVG_TARGET_EXT=pdf
|
||||||
|
@ -105,8 +102,9 @@ build-dep_%:
|
||||||
$(call checkForPGFrealjobname,$*)
|
$(call checkForPGFrealjobname,$*)
|
||||||
$(VERBOSE)$(LATEXCMD) $*
|
$(VERBOSE)$(LATEXCMD) $*
|
||||||
make $*.bbl
|
make $*.bbl
|
||||||
make $*.gls;\
|
if [ "`grep makeglossaries *.tex`" ];then\
|
||||||
echo TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT
|
make $*.gls;\
|
||||||
|
fi
|
||||||
$(VERBOSE) $(LATEXCMD) $*
|
$(VERBOSE) $(LATEXCMD) $*
|
||||||
$(VERBOSE) $(LATEXCMD) $*
|
$(VERBOSE) $(LATEXCMD) $*
|
||||||
|
|
||||||
|
@ -119,17 +117,10 @@ final: $(foreach i,$(DOC),$i_final.pdf)
|
||||||
mv $*_tmp.pdf $*.pdf
|
mv $*_tmp.pdf $*.pdf
|
||||||
cp $*.pdf $*_final.pdf
|
cp $*.pdf $*_final.pdf
|
||||||
|
|
||||||
publish: $(foreach i,$(DOC),publish_$i)
|
|
||||||
publish_%: %_final.pdf
|
|
||||||
scp $(foreach e,bib pdf,$(wildcard $*.$e)) $(PUBLISH)
|
|
||||||
@echo
|
|
||||||
@for i in $*.bib $*.pdf; do if [ -f $$i ]; then $(PRINTF) "$(PUBLISH_URL)/$$i\n"; fi; done
|
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
@rm -vf $(foreach ext,$(TEXEXT),*.$(ext))
|
@rm -vf $(foreach ext,$(TEXEXT),*.$(ext))
|
||||||
@rm -vf $(PIC) $(TIKZPIC) $(STY)
|
@rm -vf $(PIC) $(TIKZPIC) $(STY)
|
||||||
@rm -vf $(foreach i,$(DOC),$i_notes.tex)
|
@rm -vf $(foreach i,$(DOC),$i_notes.tex)
|
||||||
rm stats/*
|
|
||||||
|
|
||||||
distclean: $(foreach i,$(DOC),distclean_$i)
|
distclean: $(foreach i,$(DOC),distclean_$i)
|
||||||
distclean_%: clean
|
distclean_%: clean
|
||||||
|
@ -139,7 +130,7 @@ checkForRunningProcess = \
|
||||||
@if [ -f /tmp/$(1)_watch.pid ];then\
|
@if [ -f /tmp/$(1)_watch.pid ];then\
|
||||||
WATCHID=`cat /tmp/$(1)_watch.pid`;\
|
WATCHID=`cat /tmp/$(1)_watch.pid`;\
|
||||||
if [ `ps --pid $$WATCHID|wc -l` = 2 ];then\
|
if [ `ps --pid $$WATCHID|wc -l` = 2 ];then\
|
||||||
$(PRINTF) "There is a \"make watch\" running!\n";\
|
$(PRINTF) "\033[31mThere is a \"make watch\" running!\033[0m\n";\
|
||||||
return 1;\
|
return 1;\
|
||||||
fi;\
|
fi;\
|
||||||
fi
|
fi
|
||||||
|
@ -154,7 +145,7 @@ checkForPGFrealjobname = \
|
||||||
fi;\
|
fi;\
|
||||||
done;\
|
done;\
|
||||||
if [ "$$PGFREALJOBNAMEOCCURED" = "false" ]; then\
|
if [ "$$PGFREALJOBNAMEOCCURED" = "false" ]; then\
|
||||||
$(PRINTF) "\\pgfrealjobname{} is set to a wrong value! I expected:\n\\pgfrealjobname{$*}\n";\
|
$(PRINTF) "\033[31m\\pgfrealjobname{} is set to a wrong value! I expected:\n\\pgfrealjobname{$*}\033[0m\n";\
|
||||||
return 1;\
|
return 1;\
|
||||||
fi;\
|
fi;\
|
||||||
fi
|
fi
|
||||||
|
@ -173,7 +164,7 @@ ADDITIONALDIRS=$(wildcard ~/texmf/)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
watch: $(foreach i,$(DOC),watch_$i)
|
watch: $(foreach i,$(DOC),watch_$i)
|
||||||
watch_%: build-dep_%
|
watch_%: %.pdf
|
||||||
$(call checkForRunningProcess,$*)
|
$(call checkForRunningProcess,$*)
|
||||||
$(PRINTF) $$PPID > /tmp/$*_watch.pid
|
$(PRINTF) $$PPID > /tmp/$*_watch.pid
|
||||||
if [ `ls -l *.tex.latexmain|wc -l` != 1 ]; then\
|
if [ `ls -l *.tex.latexmain|wc -l` != 1 ]; then\
|
||||||
|
@ -229,12 +220,14 @@ watch_%: build-dep_%
|
||||||
fi;\
|
fi;\
|
||||||
if [ $$LACHECK = true ];then lacheck $$FILE; fi;\
|
if [ $$LACHECK = true ];then lacheck $$FILE; fi;\
|
||||||
cat /tmp/make_watch_duration;\
|
cat /tmp/make_watch_duration;\
|
||||||
if [ $$BIBTEX = true ];then $(PRINTF) "I ran BibTeX, therefore compilation took a bit longer.\n"; fi;\
|
notify-send --expire-time=1000 --hint=int:transient:1 -a "LaTeX" "pdflatex compiled successfull" "`cat /tmp/make_watch_duration`";\
|
||||||
if [ $$GLOSSARIES = true ];then $(PRINTF) "I ran makeglossaries, therefore compilation took a bit longer.\n"; fi;\
|
if [ $$BIBTEX = true ];then $(PRINTF) "\033[33mI ran BibTeX, therefore compilation took a bit longer.\033[0m\n"; fi;\
|
||||||
|
if [ $$GLOSSARIES = true ];then $(PRINTF) "\033[33mI ran makeglossaries, therefore compilation took a bit longer.\033[0m\n"; fi;\
|
||||||
$(call cpTmp,$*)\
|
$(call cpTmp,$*)\
|
||||||
else\
|
else\
|
||||||
if [ $$LACHECK = true ];then lacheck $$FILE; fi;\
|
if [ $$LACHECK = true ];then lacheck $$FILE; fi;\
|
||||||
$(PRINTF) "SOMETHING WENT WRONG, PLEASE CHECK THE CONSOLE!!!\n";\
|
$(PRINTF) "\033[31mSOMETHING WENT WRONG, PLEASE CHECK THE CONSOLE!!!\033[0m\n";\
|
||||||
|
notify-send --expire-time=1000 --hint=int:transient:1 "ERROR: pdflatex; Compilefile: $$COMPILEFILE";\
|
||||||
fi;\
|
fi;\
|
||||||
done
|
done
|
||||||
|
|
||||||
|
@ -247,17 +240,11 @@ watchtikz_%: %.pdf
|
||||||
if [ $$? -eq 0 ];then\
|
if [ $$? -eq 0 ];then\
|
||||||
cp $*.pdf /tmp/$<;\
|
cp $*.pdf /tmp/$<;\
|
||||||
else\
|
else\
|
||||||
$(PRINTF) "SOMETHING WENT WRONG, PLEASE CHECK THE CONSOLE!!!\n";\
|
$(PRINTF) "\033[31mSOMETHING WENT WRONG, PLEASE CHECK THE CONSOLE!!!\033[0m\n";\
|
||||||
fi;\
|
fi;\
|
||||||
done
|
done
|
||||||
|
|
||||||
stats:
|
.PHONY: default final clean distclean watch tikzpics $(PICDIR) build-dep
|
||||||
mkdir -p stats
|
|
||||||
rm -rf stats/*
|
|
||||||
gitstats .git stats
|
|
||||||
|
|
||||||
|
|
||||||
.PHONY: default final clean distclean watch tikzpics $(PICDIR) build-dep stats
|
|
||||||
|
|
||||||
.SECONDARY:
|
.SECONDARY:
|
||||||
|
|
||||||
|
@ -265,9 +252,6 @@ stats:
|
||||||
rm -f $@
|
rm -f $@
|
||||||
$(LATEXCMD) $*.ins
|
$(LATEXCMD) $*.ins
|
||||||
|
|
||||||
%_notes.tex: %.tex
|
|
||||||
sed -e 's/\\begin{document}/\\usepackage[previewfilename=$*]{bensbeamernotepage}\\begin{document}/g' $< > $@
|
|
||||||
|
|
||||||
%.tex: %.tex.erb *.rb
|
%.tex: %.tex.erb *.rb
|
||||||
erb $< >$@
|
erb $< >$@
|
||||||
|
|
||||||
|
@ -292,3 +276,6 @@ $(PICDIR)/%.pdf: $(PICDIR)/%.svg
|
||||||
|
|
||||||
$(PICDIR)/%.png: $(PICDIR)/%.svg
|
$(PICDIR)/%.png: $(PICDIR)/%.svg
|
||||||
inkscape --export-png=$@ -w1000 $<
|
inkscape --export-png=$@ -w1000 $<
|
||||||
|
|
||||||
|
$(PICDIR)/%_gray.png: $(PICDIR)/%.png
|
||||||
|
convert -colorspace gray $< $@
|
||||||
|
|
Loading…
Reference in New Issue