| 1 |
################################################################ |
| 2 |
# Makefile for tkz-orm # |
| 3 |
################################################################ |
| 4 |
|
| 5 |
help: |
| 6 |
@echo "" |
| 7 |
@echo " make clean - clean out directory" |
| 8 |
@echo " make tidy - clean out directory some more" |
| 9 |
@echo " make examples - create examples as PDF and PNG" |
| 10 |
@echo " make ctan - create a CTAN-ready archive" |
| 11 |
@echo " make doc - typeset documentation" |
| 12 |
@echo " make install - install files in local texmf tree" |
| 13 |
@echo "" |
| 14 |
|
| 15 |
################################################################ |
| 16 |
# Master package name # |
| 17 |
################################################################ |
| 18 |
|
| 19 |
PACKAGE = tkz-orm |
| 20 |
FEATURES = index bib |
| 21 |
|
| 22 |
LATEXFLAGS = -interaction=nonstopmode |
| 23 |
|
| 24 |
################################################################ |
| 25 |
# Directory structure for making zip files # |
| 26 |
################################################################ |
| 27 |
|
| 28 |
CTANROOT := ctan |
| 29 |
CTANDIR := $(CTANROOT)/$(PACKAGE) |
| 30 |
CTANINCLUDE = $(PACKAGE).tex $(PACKAGE).sty $(PACKAGE).bib \ |
| 31 |
README LICENSE pgfmanualstyle.sty Makefile |
| 32 |
|
| 33 |
############################################################### |
| 34 |
# Data for local installation |
| 35 |
############################################################### |
| 36 |
|
| 37 |
# TODO: add cheatsheet |
| 38 |
INCLUDEPDF := $(PACKAGE) |
| 39 |
PACKAGEROOT := latex/$(PACKAGE) |
| 40 |
|
| 41 |
################################################################ |
| 42 |
# Clean-up information # |
| 43 |
################################################################ |
| 44 |
|
| 45 |
AUXFILES = aux bbl bit blg glo gls dvi glo hd idx ilg ind lof \ |
| 46 |
log nlo nls out toc |
| 47 |
|
| 48 |
CLEAN = gz pdf ps zip |
| 49 |
|
| 50 |
################################################################ |
| 51 |
# File buiding: default actions # |
| 52 |
################################################################ |
| 53 |
|
| 54 |
all: $(PACKAGE).pdf |
| 55 |
index: $(PACKAGE).ind $(PACKAGE).ilg |
| 56 |
abbr: $(PACKAGE).nls |
| 57 |
bib: $(PACKAGE).blg $(PACKAGE).bbl |
| 58 |
|
| 59 |
# Documentation |
| 60 |
$(PACKAGE).pdf: $(PACKAGE).tex $(FEATURES) |
| 61 |
pdflatex $(LATEXFLAGS) $(PACKAGE).tex |
| 62 |
pdflatex $(LATEXFLAGS) $(PACKAGE).tex |
| 63 |
|
| 64 |
# Preperation |
| 65 |
$(PACKAGE).idx $(PACKAGE).nlo $(PACKAGE).aux: $(PACKAGE).tex |
| 66 |
pdflatex $(LATEXFLAGS) $(PACKAGE).tex |
| 67 |
|
| 68 |
# Indexes |
| 69 |
$(PACKAGE).ind $(PACKAGE).ilg: $(PACKAGE).tex $(PACKAGE).idx |
| 70 |
makeindex $(PACKAGE).idx |
| 71 |
|
| 72 |
$(PACKAGE).nls: $(PACKAGE).tex $(PACKAGE).nlo |
| 73 |
makeindex $(PACKAGE).nlo -s nomencl.ist -o $(PACKAGE).nls |
| 74 |
|
| 75 |
# Bibliography |
| 76 |
$(PACKAGE).blg $(PACKAGE).bbl: $(PACKAGE).tex $(PACKAGE).bib $(PACKAGE).aux |
| 77 |
bibtex $(PACKAGE) |
| 78 |
|
| 79 |
%.pdf2: %.tex |
| 80 |
NAME=`basename $< .tex` ; \ |
| 81 |
echo "Typesetting $$NAME" ; \ |
| 82 |
pdflatex &> /dev/null ; \ |
| 83 |
if [ $$? = 0 ] ; then \ |
| 84 |
makeindex -s gglo.ist -o $$NAME.gls $$NAME.glo &> /dev/null ; \ |
| 85 |
makeindex -s gind.ist -o $$NAME.ind $$NAME.idx &> /dev/null ; \ |
| 86 |
pdflatex &> /dev/null ; \ |
| 87 |
pdflatex &> /dev/null ; \ |
| 88 |
else \ |
| 89 |
echo " Complilation failed" ; \ |
| 90 |
fi ; \ |
| 91 |
for I in $(AUXFILES) ; do \ |
| 92 |
rm -f $$NAME.$$I ; \ |
| 93 |
done |
| 94 |
|
| 95 |
%.png: %.tex |
| 96 |
@sed 's/^\\begin{document}/\ |
| 97 |
\\pgfrealjobname{dummy}\\begin{document}\\beginpgfgraphicnamed{example}/' $< | \ |
| 98 |
sed 's/^\\end{document}/\\endpgfgraphicnamed\\end{document}/' > example.tex ; \ |
| 99 |
pdflatex --jobname=example example.tex ; \ |
| 100 |
gs -dNOPAUSE -r120 -dGraphicsAlphaBits=4 -dTextAlphaBits=4 -sDEVICE=png16m \ |
| 101 |
-sOutputFile=$@ -dBATCH example.pdf ; \ |
| 102 |
convert -thumbnail 200 $@ $(addsuffix .thumb.png, $(basename $@)) ; \ |
| 103 |
mv example.pdf $(addsuffix .pdf, $(basename $<)) ; rm example.* |
| 104 |
|
| 105 |
|
| 106 |
################################################################ |
| 107 |
# User make options # |
| 108 |
################################################################ |
| 109 |
|
| 110 |
.PHONY = clean tidy install |
| 111 |
|
| 112 |
clean: |
| 113 |
for I in $(AUXFILES) $(CLEAN) ; do \ |
| 114 |
rm -f *.$$I ; \ |
| 115 |
done |
| 116 |
@rm -rf $(CTANROOT)/ |
| 117 |
|
| 118 |
tidy: clean |
| 119 |
@rm -rf *~ |
| 120 |
|
| 121 |
ctan: doc |
| 122 |
echo "Creating CTAN archive" |
| 123 |
mkdir -p $(CTANDIR)/ |
| 124 |
rm -rf $(CTANDIR)/* |
| 125 |
for I in $(INCLUDEPDF) ; do \ |
| 126 |
cp -f $$I.pdf $(CTANDIR)/ ; \ |
| 127 |
done ; \ |
| 128 |
for F in $(CTANINCLUDE) ; do \ |
| 129 |
cp -f $$F $(CTANDIR)/ ; \ |
| 130 |
done ; \ |
| 131 |
cd $(CTANDIR) ; \ |
| 132 |
zip -ll -q -r -X $(PACKAGE).zip . |
| 133 |
cp $(CTANDIR)/$(PACKAGE).zip ./ |
| 134 |
rm -rf $(CTANROOT)/ |
| 135 |
|
| 136 |
doc: $(foreach FILE,$(INCLUDEPDF),$(FILE).pdf) |
| 137 |
|
| 138 |
examples: $(foreach FILE,$(wildcard examples/*.tex),$(basename $(FILE)).png) |
| 139 |
|
| 140 |
install: |
| 141 |
echo Installing $(PACKAGE).sty |
| 142 |
TEXMFHOME=`kpsewhich --var-value=TEXMFHOME` ; \ |
| 143 |
rm -rf $$TEXMFHOME/tex/$(PACKAGEROOT)/*.* ; \ |
| 144 |
mkdir -p $$TEXMFHOME/tex/$(PACKAGEROOT)/ ; \ |
| 145 |
cp $(PACKAGE).sty $$TEXMFHOME/tex/$(PACKAGEROOT)/ ; \ |
| 146 |
texhash &> /dev/null |