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
|
## $Id$
## texk/web2c/hitexdir/am/hitex.am: Makefile fragment for HiTeX
##
## Copyright 2021 Martin Ruckert <ruckert@cs.hm.edu>
## You may freely use, modify and/or distribute this file.
if HITEX
bin_PROGRAMS += hitex hishrink histretch
endif HITEX
EXTRA_PROGRAMS += hitex hishrink histretch
# convenience target to build all the programs here.
hiall: hitex hishrink histretch
## Debugging for the parser as usual.
## Except we eschew all lex/yacc steps in the Makefile here; see below.
## AM_YFLAGS = -d -v -Wno-yacc
hitex_CPPFLAGS = $(AM_CPPFLAGS) $(ZLIB_INCLUDES)
hitex_CPPFLAGS += -I$(srcdir)/libmd5
hitex_LDADD = $(KPATHSEA_LIBS) $(ZLIB_LIBS) libmd5.a
hitex_LDADD += libmd5.a
hitex_DEPENDENCIES = $(KPATHSEA_DEPEND) $(ZLIB_DEPEND) libmd5.a
#
histretch_CPPFLAGS = $(AM_CPPFLAGS) $(ZLIB_INCLUDES)
histretch_LDADD = $(ZLIB_LIBS)
histretch_DEPENDENCIES = $(ZLIB_DEPEND)
#
# The -I$(srcdir)/hitexdir is so the compiler can find the *parser.h file.
hishrink_CPPFLAGS = $(AM_CPPFLAGS) $(ZLIB_INCLUDES) -I$(srcdir)/hitexdir
hishrink_LDADD = $(ZLIB_LIBS)
hishrink_DEPENDENCIES = $(ZLIB_DEPEND)
# HiTeX CWEB sources
hitex_web = hitexdir/format.w hitexdir/hitex.w
# Creating several files: need stamp file and two rules with identical recipes
hi_ctangle_sh = CWEBINPUTS=$(srcdir)/hitexdir AM_V_P=$(AM_V_P) $(SHELL) ./tangle-sh $@ $(CTANGLE)
# HiTeX C/yacc/lex sources generated using ctangle.
# For each cweb (.w) source file, list the files generated.
format_c_h_l_y = hibasetypes.h hierror.h hiformat.h \
himktables.c \
hiput.c hiput.h \
higet.c higet.h \
hilexer.l hiparser.y \
hishrink.c histretch.c
hitex_c_h = hitex.c hitex.h
$(format_c_h_l_y): format-tangle
$(hi_ctangle_sh) format
#
format-tangle: ctangle$(EXEEXT) hitexdir/format.w tangle-sh
$(hi_ctangle_sh) format
$(hitex_c_h): hitex-tangle
$(hi_ctangle_sh) hitex
#
hitex-tangle: ctangle$(EXEEXT) hitexdir/hitex.w tangle-sh
$(hi_ctangle_sh) hitex
# Generating hitables.c using himktables.
hitables.c: himktables
./himktables > $@ || { rm -f hitables.c; exit 1; }
# hitex
nodist_hitex_SOURCES = hitables.c hiput.c $(hitex_c_h)
# histretch
nodist_histretch_SOURCES = hitables.c histretch.c
# The actual sources for the lexer and parser are in format.w.
# However, to simplify life with Automake (a little), we include the
# generated [.ch] files as if they were the sources here, and don't try
# to have Automake support the derivation from .w.
#
# The $(srcdir) is not necessary if everything is up to date,
# but can help with the remake if the [.ch] or [.ly] are not present.
nodist_hishrink_SOURCES = hitables.c \
hitexdir/hilexer.c \
hitexdir/hiparser.c hitexdir/hiparser.h
# This is our attempt to ensure that bison got run before anything else,
# when needed.
#
$(hishrink_OBJECTS): $(srcdir)/hitexdir/hiparser.h
#
# By the way, the $(BUILT_SOURCES) suggestion in the Automake manual for
# this does not work for us, because we want to be able to invoke
# specific targets (hiall, hitex, hishrink, ...), and $(BUILT_SOURCES)
# is only a dependency on general targets (all, install, ...).
EXTRA_DIST += hitexdir/ChangeLog $(hitex_web)
DISTCLEANFILES += $(nodist_hitex_SOURCES)
DISTCLEANFILES += $(nodist_hishrink_SOURCES) $(nodist_histretch_SOURCES)
DISTCLEANFILES += format-tangle hitex-tangle
## HiTeX tests
# still missing
|