[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
java, d: add a Makefile for the example
From: |
Akim Demaille |
Subject: |
java, d: add a Makefile for the example |
Date: |
Thu, 6 Dec 2018 05:19:35 +0100 |
commit 9a5c12f1603fb383019fd58eb2239047f1aa3577
Author: Akim Demaille <address@hidden>
Date: Wed Dec 5 09:01:10 2018 +0100
java, d: add a Makefile for the example
* examples/java/Makefile, examples/d/Makefile: New.
diff --git a/examples/README b/examples/README
index 87f73544..e9b505ca 100644
--- a/examples/README
+++ b/examples/README
@@ -34,6 +34,12 @@ Extracted from the documentation: "A Complete C++ Example".
https://www.gnu.org/software/bison/manual/html_node/A-Complete-C_002b_002b-Example.html
+* Examples in D
+
+** d/calc.y
+The usual calculator.
+
+
* Examples in Java
** java/Calc.y
diff --git a/examples/d/Makefile b/examples/d/Makefile
new file mode 100644
index 00000000..1c41b6ce
--- /dev/null
+++ b/examples/d/Makefile
@@ -0,0 +1,25 @@
+# This Makefile is designed to be simple and readable. It does not
+# aim at portability. It requires GNU Make.
+
+BISON = bison
+DC = dmd
+XSLTPROC = xsltproc
+
+all: calc
+
+%.d %.xml %.gv: %.y
+ $(BISON) $(BISONFLAGS) --xml --graph=$*.gv -o $*.d $<
+
+%: %.d
+ $(DC) $(DCFLAGS) $<
+
+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/local.mk b/examples/d/local.mk
index d5d9ac9d..92fe116e 100644
--- a/examples/d/local.mk
+++ b/examples/d/local.mk
@@ -31,5 +31,5 @@ endif
%D%/calc: %D%/calc.d
$(AM_V_GEN) $(DC) $(DCFLAGS) -of$@ $<
-dist_d_DATA = %D%/calc.y
+dist_d_DATA = %D%/calc.y %D%/Makefile
CLEANFILES += %D%/calc %D%/Calc.d
diff --git a/examples/java/Makefile b/examples/java/Makefile
new file mode 100644
index 00000000..de9a54a6
--- /dev/null
+++ b/examples/java/Makefile
@@ -0,0 +1,26 @@
+# This Makefile is designed to be simple and readable. It does not
+# aim at portability. It requires GNU Make.
+
+BISON = bison
+JAVAC = javac
+JAVA = java
+XSLTPROC = xsltproc
+
+all: Calc.class
+
+%.java %.xml %.gv: %.y
+ $(BISON) $(BISONFLAGS) --xml --graph=$*.gv -o $*.java $<
+
+%.class: %.java
+ $(JAVAC) $(JAVACFLAGS) $<
+
+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/local.mk b/examples/java/local.mk
index c76e1623..f464f1f7 100644
--- a/examples/java/local.mk
+++ b/examples/java/local.mk
@@ -31,5 +31,5 @@ endif
%D%/Calc.class: %D%/Calc.java
$(AM_V_GEN) $(SHELL) $(top_builddir)/javacomp.sh $<
-dist_java_DATA = %D%/Calc.y
+dist_java_DATA = %D%/Calc.y %D%/Makefile
CLEANFILES += %D%/Calc.class %D%/Calc.java
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- java, d: add a Makefile for the example,
Akim Demaille <=