## 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/Kunle Odutola, 2004.

## do not change this value 
subdir=examples/csharp/cpp

## 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 = :

## 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
compile : $(test1_exe)
test :: test1


## My *.g files 
g_FILES  = \
 $(_srcdir)/cpp.g \
 $(eol)

## Java files generated by *.g
g_src_FILES = \
	$(thisdir)/cppLexer.cs \
  $(thisdir)/cppLexerTokenTypes.cs \
  $(eol)

## Text files generated by *.g
g_txt_FILES = \
  $(thisdir)/cppLexerTokenTypes.txt \
	$(eol)

## All generated files by *.g
g_gen_FILES = \
	$(g_src_FILES) \
	$(g_txt_FILES) \
	$(eol)

## Dependencies of g_src_FILES
g_src_DEPS = \
	$(g_FILES) \
	@ANTLR_JAR@ \
	$(buildtree)/scripts/antlr.sh \
	$(eol)

# All source files for test1
test1_exe_FILES = \
	$(g_src_FILES) \
	$(eol)

test1_exe = \
	test1.exe \
	$(eol)

test1_exe_DEPS = \
	$(test1_exe_FILES) \
	@ANTLR_NET@ \
	$(buildtree)/scripts/csc.sh \
	$(eol)

## Dependencies of test 1
test1_DEPS = \
	@antlr_net@ \
	test1.exe \
	$(eol)

## Test 1
test1_CMD = \
	@ $(CIL) ./test1.exe < $(_srcdir)/cpp.in \
	$(eol)


## we need a local copy of ANTLR_NET in this directory to be
## able to execute tests!
@antlr_net@ : @ANTLR_NET@
	@CP@ $< $@

## *.g -> *.cs
$(g_src_FILES) : $(g_src_DEPS)
	@ @RMF@ $(g_src_FILES)
	@ @ANTLR_COMPILE_CMD@ $(g_FILES)
	@ $(dos2unix) $(g_src_FILES)

## How to create test1
$(test1_exe) : $(test1_exe_DEPS)
	@ -@RMF@ $@
	@@CSHARP_COMPILE_CMD@  $@ $(test1_exe_FILES)

## Tests
test1 : $(test1_DEPS)
	@ $(test1_CMD)

### cleanup astsupport
clean ::
	@@ECHO@ cleaning $(subdir) ...
	@ -@RMF@ .compile.st *.class $(g_gen_FILES) @antlr_net@
	@ -@RMF@ *.pyc *.tmp *TokenTypes.txt *TokenTypes *.exe



### 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
.PHONY: test2