Debian Codegraph @

texmf-dist/source/latex/icite/Makefile

raw
1 NAME = icite
2 SHELL = bash
3 PWD = $(shell pwd)
4 VERS = $(shell ltxfileinfo -v $(NAME).dtx|sed -e 's/^v//')
5 LOCAL = $(shell kpsewhich --var-value TEXMFLOCAL)
6 UTREE = $(shell kpsewhich --var-value TEXMFHOME)
7 CMP = lualatex-dev
8
9 exts := md bib ins dtx html
10 texsamples := $(basename $(wildcard $(PWD)/samples/*.tex))
11 findopts := $(foreach ext,$(exts),-or -iname "*.$(ext)")
12
13
14 # Look into this later
15 # $(if $(wildcard $(PWD)/TMP/$(notdir $1).bcf),biber $(PWD)/TMP/$(notdir $1),)
16
17 define dosamples
18 $(CMP) --output-dir=$(PWD)/TMP --shell-escape $1 >/dev/null
19 $(CMP) --output-dir=$(PWD)/TMP --shell-escape $1 >/dev/null
20 if [ -f $(PWD)/TMP/$(notdir $1)-primary.idx ]; \
21 then texindy -M $(PWD)/TMP/$(notdir $1).xdy $(PWD)/TMP/$(notdir $1)-primary.idx >/dev/null; fi
22 if [ -f $(PWD)/TMP/$(notdir $1).bcf ]; then biber $(PWD)/TMP/$(notdir $1) >/dev/null; fi
23 $(CMP) --output-dir=$(PWD)/TMP --shell-escape $1 >/dev/null
24 $(CMP) --output-dir=$(PWD)/TMP --shell-escape $1 >/dev/null
25 endef
26
27 sty: clean
28 $(CMP) $(NAME).ins
29
30 all: clean sty $(NAME).pdf
31 # test -e README.md || exit 0
32
33 $(NAME).pdf: clean sty $(NAME).dtx
34 @ echo "Make documentation..."
35 $(CMP) --shell-escape --recorder --interaction=batchmode $(NAME).dtx >/dev/null
36 biber $(NAME) >/dev/null
37 $(CMP) --shell-escape --recorder --interaction=batchmode $(NAME).dtx >/dev/null
38 if [ -f $(NAME).glo ]; then makeindex -q -s gglo.ist -o $(NAME).gls $(NAME).glo; fi
39 if [ -f $(NAME).idx ]; then makeindex -q -s gind.ist -o $(NAME).ind $(NAME).idx; fi
40 if [ -f loccit.idx ]; then texindy -M icite.xdy loccit.idx >/dev/null; fi
41 if [ -f primary.idx ]; then texindy -M icite.xdy primary.idx >/dev/null; fi
42 $(CMP) --shell-escape --recorder --interaction=nonstopmode $(NAME).dtx > /dev/null
43 $(CMP) --shell-escape --recorder --interaction=nonstopmode $(NAME).dtx > /dev/null
44 @ echo "Make sample files..."
45 if [ ! -d $(PWD)/TMP ]; then mkdir $(PWD)/TMP; fi
46 cp $(PWD)/samples/*.bib $(PWD)/TMP
47 $(foreach file,$(texsamples), $(call dosamples, $(file)))
48 mv TMP/*.pdf samples/
49
50 samples: clean sty
51 if [ ! -d $(PWD)/TMP ]; then mkdir $(PWD)/TMP; fi
52 cp $(PWD)/samples/*.bib $(PWD)/TMP
53 $(foreach file,$(texsamples), $(call dosamples, $(file)))
54 mv TMP/*.pdf samples/
55
56 lualatex:
57 $(CMP) --shell-escape --recorder --interaction=batchmode $(NAME).dtx >/dev/null
58
59 clean:
60 rm -f $(NAME).bib $(PWD)/TMP/*.bib
61 rm -rf .backup
62 find -iname "*~" -or -iname "*.pdf" | xargs rm -rf
63 find ./* -type f -iname "Makefile" $(findopts) > ls-R
64 find ./* -type f -iname "*.tex" | grep '/samples/' >> ls-R
65 rsync -avPr --files-from=ls-R . .backup
66 rm -rf *
67 cp -p -r .backup/* .
68 rm -rf .backup
69 pandoc -s README.md -o about.html
70
71 distclean: clean uninst
72
73 inst: uninst all
74 mkdir -p $(UTREE)/{tex,source,doc}/latex/$(NAME)
75 cp $(NAME).dtx $(UTREE)/source/latex/$(NAME)
76 cp $(NAME).sty $(UTREE)/tex/latex/$(NAME)
77 cp $(NAME).pdf $(UTREE)/doc/latex/$(NAME)
78 cp -r samples/ $(UTREE)/doc/latex/$(NAME)
79
80 local: uninst
81 $(CMP) $(NAME).ins
82 mkdir -p $(UTREE)/{tex,source,doc}/latex/$(NAME)
83 cp $(NAME).sty $(UTREE)/tex/latex/$(NAME)
84
85 uninst:
86 rm -rf $(UTREE)/{tex,source,doc}/latex/$(NAME)
87
88 install: all
89 sudo mkdir -p $(LOCAL)/{tex,source,doc}/latex/$(NAME)
90 sudo cp $(NAME).dtx $(LOCAL)/source/latex/$(NAME)
91 sudo cp $(NAME).sty $(LOCAL)/tex/latex/$(NAME)
92 sudo cp $(NAME).pdf $(LOCAL)/doc/latex/$(NAME)
93 cp -r samples/ $(LOCAL)/doc/latex/$(NAME)
94
95 uninstall:
96 rm -rf $(LOCAL)/{tex,source,doc}/latex/$(NAME)
97
98 zip: all
99 ln -sf . $(NAME)
100 zip -Drq $(PWD)/$(NAME)-$(VERS).zip $(NAME)/{samples,README.md,$(NAME).{pdf,dtx,ins}}
101 rm $(NAME)
102
103 package: distclean all
104 mkdir $(NAME)/
105 cp Makefile README.md $(NAME).{ins,dtx,pdf} $(NAME)/
106 cp -r samples/ $(NAME)/
107 mkdir -p tex/latex/$(NAME)/
108 cp $(NAME).sty tex/latex/$(NAME)/
109 mkdir -p doc/latex/$(NAME)/
110 cp $(NAME).pdf doc/latex/$(NAME)/
111 cp -r samples/ doc/latex/$(NAME)/
112 mkdir -p source/latex/$(NAME)/
113 cp Makefile README.md $(NAME).{dtx,ins} source/latex/$(NAME)/
114 # zip -r $(NAME).tds.zip tex doc source
115 rm -rf tex/ source/ doc/
116 # tar czf $(NAME)-$(VERS).tar.gz $(NAME).tds.zip $(NAME)/
117 tar czf $(NAME)-$(VERS).tar.gz $(NAME)/
118 rm -rf $(NAME)/
119
120 .PHONY: all lualatex clean distclean inst local uninst install uninstall zip package samples