bison-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

examples: modernize the example Makefiles


From: Akim Demaille
Subject: examples: modernize the example Makefiles
Date: Wed, 4 Aug 2021 10:08:44 +0200

commit 0c0cf6f5a4ede4becc761d5e8ab781ee5dc054fa
Author: Akim Demaille <akim.demaille@gmail.com>
Date:   Mon Sep 7 06:34:00 2020 +0200

    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.

diff --git a/examples/c++/Makefile b/examples/c++/Makefile
index 47e1fb4e0..4742fa95c 100644
--- a/examples/c++/Makefile
+++ b/examples/c++/Makefile
@@ -11,8 +11,8 @@ variant-11: CXXFLAGS = -std=c++11
 
 all: $(PROGS)
 
-%.cc %.hh: %.yy
-       $(BISON) $(BISONFLAGS) -o $*.cc $<
+%.cc %.hh %.html %.gv: %.yy
+       $(BISON) $(BISONFLAGS) --html --graph -o $*.cc $<
 
 %: %.cc
        $(CXX) $(CXXFLAGS) -o$@ $<
diff --git a/examples/c++/calc++/Makefile b/examples/c++/calc++/Makefile
index a2d83d7c6..bf57a3639 100644
--- a/examples/c++/calc++/Makefile
+++ b/examples/c++/calc++/Makefile
@@ -5,12 +5,11 @@ 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 %.hh %.html %.gv: %.yy
+       $(BISON) $(BISONFLAGS) --html --graph -o $*.cc $<
 
 %.cc: %.ll
        $(FLEX) $(FLEXFLAGS) -o$@ $<
@@ -29,10 +28,6 @@ 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       \
diff --git a/examples/c++/glr/Makefile b/examples/c++/glr/Makefile
index a56edb1f4..b0b25bc8e 100644
--- a/examples/c++/glr/Makefile
+++ b/examples/c++/glr/Makefile
@@ -3,12 +3,11 @@
 
 BASE = c++-types
 BISON = bison
-XSLTPROC = xsltproc
 
 all: $(BASE)
 
-%.c %.h %.xml %.gv: %.y
-       $(BISON) $(BISONFLAGS) --defines --xml --graph=$*.gv -o $*.c $<
+%.c %.h %.html %.gv: %.y
+       $(BISON) $(BISONFLAGS) --header --html --graph -o $*.c $<
 
 $(BASE): $(BASE).o
        $(CC) $(CFLAGS) -o $@ $^
@@ -17,10 +16,6 @@ run: $(BASE)
        @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 =                                                                   
\
   $(BASE) *.o $(BASE).[ch] $(BASE).output $(BASE).xml $(BASE).html $(BASE).gv
 
diff --git a/examples/c/bistromathic/Makefile b/examples/c/bistromathic/Makefile
index ae6630e67..0e61ce661 100644
--- a/examples/c/bistromathic/Makefile
+++ b/examples/c/bistromathic/Makefile
@@ -3,7 +3,6 @@
 
 BASE = bistromathic
 BISON = bison
-XSLTPROC = xsltproc
 
 # We need to find the headers and libs for readline (and possibly intl).
 # 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)
 
-%.c %.h %.xml %.gv: %.y
-       $(BISON) $(BISONFLAGS) --header --xml --graph=$*.gv -o $*.c $<
+%.c %.h %.html %.xml %.gv: %.y
+       $(BISON) $(BISONFLAGS) --header --html --graph -o $*.c $<
 
 $(BASE): parse.o
        $(CC) $(CPPFLAGS) $(CFLAGS) -o $@ $^ $(LDFLAGS) $(LIBS)
@@ -28,10 +27,6 @@ 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
diff --git a/examples/c/calc/Makefile b/examples/c/calc/Makefile
index 3a32d012f..cdf2ae326 100644
--- a/examples/c/calc/Makefile
+++ b/examples/c/calc/Makefile
@@ -3,12 +3,11 @@
 
 BASE = calc
 BISON = bison
-XSLTPROC = xsltproc
 
 all: $(BASE)
 
