-
Notifications
You must be signed in to change notification settings - Fork 6
/
Makefile
46 lines (31 loc) · 819 Bytes
/
Makefile
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
45
46
#Compiler and compiler flags
CXX := mpic++
CXXFLAGS := -Wall -std=c++11
LIB := -lconfig++
INC := -I include
#Directories
SRCDIR := src
BUILDDIR := build
TARGETDIR := bin
#Targets
TARGET = $(TARGETDIR)/DaMaSCUS-CRUST
#Source files
SRCEXT := cpp
SRC := $(shell find $(SRCDIR) -type f -name '*.$(SRCEXT)')
#Object files
OBJ := $(patsubst $(SRCDIR)/%,$(BUILDDIR)/%,$(SRC:.$(SRCEXT)=.o))
.PHONY: all clean test
all: CXXFLAGS += -O2
all: $(TARGET)
test: CXXFLAGS+= --coverage
test: $(TARGET)
$(TARGET): $(OBJ)
$(CXX) $(CXXFLAGS) $(INC) -o $@ $^ $(LIB)
$(BUILDDIR)/%.o: $(SRCDIR)/%.$(SRCEXT)
$(CXX) $(CXXFLAGS) $(INC) -o $@ -c $<
clean:
find . -type f -name '*.o' -delete
find . -type f -name '*.gcno' -delete
find . -type f -name '*.gcda' -delete
find . -type f -name '*.gcov' -delete
rm -f $(TARGET)