summaryrefslogtreecommitdiff
path: root/web/schemeweb2/sweb.make
blob: 1ffa7502882525cd34af4df233e2973b8356fb1d (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
# This is a sample Makefile for use with SchemeWEB(2)
# To use it, create a new file called Makefile in the directory
# containing the SchemeWEB files, whose name should end by .sw
# inside this file, add the line
# TEXFILE = XXX.tex [ YYY.tex ZZZ.tex ... ]
# Where XXX.tex YYY.tex and ZZZ.tex are the name of your main tex
# files (those you which to compile with 'LaTeX XXX.tex')

# then, add the line
# include <prefix-dir>/sweb.make
# where <prefix-dir> is the name of the directory containing the
# present file. You can now compile with 'make', 'make dvi', 
# 'make ps', 'make html', or clean the directory with 'make clean' (be
# carefull with this option !)

SWFILE := $(wildcard *.sw)

normal : tex scm

all : tex scm dvi html ps

clean :
	rm -f `echo *.sw | sed 's/.sw$//.scm/g'`
	rm -f `echo *.sw | sed 's/.sw$//.tex/g'`
	rm -f *.toc *.aux *.log
	rm -f $(TEXFILE:.tex=.dvi)
	rm -f $(TEXFILE:.tex=.ps)

tex : $(SWFILE:.sw=.tex)

scm : $(SWFILE:.sw=.scm)

dvi : $(TEXFILE:.tex=.dvi)

ps :  $(TEXFILE:.tex=.ps)

html : $(TEXFILE)
	latex2html $<

%.tex : %.sw
	sweb -w $< $@

%.scm : %.sw
	sweb -s $< $@

# Sometimes, you have to compile twice. This is the reason of the sleep and touch.
$(TEXFILE:.tex=.dvi) : $(wildcard *.tex)
	latex $(@:.dvi=.tex)
	sleep 1
	touch $(@:.dvi=.tex)

$(TEXFILE:.tex=.ps) : $(TEXFILE:.tex=.dvi)
	dvips $< -o $@