-
Notifications
You must be signed in to change notification settings - Fork 0
/
makefile
55 lines (39 loc) · 1.13 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
52
53
54
55
#----------------------------------------
# GENERAL:
CC=g++
LD=g++
#----------------------------------------
# GO:
TARGET=Go
SRC=main go game goban pawn pawn_black pawn_white field history event player
#game
#game interface player goban field history event
LIBS=-lncurses
FLAGS=-Wall -I "./header"
#----------------------------------------
# UNIT TESTS:
TSRC=ExampleTest MyTest
TUNIT=CuTest
TLIBS=
TFLAGS=-I "./test"
#----------------------------------------
CFLAGS=$(FLAGS)
LDFLAGS=$(FLAGS) $(LIBS)
TCFLAGS=$(FLAGS) $(TFLAGS)
TLDFLAGS=$(FLAGS) $(LIBS) $(TFLAGS) $(TLIBS)
SRCS=$(addsuffix .cpp, $(SRC))
OBJS=$(addprefix object/, $(addsuffix .o, $(SRCS)))
TSRCS=$(addsuffix .cpp, $(SRC) $(TSRC) $(TUNIT))
TOBJS=$(addprefix object/, $(addsuffix .o, $(TSRCS)))
test: $(TOBJS)
$(LD) $(TOBJS) $(TLDFLAGS) -o $(TARGET)
$(TARGET): $(OBJS)
$(LD) $(OBJS) $(LDFLAGS) -o $(TARGET)
object/%.cpp.o: source/%.cpp header/%.hpp
$(CC) -c $< $(TCFLAGS) -o $@
object/%.cpp.o: test/%.cpp test/AllTests.hpp test/CuTest.hpp test/test.hpp
$(CC) -c $< $(TCFLAGS) -o $@
make debug: debug.c
g++ debug.c -o debug
clean:
rm -f $(TOBJS) $(TARGET) object/*