-%.c %.h %.xml %.gv: %.y
-       $(BISON) $(BISONFLAGS) --header --xml --graph=$*.gv -o $*.c $<
+%.c %.h %.html %.xml %.gv: %.y
+       $(BISON) $(BISONFLAGS) --header --html --graph -o $*.c $<
 
 $(BASE): $(BASE).o
        $(CC) $(CFLAGS) -o $@ $^
@@ -17,10 +16,6 @@ run: $(BASE)
        @echo "Type arithmetic expressions.  Quit with ctrl-d."
        ./$<
 
-html: $(BASE).html
-%.html: %.xml
-       $(XSLTPROC) $(XSLTPROCFLAGS) -o $@ $$($(BISON) 
--print-datadir)/xslt/xml2xhtml.xsl $<
-
 CLEANFILES =                                                                   
\
   $(BASE) *.o $(BASE).[ch] $(BASE).output $(BASE).xml $(BASE).html $(BASE).gv
 
diff --git a/examples/c/glr/Makefile b/examples/c/glr/Makefile
index a56edb1f4..4bf7149eb 100644
--- a/examples/c/glr/Makefile
+++ b/examples/c/glr/Makefile
@@ -3,12 +3,11 @@
 
 BASE = c++-types
 BISON = bison
-XSLTPROC = xsltproc
 
 all: $(BASE)
 
 %.c %.h %.xml %.gv: %.y
-       $(BISON) $(BISONFLAGS) --defines --xml --graph=$*.gv -o $*.c $<
+       $(BISON) $(BISONFLAGS) --header --graph -o $*.c $<
 
 $(BASE): $(BASE).o
        $(CC) $(CFLAGS) -o $@ $^
@@ -17,10 +16,6 @@ run: $(BASE)
        @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 =                                                                   
\
   $(BASE) *.o $(BASE).[ch] $(BASE).output $(BASE).xml $(BASE).html $(BASE).gv
 
diff --git a/examples/c/lexcalc/Makefile b/examples/c/lexcalc/Makefile
index 88badb7b5..33069256b 100644
--- a/examples/c/lexcalc/Makefile
+++ b/examples/c/lexcalc/Makefile
@@ -4,12 +4,11 @@
 BASE = lexcalc
 BISON = bison
 FLEX = flex
-XSLTPROC = xsltproc
 
 all: $(BASE)
 
-%.c %.h %.xml %.gv: %.y
-       $(BISON) $(BISONFLAGS) --header --xml --graph=$*.gv -o $*.c $<
+%.c %.h %.html %.xml %.gv: %.y
+       $(BISON) $(BISONFLAGS) --header --html --graph -o $*.c $<
 
 %.c: %.l
        $(FLEX) $(FLEXFLAGS) -o$@ $<
@@ -22,10 +21,6 @@ run: $(BASE)
        @echo "Type arithmetic expressions.  Quit with ctrl-d."
        ./$<
 
-html: parse.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        \
diff --git a/examples/c/mfcalc/Makefile b/examples/c/mfcalc/Makefile
index b9518089a..4014dd484 100644
--- a/examples/c/mfcalc/Makefile
+++ b/examples/c/mfcalc/Makefile
@@ -3,12 +3,11 @@
 
 BASE = mfcalc
 BISON = bison
-XSLTPROC = xsltproc
 
 all: $(BASE)
 
-%.c %.xml %.gv: %.y
-       $(BISON) $(BISONFLAGS) --xml --graph=$*.gv -o $*.c $<
+%.c %.html %.gv: %.y
+       $(BISON) $(BISONFLAGS) --html --graph -o $*.c $<
 
 %: %.c
        $(CC) $(CFLAGS) -o $@ $<
@@ -17,9 +16,5 @@ run: $(BASE)
        @echo "Type arithmetic expressions.  Quit with ctrl-d."
        ./$<
 
-html: $(BASE).html
-%.html: %.xml
-       $(XSLTPROC) $(XSLTPROCFLAGS) -o $@ $$($(BISON) 
--print-datadir)/xslt/xml2xhtml.xsl $<
-
 clean:
        rm -f $(BASE) $(BASE).c $(BASE).html $(BASE).xml $(BASE).gv 
