-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
51 lines (35 loc) · 1.22 KB
/
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
47
48
49
50
51
LINK_TARGET = $(bin_dir)/LoveLetter-BoardGame
test_suffix = /usr/src/gtest/src/gtest_main.cc /usr/src/gtest/src/gtest-all.cc -I /usr/include -I /usr/src/gtest -L /usr/local/lib -lpthread
include_dir = include
object_dir = object
src_dir = src
bin_dir = bin
test_dir = unittest
vpath %.cpp src:unittest
vpath %.h include
vpath %.o object
vpath % bin:unittest
cc = g++
CCFLAG = -I$(include_dir) -Wall
$(LINK_TARGET): main.o card.o player.o game.o
if [ ! -d $(bin_dir) ]; then mkdir $(bin_dir); fi
$(cc) -o $@ $^
$(object_dir)/card.o: card.cpp
$(cc) -c -o $@ $< $(CCFLAG)
$(object_dir)/player.o: player.cpp
$(cc) -c -o $@ $< $(CCFLAG)
$(object_dir)/game.o: game.cpp
$(cc) -c -o $@ $< $(CCFLAG)
$(object_dir)/main.o: main.cpp
if [ ! -d $(object_dir) ]; then mkdir $(object_dir); fi
$(cc) -c -o $@ $< $(CCFLAG)
clean:
rm object/*.o $(LINK_TARGET) $(test_dir)/testCard \
$(test_dir)/testPlayer $(test_dir)/testGame
test: testCard testPlayer testGame
$(test_dir)/testCard: testCard.cpp card.o
$(cc) -o $@ $^ $(CCFLAG) $(test_suffix)
$(test_dir)/testPlayer: testPlayer.cpp player.o card.o
$(cc) -o $@ $^ $(CCFLAG) $(test_suffix)
$(test_dir)/testGame: testGame.cpp player.o card.o game.o
$(cc) -o $@ $^ $(CCFLAG) $(test_suffix)