[1] | 1 | ## This file is part of ANTLR (http://www.antlr.org). Have a |
---|
| 2 | ## look into LICENSE.txt for license details. This file has |
---|
| 3 | ## been written by (C) Wolfgang Haefelinger, 2004. |
---|
| 4 | |
---|
| 5 | ## do not change this value |
---|
| 6 | subdir=examples/java/preserveWhiteSpace |
---|
| 7 | |
---|
| 8 | ## get configured (standard) variables - checkout or modify |
---|
| 9 | ## scripts/config.vars[.in] for details. |
---|
| 10 | @stdvars@ |
---|
| 11 | |
---|
| 12 | ### how to get rid of damned dos line ending style and -- al- |
---|
| 13 | ### most equally worse -- stupid tab character. |
---|
| 14 | ### dos2unix = perl -p -i.tmp -e 's,\r,,g;s,\t, ,g' |
---|
| 15 | dos2unix = : |
---|
| 16 | |
---|
| 17 | ## get configured rules |
---|
| 18 | @stdmake@ |
---|
| 19 | |
---|
| 20 | ## By default we compile class files so we are ready to carry |
---|
| 21 | ## out a test. Note that deps have been setup in such a way |
---|
| 22 | ## that you can do a 'make compile' whithout having made |
---|
| 23 | ## antlr.jar before. |
---|
| 24 | this : compile |
---|
| 25 | all :: compile |
---|
| 26 | compile : .java |
---|
| 27 | test :: test1 |
---|
| 28 | |
---|
| 29 | |
---|
| 30 | ## My *.g files |
---|
| 31 | g_FILES = \ |
---|
| 32 | $(_srcdir)/instr.g \ |
---|
| 33 | $(eol) |
---|
| 34 | |
---|
| 35 | ## Java files generated by *.g |
---|
| 36 | g_src_FILES = \ |
---|
| 37 | $(thisdir)/InstrLexer.java \ |
---|
| 38 | $(thisdir)/InstrParser.java \ |
---|
| 39 | $(thisdir)/InstrParserTokenTypes.java \ |
---|
| 40 | $(thisdir)/InstrTreeWalker.java \ |
---|
| 41 | $(eol) |
---|
| 42 | |
---|
| 43 | ## Text files generated by *.g |
---|
| 44 | g_txt_FILES = \ |
---|
| 45 | $(thisdir)/IDLTokenTypes.txt \ |
---|
| 46 | $(eol) |
---|
| 47 | |
---|
| 48 | ## All generated files by *.g |
---|
| 49 | g_gen_FILES = \ |
---|
| 50 | $(g_src_FILES) \ |
---|
| 51 | $(g_txt_FILES) \ |
---|
| 52 | $(eol) |
---|
| 53 | |
---|
| 54 | # All Java files |
---|
| 55 | j_src_FILES = \ |
---|
| 56 | $(g_src_FILES) \ |
---|
| 57 | $(_srcdir)/InstrMain.java \ |
---|
| 58 | $(eol) |
---|
| 59 | |
---|
| 60 | ## Dependencies of test 1 |
---|
| 61 | test1_deps = \ |
---|
| 62 | .java \ |
---|
| 63 | $(buildtree)/scripts/javac.sh \ |
---|
| 64 | $(eol) |
---|
| 65 | test2_deps = \ |
---|
| 66 | .java \ |
---|
| 67 | $(buildtree)/scripts/javac.sh \ |
---|
| 68 | $(eol) |
---|
| 69 | test3_deps = \ |
---|
| 70 | .java \ |
---|
| 71 | $(buildtree)/scripts/javac.sh \ |
---|
| 72 | $(eol) |
---|
| 73 | |
---|
| 74 | ## Test 1 |
---|
| 75 | test1_cmd = \ |
---|
| 76 | @ @JAVA_CMD@ InstrMain < $(_srcdir)/test.in \ |
---|
| 77 | $(eol) |
---|
| 78 | ## Test 2 |
---|
| 79 | test2_cmd = \ |
---|
| 80 | @ @JAVA_CMD@ tinybasic.Main $(_srcdir)/try1.bas \ |
---|
| 81 | $(eol) |
---|
| 82 | ## Test 3 |
---|
| 83 | test3_cmd = \ |
---|
| 84 | @ @JAVA_CMD@ tinybasic.Main $(_srcdir)/try2.bas \ |
---|
| 85 | $(eol) |
---|
| 86 | |
---|
| 87 | ## Tests |
---|
| 88 | test1 : $(test1_deps) |
---|
| 89 | @ $(test1_cmd) |
---|
| 90 | |
---|
| 91 | test2 : $(test2_deps) |
---|
| 92 | @ $(test2_cmd) |
---|
| 93 | |
---|
| 94 | test3 : $(test3_deps) |
---|
| 95 | @ $(test3_cmd) |
---|
| 96 | |
---|
| 97 | |
---|
| 98 | ## How to generated *.java .. |
---|
| 99 | $(g_src_FILES) : $(g_FILES) |
---|
| 100 | @ @RMF@ $(g_src_FILES) |
---|
| 101 | @ @ANTLR_COMPILE_CMD@ $(g_FILES) |
---|
| 102 | @ $(dos2unix) $(g_src_FILES) |
---|
| 103 | |
---|
| 104 | $(g_src_FILES) : @ANTLR_JAR@ |
---|
| 105 | $(g_src_FILES) : $(buildtree)/scripts/antlr.sh |
---|
| 106 | |
---|
| 107 | ## How to generate class files |
---|
| 108 | .java : $(j_src_FILES) |
---|
| 109 | @-@RMF@ $@ |
---|
| 110 | @@JAVA_COMPILE_CMD@ $(j_src_FILES) && @ECHO@ > $@ |
---|
| 111 | |
---|
| 112 | .java : $(buildtree)/scripts/javac.sh |
---|
| 113 | |
---|
| 114 | ### cleanup astsupport |
---|
| 115 | clean :: |
---|
| 116 | @@ECHO@ cleaning $(subdir) ... |
---|
| 117 | @ -@RMF@ .java *.class $(g_gen_FILES) tinybasic |
---|
| 118 | @ -@RMF@ *.pyc *.tmp *TokenTypes.txt *TokenTypes |
---|
| 119 | |
---|
| 120 | |
---|
| 121 | |
---|
| 122 | ### get configured dependencies - for example, just list |
---|
| 123 | ### autoconf variable ANTLR_JAR as reference and it will |
---|
| 124 | ### be done automatically as stddeps contains appropr. |
---|
| 125 | ### rule. For details, checkout scripts/config.vars[.in] |
---|
| 126 | @stddeps@ |
---|
| 127 | |
---|
| 128 | .PHONY: compile |
---|
| 129 | .PHONY: test1 |
---|