## This file is part of ANTLR (http://www.antlr.org).  Have a
## look into LICENSE.txt for  license  details. This file has 
## been written by (C) Wolfgang Haefelinger, 2004.

## do not change this value 
subdir=examples/python/tinyc

## get  configured  (standard) variables - checkout or modify
## scripts/config.vars[.in] for details.
@stdvars@

### how to get rid of damned dos line ending style and -- al-
### most equally worse -- stupid tab character.
### dos2unix  = perl -p -i.tmp -e 's,\r,,g;s,\t, ,g' 
dos2unix = :

### when running python we invoke python like ..
python    = /bin/sh @abs_this_builddir@/scripts/python.sh

## get configured rules
@stdmake@

## By default we compile class files so we are ready to carry
## out a test. Note that deps have been setup in such a way
## that you can do a 'make compile' whithout having made 
## antlr.jar before. 
this : compile
all  :: compile


g_FILES  = \
 $(_srcdir)/tinyc_l.g \
 $(_srcdir)/tinyc_p.g \
 $(eol)

g_py_FILES = \
 tinyc_l.py tinyc_p.py \
 $(eol)

compile : $(g_py_FILES)


test :: test1

test1_deps = \
	$(g_py_FILES) \
	$(buildtree)/scripts/python.sh \
	$(eol)

test1_cmd = \
	$(python) tinyc_l.py < $(_srcdir)/tinyc.in ; \
	$(python) tinyc_p.py < $(_srcdir)/tinyc.in   \
	$(eol)

test1 : $(test1_deps)
	@ $(test1_cmd)

$(g_py_FILES) : $(g_FILES)
	@ @RMF@ $(g_py_FILES)
	@ @ANTLR_COMPILE_CMD@ $(g_FILES)
	@ $(dos2unix) $(g_py_FILES)

$(g_py_FILES) : @ANTLR_JAR@
$(g_py_FILES) : $(buildtree)/scripts/antlr.sh

### cleanup tinyc
clean ::
	@@ECHO@ cleaning tinyc ...
	@ -@RMF@ $(g_py_FILES)
	@ -@RMF@ *.pyc *.tmp *TokenTypes.txt *TokenTypes



### get configured dependencies - for example, just list
### autoconf variable ANTLR_JAR as reference and it will
### be  done  automatically  as stddeps contains appropr.
### rule. For details, checkout scripts/config.vars[.in] 
@stddeps@

.PHONY: compile
.PHONY: test1
