summaryrefslogtreecommitdiff
path: root/impl/Makefile
blob: 492528d39d74d4527218e6ce91aea40ca343ce04 (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
39
40
41
42
43
44
CC=gcc
CPP=g++
BUILD=build
PARSER=parser
FLAGS= -lantlr3c -fno-exceptions -lrt
#-Wall -Werror -Wextra -pedantic -lantlr3c -fno-exceptions -lrt
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.o MCFSimplex.o
	$(CPP) main.o MCFSimplex.o $(PARSER)/*.o -o $(BUILD)/main $(NORMAL_FLAGS)

main.o: main.cpp *.hpp *.h
	$(CPP) -c main.cpp $(NORMAL_FLAGS)

MCFSimplex.o: MCFSimplex.cpp *.h
	$(CPP) -c MCFSimplex.cpp $(NORMAL_FLAGS)

$(PARSER): EquationSystem.g
	mkdir -p $(PARSER)
	java -jar ../antlr/antlr-3.4-complete.jar -o $(PARSER) EquationSystem.g
	cd $(PARSER); $(CC) *.c -c -lantlr3c

$(BUILD):
	mkdir -p $(BUILD)

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

clean:
	rm -rf $(BUILD)
	rm -rf $(PARSER)
	rm -rf *.o