summaryrefslogtreecommitdiff
path: root/support/make/scalatex.mk
blob: 01bd2b186f15e4fa4e4b8bb91446ad270a4c80cf (plain) (blame)
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
############################################################-*-Makefile-*-####
# SCALATEX - Evaluate Embedded Scala Scripts
##############################################################################
# $Id$

##############################################################################
# Usage
#
#   make scalatex[.clean|.distclean]
#   make <*.tex>
#
##############################################################################
# Examples
#
# Generate all .tex files produced by processing a .scala.tex file
#
#   make scalatex
#
#
# Generate tutorial.tex by processing tutorial.scala.tex
#
#   make tutorial.tex
#
##############################################################################

##############################################################################
# Defaults

SCSH			?= scsh

##############################################################################
# Values

scalatex_ENV		?= CLASSPATH=$(PROJECT_CLASSPATH)
scalatex_SCRIPT		?= $(PROJECT_SUPPORTDIR)/latex/scalatex.scm

##############################################################################
# Commands

all			: scalatex
clean			: scalatex.clean
distclean		: scalatex.distclean

scalatex		: $(patsubst %.scala.tex,%.tex,$(wildcard *.scala.tex))

scalatex.clean		:

scalatex.distclean	:
	@for file in *.scala.tex; do \
	    [ "$$file" = "*.scala.tex" ] || ( \
	        echo $(RM) "$${file%.scala.tex}.tex"; \
	        $(RM) "$${file%.scala.tex}.tex" ); \
	done

.PHONY			: scalatex
.PHONY			: scalatex.clean
.PHONY			: scalatex.distclean

##############################################################################
# Rules

%.tex			: %.scala.tex
	$(scalatex_ENV) $(SCSH) -e main -s $(scalatex_SCRIPT) $< $@

.PRECIOUS		: %.tex

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