examples: modernize the example Makefiles

* examples/c++/Makefile, examples/c++/calc++/Makefile,
* examples/c++/glr/Makefile, examples/c/bistromathic/Makefile,
* examples/c/calc/Makefile, examples/c/glr/Makefile,
* examples/c/lexcalc/Makefile, examples/c/mfcalc/Makefile,
* examples/c/pushcalc/Makefile, examples/c/reccalc/Makefile,
* examples/c/rpcalc/Makefile, examples/d/calc/Makefile,
* examples/d/simple/Makefile, examples/java/calc/Makefile,
* examples/java/simple/Makefile:
Use --html to generate *.html directly.
No longer demonstrate --xml.
No longer show rules for xml to html.
Use --header, not --defines.
Use --graph without specifying the output file now that we
generate *.gv by default.
This commit is contained in:
Akim Demaille
2020-09-07 06:34:00 +02:00
parent 413d318940
commit 0c0cf6f5a4
15 changed files with 28 additions and 98 deletions

View File

@@ -11,8 +11,8 @@ variant-11: CXXFLAGS = -std=c++11
all: $(PROGS) all: $(PROGS)
%.cc %.hh: %.yy %.cc %.hh %.html %.gv: %.yy
$(BISON) $(BISONFLAGS) -o $*.cc $< $(BISON) $(BISONFLAGS) --html --graph -o $*.cc $<
%: %.cc %: %.cc
$(CXX) $(CXXFLAGS) -o$@ $< $(CXX) $(CXXFLAGS) -o$@ $<

View File

@@ -5,12 +5,11 @@ BASE = calc++
BISON = bison BISON = bison
CXX = g++ CXX = g++
FLEX = flex FLEX = flex
XSLTPROC = xsltproc
all: $(BASE) all: $(BASE)
%.cc %.hh %.xml %.gv: %.yy %.cc %.hh %.html %.gv: %.yy
$(BISON) $(BISONFLAGS) --xml --graph=$*.gv -o $*.cc $< $(BISON) $(BISONFLAGS) --html --graph -o $*.cc $<
%.cc: %.ll %.cc: %.ll
$(FLEX) $(FLEXFLAGS) -o$@ $< $(FLEX) $(FLEXFLAGS) -o$@ $<
@@ -29,10 +28,6 @@ run: $(BASE)
@echo "Type arithmetic expressions. Quit with ctrl-d." @echo "Type arithmetic expressions. Quit with ctrl-d."
./$< - ./$< -
html: parser.html
%.html: %.xml
$(XSLTPROC) $(XSLTPROCFLAGS) -o $@ $$($(BISON) --print-datadir)/xslt/xml2xhtml.xsl $<
CLEANFILES = \ CLEANFILES = \
$(BASE) *.o \ $(BASE) *.o \
parser.hh parser.cc parser.output parser.xml parser.html parser.gv location.hh \ parser.hh parser.cc parser.output parser.xml parser.html parser.gv location.hh \

View File

@@ -3,12 +3,11 @@
BASE = c++-types BASE = c++-types
BISON = bison BISON = bison
XSLTPROC = xsltproc
all: $(BASE) all: $(BASE)
%.c %.h %.xml %.gv: %.y %.c %.h %.html %.gv: %.y
$(BISON) $(BISONFLAGS) --defines --xml --graph=$*.gv -o $*.c $< $(BISON) $(BISONFLAGS) --header --html --graph -o $*.c $<
$(BASE): $(BASE).o $(BASE): $(BASE).o
$(CC) $(CFLAGS) -o $@ $^ $(CC) $(CFLAGS) -o $@ $^
@@ -17,10 +16,6 @@ run: $(BASE)
@echo "Type C++ declarations or expressions. Quit with ctrl-d." @echo "Type C++ declarations or expressions. Quit with ctrl-d."
./$< ./$<
html: $(BASE).html
%.html: %.xml
$(XSLTPROC) $(XSLTPROCFLAGS) -o $@ $$($(BISON) --print-datadir)/xslt/xml2xhtml.xsl $<
CLEANFILES = \ CLEANFILES = \
$(BASE) *.o $(BASE).[ch] $(BASE).output $(BASE).xml $(BASE).html $(BASE).gv $(BASE) *.o $(BASE).[ch] $(BASE).output $(BASE).xml $(BASE).html $(BASE).gv

