summaryrefslogtreecommitdiff
path: root/impl/Makefile
diff options
context:
space:
mode:
authorCarlo Zancanaro <carlo@pc-4w14-0.cs.usyd.edu.au>2012-07-10 13:36:37 +1000
committerCarlo Zancanaro <carlo@pc-4w14-0.cs.usyd.edu.au>2012-07-10 13:36:37 +1000
commit3efc870c5e2779e068841ae8befc901f68671f13 (patch)
treec7f91dd8d84c4a08479b9fa3ceba0ad16ba34032 /impl/Makefile
parent2adac33721e22d6dafb0654b933027331f2b7d51 (diff)
Clean up the building of the parser a bit.
Diffstat (limited to 'impl/Makefile')
-rw-r--r--impl/Makefile24
1 files changed, 14 insertions, 10 deletions
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)