Makefile 782 Bytes
Newer Older
Markus Mirz's avatar
Markus Mirz committed
1
2
# Declaration of variables
CC = g++
3
4
CC_FLAGS = -ggdb -w -std=c++11 $(INCLUDES)
LD_FLAGS = -lvillas-ext
Markus Mirz's avatar
Markus Mirz committed
5
6
7

# File names
EXEC = DPSolver
8
SOURCES = $(wildcard *.cpp) $(wildcard Components/*.cpp) $(wildcard Examples/*.cpp)
9
10
11
12
13
OBJECTS = $(filter-out DPsimMain.o,$(SOURCES:.cpp=.o))

TEST_SOURCES = $(wildcard Tests/Test*.cpp)
TEST_OBJS = $(TEST_SOURCES:.cpp=.o)
TEST_BINS = $(TEST_SOURCES:.cpp=)
Markus Mirz's avatar
Markus Mirz committed
14

15
INCLUDES = -I /usr/local/include/eigen -I /usr/include/eigen3
Markus Mirz's avatar
Markus Mirz committed
16

17
18
.PHONY: tests clean

Markus Mirz's avatar
Markus Mirz committed
19
# Main target
20
21
$(EXEC): $(OBJECTS) DPsimMain.o
	$(CC) $^ $(LD_FLAGS) -o $(EXEC)
Markus Mirz's avatar
Markus Mirz committed
22
23
24
25
26
27
28

# To obtain object files
%.o: %.cpp
	$(CC) -c $(CC_FLAGS) $< -o $@

# To remove generated files
clean:
29
30
31
32
33
34
	rm -f $(EXEC) $(OBJECTS) $(TEST_BINS)
 
Tests/Test%: $(OBJECTS) Tests/Test%.o
	$(CC) $^ $(LD_FLAGS) -o $@

tests: $(TEST_BINS)