-
Notifications
You must be signed in to change notification settings - Fork 0
/
makefile
81 lines (62 loc) · 1.82 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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
# CFLAGS = -I ./include
# test: ./src/main.o libstack.a
# gcc ./src/main.o -lstack -L./lib -o test
# main.o: ./src/main.c
# gcc $(CFLAGS) -c ./src/main.c -o ./src/main.o
# libstack.a: stack.o
# ar -r ./lib/libstack.a ./lib/stack.o
# stack.o: ./lib/stack.c
# gcc $(CFLAGS) -c ./lib/stack.c -o ./lib/stack.o
# clean:
# rm test ./lib/libstack.a ./lib/stack.o src/main.o
cc = gcc
SOURCES =$(wildcard ./src/*.c)
INCLUDES =-I./include
LIB_PATH =-L./lib
OBJ =$(patsubst %.c, %.o, $(SOURCES))
#TARGET =server
EXECUTABLES = sequencial_server icmp_sniffer thread_server select_server epoll_server uv_server hash\
uv_prime_server counter MPMC semaphore
all: $(EXECUTABLES)
@rm -r $(OBJ)
#links
sequencial_server: src/sequential_server.o src/utils.o
@mkdir -p output
$(CC) $^ $(LIB_PATH) -o output/$@
icmp_sniffer: src/icmp_sniffer.o
@mkdir -p output
$(CC) $^ $(LIB_PATH) -o output/$@
thread_server: src/thread_server.o src/utils.o
@mkdir -p output
$(CC) $^ $(LIB_PATH) -o output/$@ -lpthread
select_server: src/select_server.o src/utils.o
@mkdir -p output
$(CC) $^ -lc -o output/$@
epoll_server: src/epoll_server.o src/utils.o
@mkdir -p output
$(CC) $^ -lc -o output/$@
uv_server: src/uv_server.o src/utils.o
@mkdir -p output
$(CC) $^ -luv -o output/$@
hash: src/hash.o
@mkdir -p output
$(CC) $^ -o output/$@
uv_prime_server: src/uv_prime_server.o src/utils.o
@mkdir -p output
$(CC) $^ -luv -o output/$@
counter: src/file_counter.o
@mkdir -p output
$(CC) $^ -o output/$@
MPMC: src/MPMC.o
@mkdir -p output
@$(CC) $^ $(LIB_PATH) -o output/$@ -lpthread
semaphore: src/semaphore.o
@mkdir -p output
@$(CC) $^ $(LIB_PATH) -o output/$@ -lpthread
#compile
%.o: %.c
$(CC) -g $(INCLUDES) -c $< -o $@
.PHONY:clean
clean:
@echo "Remove linked and compiled files......"
rm -rf $(OBJ) $(EXECUTABLES) output