$(BASE).output
diff --git a/examples/c/pushcalc/Makefile b/examples/c/pushcalc/Makefile
index 3a32d012f..835239355 100644
--- a/examples/c/pushcalc/Makefile
+++ b/examples/c/pushcalc/Makefile
@@ -3,12 +3,11 @@
 
 BASE = calc
 BISON = bison
-XSLTPROC = xsltproc
 
 all: $(BASE)
 
-%.c %.h %.xml %.gv: %.y
-       $(BISON) $(BISONFLAGS) --header --xml --graph=$*.gv -o $*.c $<
+%.c %.h %.html %.gv: %.y
+       $(BISON) $(BISONFLAGS) --header --html --graph -o $*.c $<
 
 $(BASE): $(BASE).o
        $(CC) $(CFLAGS) -o $@ $^
@@ -17,10 +16,6 @@ run: $(BASE)
        @echo "Type arithmetic expressions.  Quit with ctrl-d."
        ./$<
 
-html: $(BASE).html
-%.html: %.xml
-       $(XSLTPROC) $(XSLTPROCFLAGS) -o $@ $$($(BISON) 
--print-datadir)/xslt/xml2xhtml.xsl $<
-
 CLEANFILES =                                                                   
\
   $(BASE) *.o $(BASE).[ch] $(BASE).output $(BASE).xml $(BASE).html $(BASE).gv
 
diff --git a/examples/c/reccalc/Makefile b/examples/c/reccalc/Makefile
index ff3380038..69fc0c081 100644
--- a/examples/c/reccalc/Makefile
+++ b/examples/c/reccalc/Makefile
@@ -4,12 +4,11 @@
 BASE = reccalc
 BISON = bison
 FLEX = flex
-XSLTPROC = xsltproc
 
 all: $(BASE)
 
 %.c %.h %.xml %.gv: %.y
-       $(BISON) $(BISONFLAGS) --header --xml --graph=$*.gv -o $*.c $<
+       $(BISON) $(BISONFLAGS) --header --graph -o $*.c $<
 
 %.c %.h: %.l
        $(FLEX) $(FLEXFLAGS) -o$*.c --header=$*.h $<
@@ -23,10 +22,6 @@ run: $(BASE)
        @echo "Type arithmetic expressions.  Quit with ctrl-d."
        ./$<
 
-html: parse.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        \
diff --git a/examples/c/rpcalc/Makefile b/examples/c/rpcalc/Makefile
index 624f247bf..23ea410cb 100644
--- a/examples/c/rpcalc/Makefile
+++ b/examples/c/rpcalc/Makefile
@@ -3,12 +3,11 @@
 
 BASE = rpcalc
 BISON = bison
-XSLTPROC = xsltproc
 
 all: $(BASE)
 
-%.c %.xml %.gv: %.y
-       $(BISON) $(BISONFLAGS) --xml --graph=$*.gv -o $*.c $<
+%.c %.html %.gv: %.y
+       $(BISON) $(BISONFLAGS) --html --graph -o $*.c $<
 
 %: %.c
        $(CC) $(CFLAGS) -o $@ $<
@@ -17,9 +16,5 @@ run: $(BASE)
        @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:
        rm -f $(BASE) $(BASE).c $(BASE).html $(BASE).xml $(BASE).gv
diff --git a/examples/d/calc/Makefile b/examples/d/calc/Makefile
index 45ae62892..e95960b36 100644
--- a/examples/d/calc/Makefile
+++ b/examples/d/calc/Makefile
@@ -3,12 +3,11 @@
 
 BISON = bison
 DC = dmd
-XSLTPROC = xsltproc
 
 all: calc
 
-%.d %.xml %.gv: %.y
-       $(BISON) $(BISONFLAGS) --xml --graph=$*.gv -o $*.d $<
+%.d %.html %.gv: %.y
+       $(BISON) $(BISONFLAGS) --html --graph -o $*.d $<
 
 %: %.d
        $(DC) $(DCFLAGS) $<
@@ -17,9 +16,5 @@ run: calc
        @echo "Type arithmetic expressions.  Quit with ctrl-d."
        ./$<
 
