summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/esk/Makefile
blob: 7f045d30adb75e8fdbdbd70ee46530208e514a97 (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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
# Makefile :-- install esk.
# Copyright (C) 2010 Tom Kazimiers (tom AT voodoo-arts.net)
# Based on the Makefile of emp latex package by Thorsten Ohl
# (Thorsten.Ohl@Physik.TH-Darmstadt.de)
#
# Esk is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# Esk is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#
# $Id: Makefile,v 1.0 2010/02/25 21:14:41 kazimiers Exp $
#
########################################################################

VERSION = 1
RELEASE = 0
STATUS  = WIP

########################################################################

# Directories
prefix = $(HOME)
texdir = $(prefix)/texmf/inputs
docdir = $(texdir)/doc

# Commands
INSTALL = install -c -m 755
INSTALL_DATA = install -c -m 644
# INSTALL = cp
# INSTALL_DATA = cp

LATEX = latex
SK = sketch
MAKEINDEX = makeindex
DVIPS = dvips
DFLAGS =
FILES="*.sk"

########################################################################
# No user serviceable parts below:
########################################################################

RESOLVE_XREF = \
  $(LATEX) $*.drv && \
  while grep 'Rerun to get cross-references right\.' $*.log; \
  do \
    $(LATEX) $*.drv; \
  done

RUN_MAKEINDEX = \
  $(MAKEINDEX) -s gind.ist -o $*.ind $*.idx && \
  $(MAKEINDEX) -s gglo.ist -o $*.gls $*.glo

all: esk.sty esk.drv

man: eskman.ps

ps: esk.ps

dvi: esk.dvi

install: all
	$(INSTALL_DATA) esk.sty $(texdir)

install.doc: all
	$(INSTALL_DATA) esk.dtx $(docdir)
	$(INSTALL_DATA) esk.drv $(docdir)
	$(INSTALL_DATA) eskman.drv $(docdir)

uninstall:
	rm -f $(texdir)/esk.sty

uninstall.doc:
	rm -f $(docdir)/esk.dtx
	rm -f $(docdir)/esk.drv
	rm -f $(docdir)/eskman.drv

esk.sty: esk.dtx esk.ins
	$(LATEX) esk.ins

esk.drv eskman.drv: esk.sty

esk.dvi: esk.dtx esk.drv esk.sty
	-$(LATEX) $*.drv
	for i in `ls *.sk`; do \
		($(SK) -o "$$i.tex" "$$i" && \
		cut -d "%" -f1 <"$$i.tex" >"$$i.tex.tmp" && \
		rm "$$i.tex" && \
		mv "$$i.tex.tmp" "$$i.tex") \
	done
	-$(LATEX) $*.drv
	$(RUN_MAKEINDEX)
	$(RESOLVE_XREF)

eskman.ps: eskman.dvi
	dvips eskman.dvi -o

eskman.dvi: esk.dtx eskman.drv esk.sty
	-$(LATEX) $*.drv
	# call sketch, e. g. convert the sketch code to tex
	# unfortunately Sketch produces comments, that is a
	# problem because DTX is used and a single %  sign
	# there has a meaning. Thus substitude each % sign
	# with a %% sign:
	for i in `ls *.sk`; do \
		($(SK) -o "$$i.tex" "$$i" && \
		cut -d "%" -f1 <"$$i.tex" >"$$i.tex.tmp" && \
		rm "$$i.tex" && \
		mv "$$i.tex.tmp" "$$i.tex") \
	done
	-$(LATEX) $*.drv
	pdflatex $*.drv
	$(RUN_MAKEINDEX)
	$(RESOLVE_XREF)

manual.ps.gz: manual.ps
	gzip < $< > $@

manual.ps: eskman.dvi $(MANPICS)
	$(DVIPS) $(DFLAGS) -o $@ $<

esk.ps: esk.dvi $(MANPICS)
	$(DVIPS) $(DFLAGS) -o $@ $<

clean:
	rm -f *.mp *.rawmp *.[0-9]* \
	      *.log *.dvi *.aux *.toc *.ilg *.glo *.gls *.idx *.ind \
	      *.ps *.mpx '#*#' *~ .*~

realclean: clean
	rm -f esk.sty esk.drv eskman*

distclean: realclean

########################################################################
# Maintenance:

DISTFILES = /usr/local/etc/COPYING README Makefile esk.dtx esk.ins

distdir = esk-$(VERSION).$(RELEASE)$(STATUS)
CVSTAG = ESK_$(VERSION)_$(RELEASE)$(STATUS)
TEXTAG = v$(VERSION).$(RELEASE)
M =

fileversion:
	perl -pe \
	  's/^\\def\\fileversion\{.*\}/\\def\\fileversion{$(TEXTAG)}/;' \
	  esk.dtx > esk.vtmp
	if cmp -s esk.dtx esk.vtmp; then \
	  rm -f esk.vtmp; \
	else \
	  mv esk.vtmp esk.dtx; \
	fi

dist: $(distdir).tar.gz
snap: esk-current.tar.gz

$(distdir).tar.gz:
	rm -fr $(distdir) $(distdir).tmp
	mkdir $(distdir)
	(cd ./$(distdir).tmp && \
         make $(DISTFILES) && \
         cp $(DISTFILES) ../$(distdir))
	tar cf - $(distdir) | gzip > $@
	rm -fr $(distdir) $(distdir).tmp

esk-current.tar.gz: $(DISTFILES) fileversion
	rm -fr esk-current
	mkdir esk-current
	touch esk-current/1_THIS_IS_A_SNAPSHOT_OF_
	touch esk-current/2_WORK_IN_PROGRESS_AND__
	touch esk-current/3_NOT_YET_RELEASED_CODE_
	cp $(DISTFILES) esk-current
#	perl -pe \
#	  's/\[\\filedate/[(UNRELEASED and UNSUPPORTED snapshot)/;' \
	  esk.dtx > esk-current/esk.dtx
	tar cf - esk-current | gzip > $@
	rm -fr esk-current

########################################################################
# Local Variables:
# mode:text
# End: