summaryrefslogtreecommitdiff
path: root/impl/Makefile
blob: c73c1a932b5f51a8b76b18e5c10bb86078a2d29d (about) (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
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: $(PARSER)
	-$(CPP) $(FLAGS) -o /tmp/null -x c++ $(CHK_SOURCES)
# the - is to ignore the return code.

$(BUILD)/main: $(BUILD) $(PARSER) main.cpp *.hpp
	$(CPP) main.cpp $(PARSER)/*.o -o $(BUILD)/main $(NORMAL_FLAGS)

$(BUILD)/fast: $(BUILD) $(PARSER) main.cpp *.hpp
	$(CPP) main.cpp $(PARSER)/*.o -o $(BUILD)/fast $(OPTIMISED_FLAGS)

$(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)

test: $(BUILD)/main
	bash ./test/run ./build/main

clean:
	rm -rf $(BUILD)
	rm -rf $(PARSER)