summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/mnotes/Makefile
blob: e9d5e727a8b6312a7dc5eaf810b93dcf40d33c8a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
SHELL=/bin/bash
NAME=mnotes
VERSION=0.8
DISTDIR=$(NAME)
ARCHIVE_NAME=/tmp/$(NAME)-$(VERSION).tar.gz
DISTFILES=$(NAME).dtx Makefile README $(NAME).ins $(NAME).pdf

DEP=$(NAME).sty

all: pdf

ps: $(NAME).ps

%.ps: %.dvi
	dvips $(DVIPSOPT) $< -o $@

pdf: $(NAME).pdf $(DEP)

%.pdf: %.dtx
	pdflatex $<
	makeindex -s gglo.ist -o $(NAME).gls $(NAME).glo
	makeindex -s gind.ist -o $(NAME).ind $(NAME).idx
	pdflatex $<

dist: $(DISTFILES)
	rm -rf $(DISTDIR)
	mkdir $(DISTDIR)
	cp -aL --parents $(DISTFILES) $(DISTDIR)
	tar cfvz $(ARCHIVE_NAME) $(DISTDIR)
	rm -rf $(DISTDIR)

clean: 
	rm -f $(NAME).{glo,log,toc,lot,lof,idx,ilg,ind,aux,blg,bbl,dvi}
	rm -f *~

cleandist: clean 
	rm -f $(NAME).{pdf,sty,ins}

REFWARN = 'Rerun to get cross-references'
LATEXMAX = 5

%.dvi: %.dtx $(DEP)
	latex $<
	RUNS=$(LATEXMAX); \
	while [ $$RUNS -gt 0 ] ; do \
		if grep $(REFWARN) $*.log > /dev/null; \
		then latex $< ; else break; fi; \
		RUNS=`expr $$RUNS - 1`; \
	done

$(NAME).sty: $(NAME).ins FORCE
	tex $(NAME).ins

$(NAME).ins:
	pdflatex $(NAME).dtx

FORCE: