-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
37 lines (36 loc) · 922 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
# We define variables for directories
DIROBJ = obj
DIRINC = include
DIRSRC = src
DIRBIN = .
# Compiler
CC = clang -g
CFLAGS = -W -Werror -I$(DIRINC) $(DEBUG_FLAG)
CLIBS = -lpthread
# Dependencies, objects, ...
DEPS = $(wildcard include/*.h)
OBJETS = $(DEPS:$(DIRINC)/%.h=obj/%.o)
.SUFFIXES:
# We create targets
all :
@make server --no-print-directory
@make client --no-print-directory
server : src/server.c $(OBJETS)
$(CC) $(CFLAGS) -o [email protected] $^ $(CLIBS)
debug :
@make DEBUG_FLAG=-DDEBUG_LEVEL=999 --no-print-directory
warnings :
@make DEBUG_FLAG=-DDEBUG_LEVEL=1 --no-print-directory
client : src/client.c $(OBJETS)
$(CC) $(CFLAGS) -o [email protected] $^ $(CLIBS)
$(DIROBJ)/%.o : $(DIRSRC)/%.c
@mkdir -p obj
$(CC) $(CFLAGS) -c -o $@ $<
# Targets to call manually
.PHONY: archive
archive:
tar -f archive.tar.gz -cvz $(DIRSRC)/*.c $(DIRINC)/*.h Makefile
.PHONY: clean
clean:
rm -r $(DIROBJ)
rm -r *.out