View File

@@ -3,7 +3,6 @@
BASE = bistromathic BASE = bistromathic
BISON = bison BISON = bison
XSLTPROC = xsltproc
# We need to find the headers and libs for readline (and possibly intl). # We need to find the headers and libs for readline (and possibly intl).
# You probably need to customize this for your own environment. # You probably need to customize this for your own environment.
@@ -18,8 +17,8 @@ LIBS = -lreadline -lm # In some environments, -lintl is needed.
all: $(BASE) all: $(BASE)
%.c %.h %.xml %.gv: %.y %.c %.h %.html %.xml %.gv: %.y
$(BISON) $(BISONFLAGS) --header --xml --graph=$*.gv -o $*.c $< $(BISON) $(BISONFLAGS) --header --html --graph -o $*.c $<
$(BASE): parse.o $(BASE): parse.o
$(CC) $(CPPFLAGS) $(CFLAGS) -o $@ $^ $(LDFLAGS) $(LIBS) $(CC) $(CPPFLAGS) $(CFLAGS) -o $@ $^ $(LDFLAGS) $(LIBS)
@@ -28,10 +27,6 @@ run: $(BASE)
@echo "Type bistromathic expressions. Quit with ctrl-d." @echo "Type bistromathic expressions. Quit with ctrl-d."
./$< ./$<
html: $(BASE).html
%.html: %.xml
$(XSLTPROC) $(XSLTPROCFLAGS) -o $@ $$($(BISON) --print-datadir)/xslt/xml2xhtml.xsl $<
CLEANFILES = \ CLEANFILES = \
$(BASE) *.o \ $(BASE) *.o \
parse.[ch] parse.output parse.xml parse.html parse.gv parse.[ch] parse.output parse.xml parse.html parse.gv

View File

@@ -3,12 +3,11 @@
BASE = calc BASE = calc
BISON = bison BISON = bison
XSLTPROC = xsltproc
all: $(BASE) all: $(BASE)
%.c %.h %.xml %.gv: %.y %.c %.h %.html %.xml %.gv: %.y
$(BISON) $(BISONFLAGS) --header --xml --graph=$*.gv -o $*.c $< $(BISON) $(BISONFLAGS) --header --html --graph -o $*.c $<
$(BASE): $(BASE).o $(BASE): $(BASE).o
$(CC) $(CFLAGS) -o $@ $^ $(CC) $(CFLAGS) -o $@ $^
@@ -17,10 +16,6 @@ run: $(BASE)
@echo "Type arithmetic expressions. Quit with ctrl-d." @echo "Type arithmetic expressions. Quit with ctrl-d."
./$< ./$<
html: $(BASE).html
%.html: %.xml
$(XSLTPROC) $(XSLTPROCFLAGS) -o $@ $$($(BISON) --print-datadir)/xslt/xml2xhtml.xsl $<
CLEANFILES = \ CLEANFILES = \
$(BASE) *.o $(BASE).[ch] $(BASE).output $(BASE).xml $(BASE).html $(BASE).gv $(BASE) *.o $(BASE).[ch] $(BASE).output $(BASE).xml $(BASE).html $(BASE).gv

View File

