-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
58 lines (44 loc) · 2.11 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
BINS = relay/relay_main.bin \
client/client_main.bin \
socks_sample_client/socks_sample_client.bin \
directory/directory.bin \
set_dir_utility/set_dir_utility.bin
CC = gcc
CFLAGS = -O0 -Wall $(INCLUDE) `pkg-config gnutls --cflags` `libgcrypt-config --cflags`
LIBS = `pkg-config gnutls --libs` `libgcrypt-config --libs`
DIRS := ${shell find src/ -type d -print}
SRC = $(foreach dir,$(DIRS),$(wildcard $(dir)/*.c))
SAVE = $(foreach dir,$(DIRS),$(wildcard $(dir)/*~))
OBJ = $(patsubst src/%.c,build/%.o,$(SRC))
RBINS = $(foreach bin,$(BINS),build/$(bin))
%client_main.bin: build/client/select.o build/lib/tls.o build/client/socks.o build/lib/tcp.o build/lib/chained_list.o build/lib/signaling.o build/client/client_main.o
@echo "--------------------------------------------------------------------------------"
@echo [link]
$(CC) -o $@ $^ $(LIBS) -lpthread
%directory.bin: build/directory/directory.o build/lib/tls.o build/lib/tcp.o
@echo "--------------------------------------------------------------------------------"
@echo [link]
$(CC) -o $@ $^ $(LIBS) -lpthread
%relay_main.bin: build/relay/relay_main.o build/lib/tls.o build/lib/tcp.o build/lib/chained_list.o build/lib/signaling.o build/relay/accept.o build/relay/select.o
@echo "--------------------------------------------------------------------------------"
@echo [link]
$(CC) -o $@ $^ $(LIBS) -lpthread
%socks_sample_client.bin: build/socks_sample_client/socks_sample_client.o
@echo "--------------------------------------------------------------------------------"
@echo [link]
$(CC) -o $@ $^ $(LIBS) -lpthread
%set_dir_utility.bin: build/set_dir_utility/set_dir_utility.o
@echo "--------------------------------------------------------------------------------"
@echo [link]
$(CC) -o $@ $^ $(LIBS) -lpthread
all: mkdir $(RBINS)
@echo "$(RBINS)"
@echo ""
build/%.o: src/%.c
@echo "--------------------------------------------------------------------------------"
@echo [CC] $<
$(CC) -c $(CFLAGS) $< -o $@
mkdir:
mkdir -p $(patsubst src/%,build/%,$(DIRS))
clean:
rm -f $(RBINS) $(OBJ) $(SAVE)