-html: calc.html
-%.html: %.xml
-       $(XSLTPROC) $(XSLTPROCFLAGS) -o $@ $$($(BISON) 
--print-datadir)/xslt/xml2xhtml.xsl $<
-
 clean:
        rm -f calc calc.d calc.xml calc.gv calc.html *.o
diff --git a/examples/d/simple/Makefile b/examples/d/simple/Makefile
index 45ae62892..e95960b36 100644
--- a/examples/d/simple/Makefile
+++ b/examples/d/simple/Makefile
@@ -3,12 +3,11 @@
 
 BISON = bison
 DC = dmd
-XSLTPROC = xsltproc
 
 all: calc
 
-%.d %.xml %.gv: %.y
-       $(BISON) $(BISONFLAGS) --xml --graph=$*.gv -o $*.d $<
+%.d %.html %.gv: %.y
+       $(BISON) $(BISONFLAGS) --html --graph -o $*.d $<
 
 %: %.d
        $(DC) $(DCFLAGS) $<
@@ -17,9 +16,5 @@ run: calc
        @echo "Type arithmetic expressions.  Quit with ctrl-d."
        ./$<
 
-html: calc.html
-%.html: %.xml
-       $(XSLTPROC) $(XSLTPROCFLAGS) -o $@ $$($(BISON) 
--print-datadir)/xslt/xml2xhtml.xsl $<
-
 clean:
        rm -f calc calc.d calc.xml calc.gv calc.html *.o
diff --git a/examples/java/calc/Makefile b/examples/java/calc/Makefile
index 5a165205b..9c7bf1ef9 100644
--- a/examples/java/calc/Makefile
+++ b/examples/java/calc/Makefile
@@ -4,12 +4,11 @@
 BISON = bison
 JAVAC = javac
 JAVA = java
-XSLTPROC = xsltproc
 
 all: Calc.class
 
-%.java %.xml %.gv: %.y
-       $(BISON) $(BISONFLAGS) --xml --graph=$*.gv -o $*.java $<
+%.java %.html %.gv: %.y
+       $(BISON) $(BISONFLAGS) --html --graph -o $*.java $<
 
 %.class: %.java
        $(JAVAC) $(JAVACFLAGS) $<
@@ -18,9 +17,5 @@ run: Calc.class
        @echo "Type arithmetic expressions.  Quit with ctrl-d."
        $(JAVA) $(JAVAFLAGS) Calc
 
-html: Calc.html
-%.html: %.xml
-       $(XSLTPROC) $(XSLTPROCFLAGS) -o $@ $$($(BISON) 
--print-datadir)/xslt/xml2xhtml.xsl $<
-
 clean:
        rm -f *.class Calc.java Calc.html Calc.xml Calc.gv
diff --git a/examples/java/simple/Makefile b/examples/java/simple/Makefile
index 5a165205b..9c7bf1ef9 100644
--- a/examples/java/simple/Makefile
+++ b/examples/java/simple/Makefile
@@ -4,12 +4,11 @@
 BISON = bison
 JAVAC = javac
 JAVA = java
-XSLTPROC = xsltproc
 
 all: Calc.class
 
-%.java %.xml %.gv: %.y
-       $(BISON) $(BISONFLAGS) --xml --graph=$*.gv -o $*.java $<
+%.java %.html %.gv: %.y
+       $(BISON) $(BISONFLAGS) --html --graph -o $*.java $<
 
 %.class: %.java
        $(JAVAC) $(JAVACFLAGS) $<
@@ -18,9 +17,5 @@ run: Calc.class
        @echo "Type arithmetic expressions.  Quit with ctrl-d."
        $(JAVA) $(JAVAFLAGS) Calc
 
-html: Calc.html
-%.html: %.xml
-       $(XSLTPROC) $(XSLTPROCFLAGS) -o $@ $$($(BISON) 
--print-datadir)/xslt/xml2xhtml.xsl $<
-
 clean:
        rm -f *.class Calc.java Calc.html Calc.xml Calc.gv




reply via email to

[Prev in Thread] Current Thread [Next in Thread]