summaryrefslogtreecommitdiff
path: root/support/splint/examples/xxpression/Makefile
blob: 8d8b6877c6d6bb875c447b1ac861d45892d89f36 (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
# Copyright 2012-2020, Alexander Shibakov
# This file is part of SPLinT
#
# SPLinT 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 3 of the License, or
# (at your option) any later version.
#
# SPLinT 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 SPLinT.  If not, see <http://www.gnu.org/licenses/>.

# this Makefile uses a flat directory structure for demonstration
# purposes; the main directory (../..) contains a slightly more
# modular organization.

XXPRESSION_PREREQS = %.tex %.scn %.idx %.tok ${SPLINT_XPTABLES} ${SPLINT_XLTABLES}
XXPRESSION_PREREQS += ${SPLINT_ROOT}cweb/bo.tok ${SPLINT_ROOT}cweb/fo.tok xymmap.sty xtoks.sty

include ../../makefile.inc
include ${SPLINT_ROOT}makefile.loc

# rules specific to this example

PARSER = xxpp
LEXER = xxpl

all:		xxpression.pdf ptab.tex ltab.tex

step1:		${PARSER}.y ${LEXER}.l
step2:		ptabout ltabout
step3:		ltab.tex ptab.tex
step4:		xymbols.sns

ptabout:	${SPLINT_ROOT}cweb/mkeparser.c ${PARSER}.c
		${CC} -DPARSER_FILE=\"../examples/xxpression/$(lastword $^)\" -DYYPARSE_PARAMETERS= -o $@ $<

ptab.tex:	ptabout
		$< --optimize-actions $@

ltabout:	${SPLINT_ROOT}cweb/mkscanner.c ${LEXER}.c
		${CC} -DLEXER_FILE=\"../examples/xxpression/$(lastword $^)\" -o $@ $<

ltab.tex:	ltabout
		$< --optimize-actions $@

${LEXER}.c:	${LEXER}.l
		${FLEX} -o $@ $<

test.tex xymbols.tex \
${PARSER}.yy ${LEXER}.ll:	xxpression.x alphas.hx
				@${CTANGLE} $<
				${UNLINE} test.txx test.tex
				${UNLINE} xymbols.txx xymbols.tex

xymbols.sns:			xymbols.tex xxpression.tok ${SPLINT_ROOT}cweb/bo.tok ${SPLINT_ROOT}cweb/fo.tok \
					${SPLINT_XPTABLES} ${SPLINT_XLTABLES} ptab.tex
				${PDFTEX} $<

alphas.hx:
				${MISCCW} --alpha-list --alpha-length=1 $@

xxpression.tex:			xxpression.x alphas.hx
				${CWEAVE} $<

xxpression.gdx:%.gdx:		${XXPRESSION_PREREQS}
				${TEX} $*.tex

xxpression.pdf:%.pdf:		${XXPRESSION_PREREQS} %.gdy
				${PDFTEX} $* && touch $*.gdy && touch $*.pdf
#		if [ -f $*.gdx ] ; then ${BINDX} $*.gdx $*.gdy; fi

xxpression.tok:			xxpression.tex ${SPLINT_XPTABLES} ${SPLINT_XLTABLES} ${SPLINT_ROOT}cweb/bo.tok
				${PDFTEX} $< && touch xxpression.tok

${SPLINT_ROOT}cweb/%:
				cd ${SPLINT_ROOT}cweb/ && ${MAKE} $(notdir $@)

test:	test.tex xymbols.sns xxpression.tok ptab.tex ltab.tex ${SPLINT_ROOT}cweb/fo.tok
	tex test.tex

docs:	xxpression.pdf

clean:	clean_core
	-rm -f ptabout ltabout *.txx

mostlyclean:			clean_temp
				-rm -f ptabout ltabout xxpression.c *.txx

distclean:			clean
				cd ${SPLINT_ROOT} && ${MAKE} clean

.INTERMEDIATE:			xxpression.gdx