forked from asamy/ctorrent
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
70 lines (57 loc) · 1.63 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
ifeq ("$(origin D)", "command line")
BTYPE := -O0 -g
else
BTYPE ?= -O3
endif
BIN_DIR = bin
BIN = tc
DEP_DIR = dep
DEPFLAGS = -MT $@ -MMD -MP -MF $(DEP_DIR)/$*.d
CXX ?= $(CROSS_BUILD)g++
CXXFLAGS = -std=c++11 $(DEPFLAGS) $(BTYPE) -Wall -Wextra -Wno-deprecated-declarations \
-Wno-sign-compare -Wno-unused-variable -Wno-unused-parameter -I"." -I"D:\boost_1_60_0"
LIBS = -L"D:\boost_1_60_0\stage\lib" -lboost_system -lboost_filesystem -lboost_program_options
ifeq ($(OS),Windows_NT)
LIBS += -lws2_32 -lshlwapi -lMswsock
else
LIBS += -lpthread -lcurses
endif
OBJ_DIR = obj
SRC = bencode/decoder.cpp bencode/encoder.cpp \
ctorrent/tracker.cpp ctorrent/peer.cpp ctorrent/torrentmeta.cpp \
ctorrent/torrentfilemanager.cpp ctorrent/torrent.cpp \
net/server.cpp net/connection.cpp net/inputmessage.cpp net/outputmessage.cpp \
util/auxiliar.cpp \
main.cpp
OBJ = $(SRC:%.cpp=$(OBJ_DIR)/%.o)
DEP = $(SRC:%.cpp=$(DEP_DIR)/%.d)
.PHONY: all clean
.PRECIOUS: $(DEP_DIR)/%.d
all: $(BIN)
clean:
@$(RM) $(OBJ_DIR)/*.o
@$(RM) $(OBJ_DIR)/*/*.o
@$(RM) $(DEP_DIR)/*.d
@$(RM) $(DEP_DIR)/*/*.d
@$(RM) $(BIN)
@echo " Cleaned"
$(BIN): $(DEP_DIR) $(OBJ_DIR) $(OBJ) $(DEP)
@echo " LD $@"
@$(CXX) -o $@ $(OBJ) $(LIBS)
$(OBJ_DIR)/%.o: %.cpp $(DEP_DIR)/%.d
@echo " CXX $<"
@$(CXX) -c $(CXXFLAGS) -o $@ $<
-include $(DEP)
$(DEP_DIR)/%.d: ;
$(DEP_DIR):
@mkdir -p $(DEP_DIR)
@mkdir -p $(DEP_DIR)/bencode
@mkdir -p $(DEP_DIR)/ctorrent
@mkdir -p $(DEP_DIR)/net
@mkdir -p $(DEP_DIR)/util
$(OBJ_DIR):
@mkdir -p $(OBJ_DIR)
@mkdir -p $(OBJ_DIR)/bencode
@mkdir -p $(OBJ_DIR)/ctorrent
@mkdir -p $(OBJ_DIR)/net
@mkdir -p $(OBJ_DIR)/util