-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmakefile
46 lines (29 loc) · 855 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
CXX=g++
CXXFLAGS=-Wall -std=c++17
# LIBFLAGS=-lm -pthread -fopenmp
SRCDIR=src
UTESTDIR=src/tests
OBJDIR=obj
BINDIR=bin
_DEPS=matrix.h piece.h tetris.h testtetris.h
DEPS=$(patsubst %,$(SRCDIR)/%,$(_DEPS))
_OBJ=main.o piece.o tetris.o testtetris.o
OBJ=$(patsubst %,$(OBJDIR)/%,$(_OBJ))
_OBJ_UNITTEST=matrix_unittests.o
OBJ_UNITTEST=$(patsubst %,$(OBJDIR)/%,$(_OBJ_UNITTEST))
.PHONY: all
all: main
main: $(OBJ)
$(CXX) -o $(BINDIR)/main.exe $^ $(CXXFLAGS)
$(OBJDIR)/%.o: $(SRCDIR)/%.cpp $(DEPS)
$(CXX) -c $< -o $@ $(CXXFLAGS) -I $(SRCDIR)
.PHONY: all_unittests
all_unittests: matrix_unittests
matrix_unittests: $(OBJ_UNITTEST)
$(CXX) -o $(BINDIR)/matrix_unittests.exe $^ $(CXXFLAGS)
$(OBJDIR)/%.o: $(UTESTDIR)/%.cpp $(DEPS)
$(CXX) -c $< -o $@ $(CXXFLAGS) -I $(UTESTDIR) -I $(SRCDIR)
.PHONY: clean
clean:
del /q obj\*.o bin\*.exe
# Tests