Debian Codegraph @

texk/web2c/hitexdir/am/hitex.am

raw
1 ## $Id: hitex.am 76798 2025-11-09 18:34:39Z karl $
2 ## texk/web2c/hitexdir/am/hitex.am: Makefile fragment for HiTeX
3 ##
4 ## Copyright 2021-2025 Martin Ruckert <[email protected]>
5 ## You may freely use, modify and/or distribute this file.
6
7 if HITEX
8 bin_PROGRAMS += hitex hishrink histretch
9 noinst_PROGRAMS += himktables
10
11 # Force Automake to use CXXLD for linking
12 nodist_EXTRA_hitex_SOURCES = dummy.cxx
13
14 # convenience target to build all the programs here.
15 hiall: hitex hishrink histretch
16
17 # At the moment, these are the only man pages handled in the
18 # conglomerated web2c/Makefile[.am]. (All the others are in man/.)
19 # If that changes, have to set at top level and use +=.
20 man1_MANS = hitexdir/man/hishrink.man hitexdir/man/histretch.man \
21 hitexdir/man/hitex.man
22 endif HITEX
23
24 ## Debugging for the parser as usual.
25 ## Except we eschew all lex/yacc steps in the Makefile here; see below.
26 ## AM_YFLAGS = -d -v -Wno-yacc
27
28 hitex_CPPFLAGS = $(AM_CPPFLAGS) $(ZLIB_INCLUDES)
29 hitex_CPPFLAGS += $(HARFBUZZ_INCLUDES)
30 hitex_CPPFLAGS += -I$(srcdir)/libmd5
31 hitex_CPPFLAGS += -I$(srcdir)/hitexdir
32 hitex_CPPFLAGS += -DINIT -DSTAT -DWEB2CVERSION="\"${WEB2CVERSION}\"" -Wno-unused-result
33 # -DDEBUG drops into an interactive debugging session.
34 hitex_LDADD = $(KPATHSEA_LIBS) $(ZLIB_LIBS)
35 hitex_LDADD += $(HARFBUZZ_LIBS) $(GRAPHITE2_LIBS)
36 hitex_LDADD += libmd5.a
37 hitex_DEPENDENCIES = $(KPATHSEA_DEPEND) $(ZLIB_DEPEND)
38 hitex_DEPENDENCIES += $(HARFBUZZ_DEPEND) $(GRAPHITE2_DEPEND)
39 hitex_DEPENDENCIES += libmd5.a
40 #
41 histretch_CPPFLAGS = $(AM_CPPFLAGS) $(ZLIB_INCLUDES) -I$(srcdir)/hitexdir
42 histretch_LDADD = $(ZLIB_LIBS)
43 histretch_DEPENDENCIES = $(ZLIB_DEPEND)
44 #
45 # The -I$(srcdir)/hitexdir is so the compiler can find the *parser.h file.
46 hishrink_CPPFLAGS = $(AM_CPPFLAGS) $(ZLIB_INCLUDES) -I$(srcdir)/hitexdir
47 hishrink_LDADD = $(ZLIB_LIBS)
48 hishrink_DEPENDENCIES = $(ZLIB_DEPEND)
49
50 # HiTeX CWEB sources
51 hitex_web = hitexdir/hiformat.w hitexdir/hitex.w
52
53 # Creating several files: need stamp file (named *-tangle) and two rules
54 # with identical recipes (see ./tangle-sh for background).
55 hi_ctangle_sh = CWEBINPUTS=$(srcdir)/hitexdir AM_V_P=$(AM_V_P) $(SHELL) ./tangle-sh $@ $(CTANGLE)
56
57 # HiTeX C/yacc/lex sources generated using ctangle.
58 # For each cweb (.w) source file, list the files generated.
59 hiformat_c_h_l_y = \
60 hibasetypes.h \
61 hierror.h \
62 hiformat.c hiformat.h \
63 higet.c higet.h \
64 hilexer.l \
65 himktables.c \
66 hiparser.y \
67 hiput.c hiput.h \
68 hishrink.c \
69 hiskip.c \
70 histretch.c
71 hitex_c = hitex.c
72
73 $(hiformat_c_h_l_y): hiformat-tangle
74 hiformat-tangle: ctangle$(EXEEXT) hitexdir/hiformat.w tangle-sh
75 $(hi_ctangle_sh) hiformat
76
77 $(hitex_c): hitex-tangle
78 hitex-tangle: ctangle$(EXEEXT) hitexdir/hitex.w tangle-sh
79 $(hi_ctangle_sh) hitex
80
81 # Generating hitables.c using himktables.
82 hitables.c: himktables$(EXEEXT)
83 ./himktables$(EXEEXT) > $@ || { rm -f hitables.c; exit 1; }
84
85 # hitex
86 nodist_hitex_SOURCES = hitables.c hiput.c $(hitex_c)
87
88 # histretch
89 nodist_histretch_SOURCES = hitables.c histretch.c
90
91 # The actual sources for the lexer and parser are in hiformat.w.
92 # However, to simplify life with Automake (a little), we specify the
93 # generated .[ch] files here as if they were the sources, and don't try
94 # to have Automake support the derivation from .w, or even from the .[ly].
95 #
96 nodist_hishrink_SOURCES = hitables.c \
97 hitexdir/hilexer.c \
98 hitexdir/hiparser.c hitexdir/hiparser.h \
99 hishrink.c
100
101 # hitex, histretch, and hishrink all need (at least) some
102 # of the sources generated from hiformat.w.
103 #
104 $(hitex_OBJECTS): hitex-tangle hiformat-tangle
105 $(hishrink_OBJECTS): hiformat-tangle
106 $(histretch_OBJECTS): hiformat-tangle
107
108 # By the way, we might be able to use the $(BUILT_SOURCES) suggestion in
109 # the Automake manual. In order to be able to invoke specific targets
110 # (hiall, hitex, hishrink, ...), we'd have to add an explicit dependency
111 # on $(BUILT_SOURCES), but this seems feasible. But since the above
112 # _OBJECTS dependencies apparently work ok, go with it until a problem arises.
113
114 EXTRA_DIST += hitexdir/ChangeLog $(hitex_web)
115
116 DISTCLEANFILES += $(nodist_hitex_SOURCES)
117 DISTCLEANFILES += $(nodist_hishrink_SOURCES) $(nodist_histretch_SOURCES)
118 DISTCLEANFILES += hiformat-tangle hitex-tangle
119
120 ## HiTeX tests
121 #
122 hitex_tests = hitexdir/tests/hello.test \
123 hitexdir/tests/rule.test
124
125 hitexdir/tests/hello.log: hitex$(EXEEXT) histretch$(EXEEXT)
126 hitexdir/tests/rule.log: hitex$(EXEEXT) histretch$(EXEEXT) hishrink$(EXEEXT)
127
128 EXTRA_DIST += $(hitex_tests)
129
130 if HITEX
131 TESTS += $(hitex_tests)
132 endif HITEX
133
134 ## hello.test
135 EXTRA_DIST += hitexdir/tests/hello.tex
136 DISTCLEANFILES += hello.log
137
138 ## rule.test
139 EXTRA_DIST += hitexdir/tests/rule.tex
140 DISTCLEANFILES += rule.log
141
142 # (end of hitex.am)