From 3efc870c5e2779e068841ae8befc901f68671f13 Mon Sep 17 00:00:00 2001 From: Carlo Zancanaro Date: Tue, 10 Jul 2012 13:36:37 +1000 Subject: Clean up the building of the parser a bit. --- impl/Makefile | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) (limited to 'impl/Makefile') diff --git a/impl/Makefile b/impl/Makefile index ab604d9..c73c1a9 100644 --- a/impl/Makefile +++ b/impl/Makefile @@ -1,26 +1,31 @@ CC=gcc CPP=g++ BUILD=build +PARSER=parser FLAGS=-Wall -Werror -Wextra -pedantic -lantlr3c -std=c++11 NORMAL_FLAGS=$(FLAGS) -g -pg OPTIMISED_FLAGS=$(FLAGS) -O3 all: $(BUILD)/main +main: $(BUILD)/main +fast: $(BUILD)/fast + .PHONY: check-syntax -check-syntax: +check-syntax: $(PARSER) -$(CPP) $(FLAGS) -o /tmp/null -x c++ $(CHK_SOURCES) # the - is to ignore the return code. -$(BUILD)/main: $(BUILD) EquationSystemParser.o main.cpp *.hpp - $(CPP) main.cpp *.o -o $(BUILD)/main $(NORMAL_FLAGS) +$(BUILD)/main: $(BUILD) $(PARSER) main.cpp *.hpp + $(CPP) main.cpp $(PARSER)/*.o -o $(BUILD)/main $(NORMAL_FLAGS) -#fastest-main: $(BUILD) grammar -# $(CPP) main.cpp *.o -o $(BUILD)/main $(OPTIMISED_FLAGS) +$(BUILD)/fast: $(BUILD) $(PARSER) main.cpp *.hpp + $(CPP) main.cpp $(PARSER)/*.o -o $(BUILD)/fast $(OPTIMISED_FLAGS) -EquationSystemParser.o: EquationSystem.g - java -jar ../antlr/antlr-3.4-complete.jar EquationSystem.g - $(CC) *.c -c -lantrl3c +$(PARSER): EquationSystem.g + mkdir -p $(PARSER) + java -jar ../antlr/antlr-3.4-complete.jar -o $(PARSER) EquationSystem.g + cd $(PARSER); $(CC) *.c -c -lantrl3c $(BUILD): mkdir -p $(BUILD) @@ -30,5 +35,4 @@ test: $(BUILD)/main clean: rm -rf $(BUILD) - rm -rf *.o *.c *.h *.tokens -# antlr o, c, h and tokens files + rm -rf $(PARSER) -- cgit v1.2.3