@@ -3,12 +3,11 @@
BASE = c++-types BASE = c++-types
BISON = bison BISON = bison
XSLTPROC = xsltproc
all: $(BASE) all: $(BASE)
%.c %.h %.xml %.gv: %.y %.c %.h %.xml %.gv: %.y
$(BISON) $(BISONFLAGS) --defines --xml --graph=$*.gv -o $*.c $< $(BISON) $(BISONFLAGS) --header --graph -o $*.c $<
$(BASE): $(BASE).o $(BASE): $(BASE).o
$(CC) $(CFLAGS) -o $@ $^ $(CC) $(CFLAGS) -o $@ $^
@@ -17,10 +16,6 @@ run: $(BASE)
@echo "Type C++ declarations or expressions. Quit with ctrl-d." @echo "Type C++ declarations or expressions. Quit with ctrl-d."
./$< ./$<
html: $(BASE).html
%.html: %.xml
$(XSLTPROC) $(XSLTPROCFLAGS) -o $@ $$($(BISON) --print-datadir)/xslt/xml2xhtml.xsl $<
CLEANFILES = \ CLEANFILES = \
$(BASE) *.o $(BASE).[ch] $(BASE).output $(BASE).xml $(BASE).html $(BASE).gv $(BASE) *.o $(BASE).[ch] $(BASE).output $(BASE).xml $(BASE).html $(BASE).gv

View File

@@ -4,12 +4,11 @@
BASE = lexcalc BASE = lexcalc
BISON = bison BISON = bison
FLEX = flex FLEX = flex
XSLTPROC = xsltproc
all: $(BASE) all: $(BASE)
%.c %.h %.xml %.gv: %.y %.c %.h %.html %.xml %.gv: %.y
$(BISON) $(BISONFLAGS) --header --xml --graph=$*.gv -o $*.c $< $(BISON) $(BISONFLAGS) --header --html --graph -o $*.c $<
%.c: %.l %.c: %.l
$(FLEX) $(FLEXFLAGS) -o$@ $< $(FLEX) $(FLEXFLAGS) -o$@ $<
@@ -22,10 +21,6 @@ run: $(BASE)
@echo "Type arithmetic expressions. Quit with ctrl-d." @echo "Type arithmetic expressions. Quit with ctrl-d."
./$< ./$<
html: parse.html
%.html: %.xml
$(XSLTPROC) $(XSLTPROCFLAGS) -o $@ $$($(BISON) --print-datadir)/xslt/xml2xhtml.xsl $<
CLEANFILES = \ CLEANFILES = \
$(BASE) *.o \ $(BASE) *.o \
parse.[ch] parse.output parse.xml parse.html parse.gv \ parse.[ch] parse.output parse.xml parse.html parse.gv \

View File

@@ -3,12 +3,11 @@
BASE = mfcalc BASE = mfcalc
BISON = bison BISON = bison
XSLTPROC = xsltproc
all: $(BASE) all: $(BASE)
%.c %.xml %.gv: %.y %.c %.html %.gv: %.y
$(BISON) $(BISONFLAGS) --xml --graph=$*.gv -o $*.c $< $(BISON) $(BISONFLAGS) --html --graph -o $*.c $<
%: %.c %: %.c
$(CC) $(CFLAGS) -o $@ $< $(CC) $(CFLAGS) -o $@ $<
@@ -17,9 +16,5 @@ run: $(BASE)
@echo "Type arithmetic expressions. Quit with ctrl-d." @echo "Type arithmetic expressions. Quit with ctrl-d."
./$< ./$<
html: $(BASE).html
%.html: %.xml
$(XSLTPROC) $(XSLTPROCFLAGS) -o $@ $$($(BISON) --print-datadir)/xslt/xml2xhtml.xsl $<
clean: clean:
rm -f $(BASE) $(BASE).c $(BASE).html $(BASE).xml $(BASE).gv $(BASE).output rm -f $(BASE) $(BASE).c $(BASE).html $(BASE).xml $(BASE).gv $(BASE).output

View File

@@ -3,12 +3,11 @@
BASE = calc BASE = calc
BISON = bison BISON = bison
XSLTPROC = xsltproc
all: $(BASE) all: $(BASE)
%.c %.h %.xml %.gv: %.y %.c %.h %.html %.gv: %.y
$(BISON) $(BISONFLAGS) --header --xml --graph=$*.gv -o $*.c $< $(BISON) $(BISONFLAGS) --header --html --graph -o $*.c $<
$(BASE): $(BASE).o $(BASE): $(BASE).o
$(CC) $(CFLAGS) -o $@ $^ $(CC) $(CFLAGS) -o $@ $^
@@ -17,10 +16,6 @@ run: $(BASE)
@echo "Type arithmetic expressions. Quit with ctrl-d." @echo "Type arithmetic expressions. Quit with ctrl-d."
./$< ./$<
html: $(BASE).html
%.html: %.xml
$(XSLTPROC) $(XSLTPROCFLAGS) -o $@ $$($(BISON) --print-datadir)/xslt/xml2xhtml.xsl $<
CLEANFILES = \ CLEANFILES = \
$(BASE) *.o $(BASE).[ch] $(BASE).output $(BASE).xml $(BASE).html $(BASE).gv $(BASE) *.o $(BASE).[ch] $(BASE).output $(BASE).xml $(BASE).html $(BASE).gv

