Demonstration of groff .psbb request handling code, for EPS and PDF input files
Rev. | 8ca6d9693e3e7a36c765a637de17110750d5ce6a |
---|---|
Größe | 3,493 Bytes |
Zeit | 2021-10-22 22:27:47 |
Autor | Keith Marshall |
Log Message | Clean state map generator files.
* GNUmakefile (clean): Augment commands to remove files...
|
# GNUmakefile
#
# Simple makefile to build .psbb request handler test/demonstration
# program; with no apology, this may gratuitously require GNU make.
#
# Written by Keith Marshall <keith@users.osdn.me>
# Copyright (C) 2017, Free Software Foundation, Inc.
#
# This file is part of groff.
#
# groff 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.
#
# groff 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 this program. If not, see <http://www.gnu.org/licenses/>.
#
all: psbb
all-debug: psbb state.map
all-debug: CPPFLAGS += -DEBUG
srcdir = .
vpath %.l ${srcdir}
vpath %.y ${srcdir}
# For convenience, we've placed a necessary subset of libgroff sources
# and headers in our local libgroff subdirectory; ensure that make, and
# the C/C++ compilers can see them.
#
vpath %.c ${srcdir} ${srcdir}/libgroff
vpath %.cpp ${srcdir} ${srcdir}/libgroff
vpath %.h ${srcdir} ${srcdir}/libgroff
CFLAGS = -g -O2
CXXFLAGS = -g -O2
CPPFLAGS += -I ${srcdir} -I ${srcdir}/libgroff
# GNU make's default $(YACC) rule doesn't satisfy the dependencies we
# would like, so we specify our own alternative rule.
#
%.tab.c %.tab.h: %.y
$(YACC) $(YFLAGS) -b $* -d $<
# When running this $(YACC) rule, we may need supplementary $(YFLAGS)
# to assign a symbol prefix, so that we do not depend on non-portable
# directives, supported by bison, but not by yacc.
#
psbb.tab.c psbb.tab.h: YFLAGS += -p psbb_
# This is a minimal subset of libgroff.a, (just sufficient to satisfy
# our immediate requirements for our .psbb handler test program).
#
libgroff.a: error.o errarg.o itoa.o fatal.o
$(AR) rcs $@ $^
# By default, GNU make uses $(CC) for linking, but we need C++ support,
# (which $(CC) doesn't give us automatically); moreover, we do not want
# psbb to incur a default dependency on psbb.o, so link explicitly.
#
psbb: t-psbb.o psbblex.o psbb.tab.o libgroff.a
$(CXX) $(LDFLAGS) $(TARGET_ARCH) $^ -o $@
# Object file dependencies: GCC could generate these automatically, but
# this is simpler, in this trivial instance.
#
psbblex.o: psbblex.c psbb.tab.h psbb.h
t-psbb.o psbblex.o psbb.tab.o error.o errarg.o: error.h errarg.h
t-psbb.o: psbb.h
# Rules to derive, from psbblex.l source, a sed filter for mapping
# of lexer state values, as they appear in debugging trace log files,
# back to their original state names.
#
vpath %.in ${srcdir}
vpath %.map ${srcdir}
state.map: psbblex.l psbblex.map.in
$(MAKE) --no-print-directory psbblex.$@
mv psbblex.$@ $@
%.state.map: %.l %.map.in
$(MAKE) --no-print-directory $*.map
echo "#! $(shell which sed) -f" > $@
./$*.map >> $@ && chmod 755 $@
$(RM) $*.map
%.map.lx: %.l
sed -n -e '/^%x/{s/ */\n%x /g' -e 's/^%x\n//p' -e '}' $^ > $@
%.map.ls: %.map.lx
sed -e 's/ *%x */ SHOW(/' -e 's/$$/);/' $< > $@
%.map.l: %.map.in %.map.ls
sed $(STATE_MAP_SCRIPT) $< > $@
STATE_MAP_SCRIPT = -e '/@LEXER_STATE_MAP@/{r $@x' -e d -e '}' \
-e '/@SED_FILTER_RULES@/{r $@s' -e d -e '}'
# Clean up rules
#
clean:; $(RM) *.o *.map psbb
realclean: clean
$(RM) `echo *.l | sed 's,\.l,.c,g'` *.tab.* *.a