-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
50 lines (33 loc) · 1.73 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
CC=gcc -g
CFLAGS=-Wall
all: server client
debug: CFLAGS += -g
debug: bin/server
server: bin/ttt-server
client: bin/ttt-client
bin/helpers.o: $(addprefix src/, helpers.h helpers.c)
$(CC) $(CFLAGS) -c src/helpers.c -o bin/helpers.o
# SERVER
bin/ttt-server: $(addprefix bin/server/, main.o socket.o game.o game_logic.o)
$(CC) $(CFLAGS) -o bin/ttt-server $(addprefix bin/server/, main.o socket.o game.o game_logic.o) bin/helpers.o
bin/server/main.o: $(addprefix src/server/, main.c macros.h) bin/server/socket.o bin/helpers.o
$(CC) $(CFLAGS) -c src/server/main.c -o bin/server/main.o
bin/server/socket.o: $(addprefix src/server/, socket.h socket.c macros.h) bin/server/game.o src/helpers.h
$(CC) $(CFLAGS) -c src/server/socket.c -o bin/server/socket.o
bin/server/game.o: $(addprefix src/server/, game.c game.h macros.h) bin/helpers.o
$(CC) $(CFLAGS) -c src/server/game.c -o bin/server/game.o
bin/server/game_logic.o: $(addprefix src/server/, game_logic.c game_logic.h game.h)
$(CC) $(CFLAGS) -c src/server/game_logic.c -o bin/server/game_logic.o
# CLIENT
bin/ttt-client: $(addprefix bin/client/, main.o)
$(CC) $(CFLAGS) -lpthread -lcurses -o bin/ttt-client $(addprefix bin/client/, main.o socket.o game.o) bin/helpers.o
bin/client/main.o: $(addprefix src/client/, main.c) bin/helpers.o bin/client/game.o
$(CC) $(CFLAGS) -c src/client/main.c -o $(addprefix bin/client/, main.o)
bin/client/socket.o: $(addprefix src/client/, socket.h socket.c)
$(CC) $(CFLAGS) -c src/client/socket.c -o bin/client/socket.o
bin/client/game.o: $(addprefix src/client/, game.h game.c macros.h) bin/helpers.o bin/client/socket.o
$(CC) $(CFLAGS) -c src/client/game.c -o bin/client/game.o
clean:
rm -f bin/server/*
rm -f bin/client/*
rm -f helpers.o ttt-server ttt-client