-
Notifications
You must be signed in to change notification settings - Fork 0
/
makefile
39 lines (30 loc) · 818 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
CC = gcc
CFLAGS = -Werror -Wall -g -I$(IDIR)
IDIR = ./include/
SRCDIR = ./src/
OS_NAME = $(shell uname)
SERVER_SOURCE = $(wildcard ${SRCDIR}server/*.c) \
$(wildcard ${SRCDIR}other/*.c)
CLIENT_SOURCE = $(wildcard ${SRCDIR}client/*.c) \
$(wildcard ${SRCDIR}other/*.c)
all: clean server_compile client_compile
server: clean server_compile
server_compile:
ifeq ($(OS_NAME), Linux)
$(CC) $(SERVER_SOURCE) $(CFLAGS) -o server -lpthread
else
$(CC) $(SERVER_SOURCE) $(CFLAGS) -o server -lws2_32 -lwsock32
endif
client: clean client_compile
client_compile:
ifeq ($(OS_NAME), Linux)
$(CC) $(CLIENT_SOURCE) $(CFLAGS) -o client -lpthread
else
$(CC) $(CLIENT_SOURCE) $(CFLAGS) -o client -lws2_32 -lwsock32
endif
clean:
ifeq ($(OS_NAME), Linux)
rm -f ./client ./server
else
del /f client.exe server.exe
endif