• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1.PRECIOUS=.o
2
3ANTLRGRAMMARS ?= $(wildcard t0[01]*.g)
4HEADERS = $(wildcard *.hpp) $(wildcard *.inl)
5RUNTIME_HEADERS = $(wildcard ../include/*.hpp) $(wildcard ../include/*.inl)
6SOURCES = $(wildcard *.cpp)
7POBJS = $(PSOURCES:.cpp=.o)
8TOKENS = $(ANTLRGRAMMARS:.g=.tokens)
9
10GRAMMAROPTIONS= #-report -Xconversiontimeout 1500000 -Xmultithreaded -Xwatchconversion
11ANTLR = ../../../antlr-complete/target/antlr-complete-3.5.2-SNAPSHOT.jar
12STGS  = $(wildcard ../../../tool/src/main/resources/org/antlr/codegen/templates/Cpp/*.stg)
13
14.SUFFIXES:
15
16INCLUDES= -I. -I../include/
17
18CFLAGS=-ggdb3 -O0 -fno-inline -Wall -Wno-unused-variable
19#CFLAGS=-ggdb3 -O3
20
21TOBJS= utils.o
22
23all: $(ANTLR) $(TOKENS) t001 t002 t003 t004 t005 t006 t006 t007 t008 t009 t010 t011 t012
24
25# For devel only. This will replace .stg files in the tool in a fast way
26#
27$(ANTLR): $(STGS)
28	jar uvf $(ANTLR) -C ../../../tool/src/main/resources \
29	org/antlr/codegen/templates/Cpp/Cpp.stg
30
31t001:	t001.cpp t001lexer.tokens UserTestTraits.hpp Makefile $(ANTLR) $(RUNTIME_HEADERS)
32	g++ $(CFLAGS) -DUSESTL $(INCLUDES) $< $@?*.cpp -o $@
33
34t002:	t002.cpp t002lexer.tokens UserTestTraits.hpp Makefile $(ANTLR) $(RUNTIME_HEADERS)
35	g++ $(CFLAGS) -DUSESTL $(INCLUDES) $< $@?*.cpp -o $@
36
37t003:	t003.cpp t003lexer.tokens UserTestTraits.hpp Makefile $(ANTLR) $(RUNTIME_HEADERS)
38	g++ $(CFLAGS) -DUSESTL $(INCLUDES) $< $@?*.cpp -o $@
39
40t004:	t004.cpp t004lexer.tokens UserTestTraits.hpp Makefile $(ANTLR) $(RUNTIME_HEADERS)
41	g++ $(CFLAGS) -DUSESTL $(INCLUDES) $< $@?*.cpp -o $@
42
43t005:	t005.cpp t005lexer.tokens UserTestTraits.hpp Makefile $(ANTLR) $(RUNTIME_HEADERS)
44	g++ $(CFLAGS) -DUSESTL $(INCLUDES) $< $@?*.cpp -o $@
45
46t006:	t006.cpp t006lexer.tokens UserTestTraits.hpp Makefile $(ANTLR) $(RUNTIME_HEADERS)
47	g++ $(CFLAGS) -DUSESTL $(INCLUDES) $< $@?*.cpp -o $@
48
49t007:	t007.cpp t007lexer.tokens UserTestTraits.hpp Makefile $(ANTLR) $(RUNTIME_HEADERS)
50	g++ $(CFLAGS) -DUSESTL $(INCLUDES) $< $@?*.cpp -o $@
51
52t008:	t008.cpp t008lexer.tokens UserTestTraits.hpp Makefile $(ANTLR) $(RUNTIME_HEADERS)
53	g++ $(CFLAGS) -DUSESTL $(INCLUDES) $< $@?*.cpp -o $@
54
55t009:	t009.cpp t009lexer.tokens UserTestTraits.hpp Makefile $(ANTLR) $(RUNTIME_HEADERS)
56	g++ $(CFLAGS) -DUSESTL $(INCLUDES) $< $@?*.cpp -o $@
57
58t010:	t010.cpp t010lexer.tokens UserTestTraits.hpp Makefile $(ANTLR) $(RUNTIME_HEADERS)
59	g++ $(CFLAGS) -DUSESTL $(INCLUDES) $< $@?*.cpp -o $@
60
61t011:	t011.cpp t011lexer.tokens UserTestTraits.hpp Makefile $(ANTLR) $(RUNTIME_HEADERS)
62	g++ $(CFLAGS) -DUSESTL $(INCLUDES) $< $@?*.cpp -o $@
63
64t012:	t012.cpp t012lexerXMLLexer.tokens UserTestTraits.hpp Makefile $(ANTLR) $(RUNTIME_HEADERS)
65	g++ $(CFLAGS) -DUSESTL $(INCLUDES) $< $@?*.cpp -o $@
66
67t051:	t051.cpp t051lexer.tokens UserTestTraits.hpp Makefile $(ANTLR) $(RUNTIME_HEADERS)
68	g++ $(CFLAGS) -DUSESTL $(INCLUDES) $< $@?*.cpp -o $@
69
70# AST commented out
71# t039:	t039.cpp t039labels.tokens UserTestTraits.hpp Makefile $(ANTLR) $(RUNTIME_HEADERS)
72# 	g++ $(CFLAGS) -DUSESTL $(INCLUDES) $< $@?*.cpp -o $@
73#
74# t042:	t042.cpp t005lexer.tokens UserTestTraits.hpp Makefile $(ANTLR) $(RUNTIME_HEADERS)
75# 	g++ $(CFLAGS) -DUSESTL $(INCLUDES) $< $@?*.cpp -o $@
76
77clean:
78	rm -f *.o t0[0-9][0-9]??*.[ch]pp *.tokens t[0-9][0-9][0-9] t0[0-9][0-9].exe
79
80# %.u: %.g
81# 	@echo "Bulding dependencies for "$<
82# 	java -jar $(ANTLR) -depend $< > $@
83# 	@grep ":" $@ |awk 'BEGIN {printf "ANTLRGENLIST := " }{printf " " $$1}END {print ""}'  >> $@.tmp
84# 	@cat $@.tmp >> $@
85# 	$(RM) $@.tmp
86
87%.tokens %.cpp %Lexer.c %Parser.c %Lexer.h %Parser.h %.hpp: %.g $(ANTLR)
88	java -jar $(ANTLR) $(GRAMMAROPTIONS) $<
89
90ifneq ($(MAKECMDGOALS),clean)
91ifneq ($(strip $(ANTLRGRAMMARS)),)
92#-include $(ANTLRGRAMMARS:.g=.u)
93endif
94endif
95
96%.o: %.cpp $(HEADERS) utils.hpp
97	g++ $(CFLAGS) -DUSESTL $(INCLUDES) -c $< -o $@
98