-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathMakefile
55 lines (38 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
51
52
53
54
55
all:
clean:
.PHONY: all clean
## server
COMMON_CFLAGS = -g -Wuninitialized -O2
CFLAGS = $(COMMON_CFLAGS) `pkg-config cairo --cflags` `pkg-config sdl --cflags` -Icommon
LDFLAGS = -g `pkg-config cairo --libs` `pkg-config sdl --libs` -lm
MAIN_OBJ = server/main.o server/drawing.o server/field.o common/net_utils.o server/net_commands.o server/net_core.o server/robotserver.o
robotserver: $(MAIN_OBJ)
$(CC) -o robotserver $(MAIN_OBJ) $(LDFLAGS)
server/field.o: server/field.c server/drawing.h server/field.h
server/testlogic.o: server/testlogic.c server/robotserver.h
server/robotserver.o: server/robotserver.c server/robotserver.h
server/drawing.o: server/drawing.c server/drawing.h
server/net_core.o: server/net_core.c server/robotserver.h common/net_utils.h server/net_defines.h server/field.h
server/net_commands.o: server/net_commands.c server/net_defines.h server/robotserver.h
common/net_utils.o: common/net_utils.c common/net_utils.h
## robots
ROBOTS = counter rabbit rook sniper spot
LIBROBOTS_OBJS = clients/robots.o common/net_utils.o
all-robots: $(ROBOTS)
clients/robots.o: clients/robots.c
robots.a: $(LIBROBOTS_OBJS)
ar cru $@ $(LIBROBOTS_OBJS)
counter: clients/counter.c clients/robots.h robots.a
$(CC) $(COMMON_CFLAGS) -o $@ $< -lm robots.a
rabbit: clients/rabbit.c clients/robots.h robots.a
$(CC) $(COMMON_CFLAGS) -o $@ $< -lm robots.a
rook: clients/rook.c clients/robots.h robots.a
$(CC) $(COMMON_CFLAGS) -o $@ $< -lm robots.a
sniper: clients/sniper.c clients/robots.h robots.a
$(CC) $(COMMON_CFLAGS) -o $@ $< -lm robots.a
spot: clients/spot.c clients/robots.h robots.a
$(CC) $(COMMON_CFLAGS) -o $@ $< -lm robots.a
## overall rules
all: robotserver $(ROBOTS)
clean:
rm -f $(ROBOTS) $(LIBROBOTS_OBJS) robots.a robotserver $(MAIN_OBJ)