View File

@@ -4,12 +4,11 @@
BASE = reccalc BASE = reccalc
BISON = bison BISON = bison
FLEX = flex FLEX = flex
XSLTPROC = xsltproc
all: $(BASE) all: $(BASE)
%.c %.h %.xml %.gv: %.y %.c %.h %.xml %.gv: %.y
$(BISON) $(BISONFLAGS) --header --xml --graph=$*.gv -o $*.c $< $(BISON) $(BISONFLAGS) --header --graph -o $*.c $<
%.c %.h: %.l %.c %.h: %.l
$(FLEX) $(FLEXFLAGS) -o$*.c --header=$*.h $< $(FLEX) $(FLEXFLAGS) -o$*.c --header=$*.h $<
@@ -23,10 +22,6 @@ run: $(BASE)
@echo "Type arithmetic expressions. Quit with ctrl-d." @echo "Type arithmetic expressions. Quit with ctrl-d."
./$< ./$<
html: parse.html
%.html: %.xml
$(XSLTPROC) $(XSLTPROCFLAGS) -o $@ $$($(BISON) --print-datadir)/xslt/xml2xhtml.xsl $<
CLEANFILES = \ CLEANFILES = \
$(BASE) *.o \ $(BASE) *.o \
parse.[ch] parse.output parse.xml parse.html parse.gv \ parse.[ch] parse.output parse.xml parse.html parse.gv \

View File

@@ -3,12 +3,11 @@
BASE = rpcalc BASE = rpcalc
BISON = bison BISON = bison
XSLTPROC = xsltproc
all: $(BASE) all: $(BASE)
%.c %.xml %.gv: %.y %.c %.html %.gv: %.y
$(BISON) $(BISONFLAGS) --xml --graph=$*.gv -o $*.c $< $(BISON) $(BISONFLAGS) --html --graph -o $*.c $<
%: %.c %: %.c
$(CC) $(CFLAGS) -o $@ $< $(CC) $(CFLAGS) -o $@ $<
@@ -17,9 +16,5 @@ run: $(BASE)
@echo "Type arithmetic expressions in Reverse Polish Notation. Quit with ctrl-d." @echo "Type arithmetic expressions in Reverse Polish Notation. Quit with ctrl-d."
./$< ./$<
html: $(BASE).html
%.html: %.xml
$(XSLTPROC) $(XSLTPROCFLAGS) -o $@ $$($(BISON) --print-datadir)/xslt/xml2xhtml.xsl $<
clean: clean:
rm -f $(BASE) $(BASE).c $(BASE).html $(BASE).xml $(BASE).gv rm -f $(BASE) $(BASE).c $(BASE).html $(BASE).xml $(BASE).gv

View File

@@ -3,12 +3,11 @@
BISON = bison BISON = bison
DC = dmd DC = dmd
XSLTPROC = xsltproc
all: calc all: calc
%.d %.xml %.gv: %.y %.d %.html %.gv: %.y
$(BISON) $(BISONFLAGS) --xml --graph=$*.gv -o $*.d $< $(BISON) $(BISONFLAGS) --html --graph -o $*.d $<
%: %.d %: %.d
$(DC) $(DCFLAGS) $< $(DC) $(DCFLAGS) $<
@@ -17,9 +16,5 @@ run: calc
@echo "Type arithmetic expressions. Quit with ctrl-d." @echo "Type arithmetic expressions. Quit with ctrl-d."
./$< ./$<
html: calc.html
%.html: %.xml
$(XSLTPROC) $(XSLTPROCFLAGS) -o $@ $$($(BISON) --print-datadir)/xslt/xml2xhtml.xsl $<
clean: clean:
rm -f calc calc.d calc.xml calc.gv calc.html *.o rm -f calc calc.d calc.xml calc.gv calc.html *.o

