summaryrefslogtreecommitdiff
path: root/impl/Makefile
blob: f056d1fc421e2af86c466fe0ddf0700a9730b13d (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
CC=gcc
CPP=g++
BUILD=build/
FLAGS=-Wall -Werror -Wextra -pedantic -lantlr3c -std=c++11
NORMAL_FLAGS=$(FLAGS) -g -pg
OPTIMISED_FLAGS=$(FLAGS) -O3

all: main

.PHONY: check-syntax
check-syntax:
	-$(CPP) $(FLAGS) -o /tmp/null -x c++ $(CHK_SOURCES)
# the - is to ignore the return code.

main: build-dir grammar
	$(CPP) main.cpp *.o -o $(BUILD)/main $(NORMAL_FLAGS)

fastest-main: build-dir grammar
	$(CPP) main.cpp *.o -o $(BUILD)/main $(OPTIMISED_FLAGS)

grammar: build-dir
	java -jar ../antlr/antlr-3.4-complete.jar EquationSystem.g
	$(CC) *.c -c -lantrl3c

build-dir:
	mkdir -p $(BUILD)

test: main
	bash ./test/run ./build/main

clean:
	rm -rf $(BUILD)
	rm -rf *.o *.c *.h *.tokens
# antlr o, c, h and tokens files