1 .PRECIOUS=.o 2 3 ANTLRGRAMMARS ?= $(wildcard t0[01]*.g) 4 HEADERS = $(wildcard *.hpp) $(wildcard *.inl) 5 RUNTIME_HEADERS = $(wildcard ../include/*.hpp) $(wildcard ../include/*.inl) 6 SOURCES = $(wildcard *.cpp) 7 POBJS = $(PSOURCES:.cpp=.o) 8 TOKENS = $(ANTLRGRAMMARS:.g=.tokens) 9 10 GRAMMAROPTIONS= #-report -Xconversiontimeout 1500000 -Xmultithreaded -Xwatchconversion 11 ANTLR = ../../../antlr-complete/target/antlr-complete-3.5.2-SNAPSHOT.jar 12 STGS = $(wildcard ../../../tool/src/main/resources/org/antlr/codegen/templates/Cpp/*.stg) 13 14 .SUFFIXES: 15 16 INCLUDES= -I. -I../include/ 17 18 CFLAGS=-ggdb3 -O0 -fno-inline -Wall -Wno-unused-variable 19 #CFLAGS=-ggdb3 -O3 20 21 TOBJS= utils.o 22 23 all: $(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 31 t001: t001.cpp t001lexer.tokens UserTestTraits.hpp Makefile $(ANTLR) $(RUNTIME_HEADERS) 32 g++ $(CFLAGS) -DUSESTL $(INCLUDES) $< $@?*.cpp -o $@ 33 34 t002: t002.cpp t002lexer.tokens UserTestTraits.hpp Makefile $(ANTLR) $(RUNTIME_HEADERS) 35 g++ $(CFLAGS) -DUSESTL $(INCLUDES) $< $@?*.cpp -o $@ 36 37 t003: t003.cpp t003lexer.tokens UserTestTraits.hpp Makefile $(ANTLR) $(RUNTIME_HEADERS) 38 g++ $(CFLAGS) -DUSESTL $(INCLUDES) $< $@?*.cpp -o $@ 39 40 t004: t004.cpp t004lexer.tokens UserTestTraits.hpp Makefile $(ANTLR) $(RUNTIME_HEADERS) 41 g++ $(CFLAGS) -DUSESTL $(INCLUDES) $< $@?*.cpp -o $@ 42 43 t005: t005.cpp t005lexer.tokens UserTestTraits.hpp Makefile $(ANTLR) $(RUNTIME_HEADERS) 44 g++ $(CFLAGS) -DUSESTL $(INCLUDES) $< $@?*.cpp -o $@ 45 46 t006: t006.cpp t006lexer.tokens UserTestTraits.hpp Makefile $(ANTLR) $(RUNTIME_HEADERS) 47 g++ $(CFLAGS) -DUSESTL $(INCLUDES) $< $@?*.cpp -o $@ 48 49 t007: t007.cpp t007lexer.tokens UserTestTraits.hpp Makefile $(ANTLR) $(RUNTIME_HEADERS) 50 g++ $(CFLAGS) -DUSESTL $(INCLUDES) $< $@?*.cpp -o $@ 51 52 t008: t008.cpp t008lexer.tokens UserTestTraits.hpp Makefile $(ANTLR) $(RUNTIME_HEADERS) 53 g++ $(CFLAGS) -DUSESTL $(INCLUDES) $< $@?*.cpp -o $@ 54 55 t009: t009.cpp t009lexer.tokens UserTestTraits.hpp Makefile $(ANTLR) $(RUNTIME_HEADERS) 56 g++ $(CFLAGS) -DUSESTL $(INCLUDES) $< $@?*.cpp -o $@ 57 58 t010: t010.cpp t010lexer.tokens UserTestTraits.hpp Makefile $(ANTLR) $(RUNTIME_HEADERS) 59 g++ $(CFLAGS) -DUSESTL $(INCLUDES) $< $@?*.cpp -o $@ 60 61 t011: t011.cpp t011lexer.tokens UserTestTraits.hpp Makefile $(ANTLR) $(RUNTIME_HEADERS) 62 g++ $(CFLAGS) -DUSESTL $(INCLUDES) $< $@?*.cpp -o $@ 63 64 t012: t012.cpp t012lexerXMLLexer.tokens UserTestTraits.hpp Makefile $(ANTLR) $(RUNTIME_HEADERS) 65 g++ $(CFLAGS) -DUSESTL $(INCLUDES) $< $@?*.cpp -o $@ 66 67 t051: 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 77 clean: 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 90 ifneq ($(MAKECMDGOALS),clean) 91 ifneq ($(strip $(ANTLRGRAMMARS)),) 92 #-include $(ANTLRGRAMMARS:.g=.u) 93 endif 94 endif 95 96 %.o: %.cpp $(HEADERS) utils.hpp 97 g++ $(CFLAGS) -DUSESTL $(INCLUDES) -c $< -o $@ 98