CC        = cl
LD        = link
DEBUG     = -Zi

# Compile try/except
EXCEPT    = -EHsc

CFLAGS    = $(EXCEPT) -DWIN32 -Tp
OBJ       = obj
EXE       = .exe
INCLUDE   = -I "e:\antlr\cpp" -I "d:\Program Files\Microsoft Visual Studio\Vc98\include"

LD_DEBUG  = /debug
ANTLR_LIB = /defaultlib:"e:\antlr\cpp\antlr.lib"
LINK_FLAGS = $(LD_DEBUG) $(ANTLR_LIB)

FLAGS = $(INCLUDE) $(DEBUG) $(CFLAGS) 

#
# To customize, fill in EXENAME, GRAMMAR, PARSER and LEXER
#
EXENAME = tc
GRAMMAR = tiny
PARSER = MyTinyC
LEXER  = MyTinyC

PARSE_OBJ = $(LEXER)Lexer.$(OBJ) $(PARSER)Parser.$(OBJ) print_tree.$(OBJ) main.$(OBJ)

all: $(EXENAME)$(EXE)

clean:
	rm -f $(PARSE_OBJ) tc$(EXE)

$(EXENAME)$(EXE): $(PARSE_OBJ)
	$(LD) $(LINK_FLAGS) /out:$@ $(PARSE_OBJ) 

$(LEXER)Lexer.cpp $(LEXER)Lexer.hpp $(PARSER)Parser.cpp $(PARSER)Parser.hpp: tiny.g
	jview antlr.Tool $(GRAMMAR).g

$(LEXER)Lexer.$(OBJ): $(LEXER)Lexer.cpp $(LEXER)Lexer.hpp
	$(CC) -c $(FLAGS) $(LEXER)Lexer.cpp

$(PARSER)Parser.$(OBJ): $(PARSER)Parser.cpp $(PARSER)Parser.hpp
	$(CC) -c $(FLAGS) $(PARSER)Parser.cpp

print_tree.$(OBJ): print_tree.cpp print_tree.hpp
	$(CC) -c $(FLAGS) print_tree.cpp

main.$(OBJ): main.cpp $(PARSER)Parser.hpp $(LEXER)Lexer.hpp
	$(CC) -c $(FLAGS) main.cpp

back to ANTLR build page