## $Id: hitex.am 76798 2025-11-09 18:34:39Z karl $ ## texk/web2c/hitexdir/am/hitex.am: Makefile fragment for HiTeX ## ## Copyright 2021-2025 Martin Ruckert ## You may freely use, modify and/or distribute this file. if HITEX bin_PROGRAMS += hitex hishrink histretch noinst_PROGRAMS += himktables # Force Automake to use CXXLD for linking nodist_EXTRA_hitex_SOURCES = dummy.cxx # convenience target to build all the programs here. hiall: hitex hishrink histretch # At the moment, these are the only man pages handled in the # conglomerated web2c/Makefile[.am]. (All the others are in man/.) # If that changes, have to set at top level and use +=. man1_MANS = hitexdir/man/hishrink.man hitexdir/man/histretch.man \ hitexdir/man/hitex.man endif HITEX ## 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 += $(HARFBUZZ_INCLUDES) hitex_CPPFLAGS += -I$(srcdir)/libmd5 hitex_CPPFLAGS += -I$(srcdir)/hitexdir hitex_CPPFLAGS += -DINIT -DSTAT -DWEB2CVERSION="\"${WEB2CVERSION}\"" -Wno-unused-result # -DDEBUG drops into an interactive debugging session. hitex_LDADD = $(KPATHSEA_LIBS) $(ZLIB_LIBS) hitex_LDADD += $(HARFBUZZ_LIBS) $(GRAPHITE2_LIBS) hitex_LDADD += libmd5.a hitex_DEPENDENCIES = $(KPATHSEA_DEPEND) $(ZLIB_DEPEND) hitex_DEPENDENCIES += $(HARFBUZZ_DEPEND) $(GRAPHITE2_DEPEND) hitex_DEPENDENCIES += libmd5.a # histretch_CPPFLAGS = $(AM_CPPFLAGS) $(ZLIB_INCLUDES) -I$(srcdir)/hitexdir 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/hiformat.w hitexdir/hitex.w # Creating several files: need stamp file (named *-tangle) and two rules # with identical recipes (see ./tangle-sh for background). 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. hiformat_c_h_l_y = \ hibasetypes.h \ hierror.h \ hiformat.c hiformat.h \ higet.c higet.h \ hilexer.l \ himktables.c \ hiparser.y \ hiput.c hiput.h \ hishrink.c \ hiskip.c \ histretch.c hitex_c = hitex.c $(hiformat_c_h_l_y): hiformat-tangle hiformat-tangle: ctangle$(EXEEXT) hitexdir/hiformat.w tangle-sh $(hi_ctangle_sh) hiformat $(hitex_c): hitex-tangle hitex-tangle: ctangle$(EXEEXT) hitexdir/hitex.w tangle-sh $(hi_ctangle_sh) hitex # Generating hitables.c using himktables. hitables.c: himktables$(EXEEXT) ./himktables$(EXEEXT) > $@ || { rm -f hitables.c; exit 1; } # hitex nodist_hitex_SOURCES = hitables.c hiput.c $(hitex_c) # histretch nodist_histretch_SOURCES = hitables.c histretch.c # The actual sources for the lexer and parser are in hiformat.w. # However, to simplify life with Automake (a little), we specify the # generated .[ch] files here as if they were the sources, and don't try # to have Automake support the derivation from .w, or even from the .[ly]. # nodist_hishrink_SOURCES = hitables.c \ hitexdir/hilexer.c \ hitexdir/hiparser.c hitexdir/hiparser.h \ hishrink.c # hitex, histretch, and hishrink all need (at least) some # of the sources generated from hiformat.w. # $(hitex_OBJECTS): hitex-tangle hiformat-tangle $(hishrink_OBJECTS): hiformat-tangle $(histretch_OBJECTS): hiformat-tangle # By the way, we might be able to use the $(BUILT_SOURCES) suggestion in # the Automake manual. In order to be able to invoke specific targets # (hiall, hitex, hishrink, ...), we'd have to add an explicit dependency # on $(BUILT_SOURCES), but this seems feasible. But since the above # _OBJECTS dependencies apparently work ok, go with it until a problem arises. EXTRA_DIST += hitexdir/ChangeLog $(hitex_web) DISTCLEANFILES += $(nodist_hitex_SOURCES) DISTCLEANFILES += $(nodist_hishrink_SOURCES) $(nodist_histretch_SOURCES) DISTCLEANFILES += hiformat-tangle hitex-tangle ## HiTeX tests # hitex_tests = hitexdir/tests/hello.test \ hitexdir/tests/rule.test hitexdir/tests/hello.log: hitex$(EXEEXT) histretch$(EXEEXT) hitexdir/tests/rule.log: hitex$(EXEEXT) histretch$(EXEEXT) hishrink$(EXEEXT) EXTRA_DIST += $(hitex_tests) if HITEX TESTS += $(hitex_tests) endif HITEX ## hello.test EXTRA_DIST += hitexdir/tests/hello.tex DISTCLEANFILES += hello.log ## rule.test EXTRA_DIST += hitexdir/tests/rule.tex DISTCLEANFILES += rule.log # (end of hitex.am)