-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
40 lines (29 loc) · 937 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
CC = clang
CXX = clang++
CFLAGS = -std=c11 -Wall -g -I main/include -I test/include -I /usr/local/include
LDFLAGS = -lncurses -lpthread
CXXFLAGS = -std=c++14 -Wall -g -I main/include -I test/include
OUT = snake
TOUT= tsnake
ODIR = obj
SDIR = main
TDIR = test
_MOBJS = arraydeque.o board.o snake.o game.o
_TOBJS = test_runner.o board_test.o snake_test.o array_deque_test.o game_test.o
EXEC = $(ODIR)/main.o
MAINOBJS = $(patsubst %,$(ODIR)/%,$(_MOBJS))
TESTOBJS = $(patsubst %,$(ODIR)/%,$(_TOBJS))
$(ODIR)/%.o: $(SDIR)/%.cpp
$(CXX) $(CXXFLAGS) -c $< -o $@
$(ODIR)/%.o: $(TDIR)/%.c
$(CC) $(CFLAGS) -c $(INC) $< -o $@
$(ODIR)/%.o: $(SDIR)/%.c
$(CC) $(CFLAGS) -c $(INC) $< -o $@
tests: $(MAINOBJS) $(TESTOBJS)
$(CC) $(TESTOBJS) $(MAINOBJS) $(LDFLAGS) -L /usr/local/lib -lcunit -o $(TOUT)
./tsnake
all: $(MAINOBJS) $(EXEC)
$(CXX) $(MAINOBJS) $(EXEC) -o $(OUT) $(LDFLAGS)
.PHONY: clean
clean:
rm $(ODIR)/*.o $(OUT) $(TOUT)