## $Id$ ## texk/web2c/hitexdir/am/hitex.am: Makefile fragment for HiTeX ## ## Copyright 2021 Martin Ruckert ## You may freely use, modify and/or distribute this file. if HITEX bin_PROGRAMS += hitex hishrink histretch endif HITEX EXTRA_PROGRAMS += hitex hishrink histretch #kb hitex_CFLAGS = $(AM_CFLAGS) \ #kb -Wno-parentheses -Wno-maybe-uninitialized -Wno-unused-function -Wno-unused-variable hitex_CPPFLAGS = $(AM_CPPFLAGS) $(ZLIB_INCLUDES) hitex_LDADD = $(KPATHSEA_LIBS) $(ZLIB_LIBS) # histretch_CPPFLAGS = $(AM_CPPFLAGS) $(ZLIB_INCLUDES) histretch_LDADD = $(ZLIB_LIBS) # hishrink_CPPFLAGS = $(AM_CPPFLAGS) $(ZLIB_INCLUDES) hishrink_LDADD = $(ZLIB_LIBS) # We want debugging for the parser, and we use features not in POSIX yacc. # I guess the result is that we assume bison? Not sure if that's ok. AM_YFLAGS = -d -v -Wno-yacc # HiTeX CWEB sources hitex_web = hitexdir/format.w hitexdir/htex.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 = basetypes.h error.h hformat.h \ mkhformat.c \ hput.c hput.h \ hget.c hget.h \ shrink.lex-in shrink.yacc-in \ hishrink.c histretch.c htex_c_h = htex.c htex.h 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 # htex.c needs hitex.h, so depend on the hitex tangle. $(htex_c_h): htex-tangle hitex-tangle $(hi_ctangle_sh) htex # htex-tangle: ctangle$(EXEEXT) hitexdir/htex.w tangle-sh hitex-tangle $(hi_ctangle_sh) htex # Generating hformat.c using mkhformat. hformat.c: mkhformat ./mkhformat >hformat.c || { rm -f hformat.c; exit 1; } # Postprocessing lex and yacc files generated by ctangle. # (SED is defined with AC_PROG_SED) shrink-parser.y: $(srcdir)/hitexdir/yacc.sed shrink.yacc-in $(SED) -f $(srcdir)/hitexdir/yacc.sed shrink.yacc-in >shrink-parser.y \ || { rm -f shrink-parser.y; exit 1; } # shrink-lexer.l: $(srcdir)/hitexdir/lex.sed shrink.lex-in $(SED) -f $(srcdir)/hitexdir/lex.sed shrink.lex-in >shrink-lexer.l \ || { rm -f shrink-lexer.l; exit 1; } # Other web2c/*dir/am/*.am engine Makefile fragments define a bunch of # _OBJECTS variables. This does not seem right to me. Instead, we # correctly define the _SOURCES. # nodist_hitex_SOURCES = hformat.c hput.c $(htex_c_h) $(hitex_c_h) nodist_histretch_SOURCES = hformat.c histretch.c nodist_hishrink_SOURCES = hformat.c hishrink.c shrink-lexer.l shrink-parser.y # shrink needs the yacc header. It's actually the .o that should be the # target here, seems to me, but hishrink.o is not used for the object # name, it's hishrink-hishrink.o (because the program is also named # hishrink), and adding that here ends up trying to link with # hishrink-hishrink.o (I don't know), which doesn't exist. Sigh. hishrink.c: shrink-parser.h shrink-parser.c EXTRA_DIST += hitexdir/ChangeLog $(hitex_web) lex.sed yacc.sed DISTCLEANFILES += $(nodist_hitex_SOURCES) DISTCLEANFILES += $(nodist_hishrink_SOURCES) $(nodist_histretch_SOURCES) DISTCLEANFILES += format-tangle htex-tangle hitex-tangle DISTCLEANFILES += shrink-parser.* shrink-lexer.* ## HiTeX tests # still missing