View File

@@ -3,12 +3,11 @@
BISON = bison BISON = bison
DC = dmd DC = dmd
XSLTPROC = xsltproc
all: calc all: calc
%.d %.xml %.gv: %.y %.d %.html %.gv: %.y
$(BISON) $(BISONFLAGS) --xml --graph=$*.gv -o $*.d $< $(BISON) $(BISONFLAGS) --html --graph -o $*.d $<
%: %.d %: %.d
$(DC) $(DCFLAGS) $< $(DC) $(DCFLAGS) $<
@@ -17,9 +16,5 @@ run: calc
@echo "Type arithmetic expressions. Quit with ctrl-d." @echo "Type arithmetic expressions. Quit with ctrl-d."
./$< ./$<
html: calc.html
%.html: %.xml
$(XSLTPROC) $(XSLTPROCFLAGS) -o $@ $$($(BISON) --print-datadir)/xslt/xml2xhtml.xsl $<
clean: clean:
rm -f calc calc.d calc.xml calc.gv calc.html *.o rm -f calc calc.d calc.xml calc.gv calc.html *.o

View File

@@ -4,12 +4,11 @@
BISON = bison BISON = bison
JAVAC = javac JAVAC = javac
JAVA = java JAVA = java
XSLTPROC = xsltproc
all: Calc.class all: Calc.class
%.java %.xml %.gv: %.y %.java %.html %.gv: %.y
$(BISON) $(BISONFLAGS) --xml --graph=$*.gv -o $*.java $< $(BISON) $(BISONFLAGS) --html --graph -o $*.java $<
%.class: %.java %.class: %.java
$(JAVAC) $(JAVACFLAGS) $< $(JAVAC) $(JAVACFLAGS) $<
@@ -18,9 +17,5 @@ run: Calc.class
@echo "Type arithmetic expressions. Quit with ctrl-d." @echo "Type arithmetic expressions. Quit with ctrl-d."
$(JAVA) $(JAVAFLAGS) Calc $(JAVA) $(JAVAFLAGS) Calc
html: Calc.html
%.html: %.xml
$(XSLTPROC) $(XSLTPROCFLAGS) -o $@ $$($(BISON) --print-datadir)/xslt/xml2xhtml.xsl $<
clean: clean:
rm -f *.class Calc.java Calc.html Calc.xml Calc.gv rm -f *.class Calc.java Calc.html Calc.xml Calc.gv

View File

@@ -4,12 +4,11 @@
BISON = bison BISON = bison
JAVAC = javac JAVAC = javac
JAVA = java JAVA = java
XSLTPROC = xsltproc
all: Calc.class all: Calc.class
%.java %.xml %.gv: %.y %.java %.html %.gv: %.y
$(BISON) $(BISONFLAGS) --xml --graph=$*.gv -o $*.java $< $(BISON) $(BISONFLAGS) --html --graph -o $*.java $<
%.class: %.java %.class: %.java
$(JAVAC) $(JAVACFLAGS) $< $(JAVAC) $(JAVACFLAGS) $<
@@ -18,9 +17,5 @@ run: Calc.class
@echo "Type arithmetic expressions. Quit with ctrl-d." @echo "Type arithmetic expressions. Quit with ctrl-d."
$(JAVA) $(JAVAFLAGS) Calc $(JAVA) $(JAVAFLAGS) Calc
html: Calc.html
%.html: %.xml
$(XSLTPROC) $(XSLTPROCFLAGS) -o $@ $$($(BISON) --print-datadir)/xslt/xml2xhtml.xsl $<
clean: clean:
rm -f *.class Calc.java Calc.html Calc.xml Calc.gv rm -f *.class Calc.java Calc.html Calc.xml Calc.gv