summaryrefslogtreecommitdiff
path: root/impl
diff options
context:
space:
mode:
Diffstat (limited to 'impl')
-rw-r--r--impl/Makefile24
-rw-r--r--impl/main.cpp4
2 files changed, 16 insertions, 12 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)
diff --git a/impl/main.cpp b/impl/main.cpp
index 2b7a9a1..a6693f0 100644
--- a/impl/main.cpp
+++ b/impl/main.cpp
@@ -11,8 +11,8 @@
#include "FixpointAlgorithm.hpp"
extern "C" {
-#include "EquationSystemParser.h"
-#include "EquationSystemLexer.h"
+#include "parser/EquationSystemParser.h"
+#include "parser/EquationSystemLexer.h"
}
using namespace std;