Files
bison/examples/c++/calc++/Makefile
Akim Demaille 85d303b713 examples: sort them per language and complete them
Convert some of the READMEs to Markdown, which is now more common, and
nicely displayed in some git hosting services.

Add missing READMEs and Makefiles.  Generate XML, HTML and Dot files.  Be
sure to ship the test files.  Complete CLEANFILES to remove all generated
files.

* examples/calc++: Move into...
* examples/c++: here.
* examples/mfcalc, examples/rpcalc: Move into...
* examples/c: here.

* examples/README.md, examples/c++/calc++/Makefile, examples/c/local.mk,
* examples/c/mfcalc/Makefile, examples/c/rpcalc/Makefile,
* examples/d/README.md, examples/java/README.md:
New files.

* examples/test (medir): Be robust to deeper directory nesting.
2018-12-09 13:55:05 +01:00

42 lines
867 B
Makefile

# This Makefile is designed to be simple and readable. It does not
# aim at portability. It requires GNU Make.
BASE = calc++
BISON = bison
CXX = g++
FLEX = flex
XSLTPROC = xsltproc
all: $(BASE)
%.cc %.hh %.xml %.gv: %.yy
$(BISON) $(BISONFLAGS) --xml --graph=$*.gv -o $*.cc $<
%.cc: %.ll
$(FLEX) $(FLEXFLAGS) -o$@ $<
%.o: %.cc
$(CXX) $(CXXFLAGS) -c -o$@ $<
$(BASE): $(BASE).o driver.o parser.o scanner.o
$(CXX) -o $@ $^
$(BASE).o: parser.hh
parser.o: parser.hh
scanner.o: parser.hh
run: $(BASE)
@echo "Type arithmetic expressions. Quit with ctrl-d."
./$< -
html: parser.html
%.html: %.xml
$(XSLTPROC) $(XSLTPROCFLAGS) -o $@ $$($(BISON) --print-datadir)/xslt/xml2xhtml.xsl $<
CLEANFILES = \
$(BASE) *.o \
parser.hh parser.cc parser.output parser.xml parser.html parser.gv location.hh \
scanner.cc
clean:
rm -f $(CLEANFILES)