mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-27 05:03:07 +00:00
examples: add a complete example with all the bells and whistles
* examples/c/bistromathic/Makefile, * examples/c/bistromathic/README.md, * examples/c/bistromathic/bistromathic.test, * examples/c/bistromathic/local.mk, * examples/c/bistromathic/parse.y, * examples/c/bistromathic/scan.l: New. * Makefile.am (AM_YFLAGS_WITH_LINES): Add -Wdangling-alias. * examples/test: Make failure errors easier to read.
This commit is contained in:
35
examples/c/bistromathic/Makefile
Normal file
35
examples/c/bistromathic/Makefile
Normal file
@@ -0,0 +1,35 @@
|
||||
# This Makefile is designed to be simple and readable. It does not
|
||||
# aim at portability. It requires GNU Make.
|
||||
|
||||
BASE = bistromathic
|
||||
BISON = bison
|
||||
FLEX = flex
|
||||
XSLTPROC = xsltproc
|
||||
|
||||
all: $(BASE)
|
||||
|
||||
%.c %.h %.xml %.gv: %.y
|
||||
$(BISON) $(BISONFLAGS) --defines --xml --graph=$*.gv -o $*.c $<
|
||||
|
||||
%.c: %.l
|
||||
$(FLEX) $(FLEXFLAGS) -o$*.c $<
|
||||
|
||||
scan.o: parse.h
|
||||
$(BASE): parse.o scan.o
|
||||
$(CC) $(CFLAGS) -o $@ $^
|
||||
|
||||
run: $(BASE)
|
||||
@echo "Type bistromathic expressions. Quit with ctrl-d."
|
||||
./$<
|
||||
|
||||
html: $(BASE).html
|
||||
%.html: %.xml
|
||||
$(XSLTPROC) $(XSLTPROCFLAGS) -o $@ $$($(BISON) --print-datadir)/xslt/xml2xhtml.xsl $<
|
||||
|
||||
CLEANFILES = \
|
||||
$(BASE) *.o \
|
||||
parse.[ch] parse.output parse.xml parse.html parse.gv \
|
||||
scan.c
|
||||
|
||||
clean:
|
||||
rm -f $(CLEANFILES)
|
||||
Reference in New Issue
Block a user