-
Notifications
You must be signed in to change notification settings - Fork 4
/
Makefile
56 lines (41 loc) · 1.74 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
include Makefile.inc
BINS = cbftp $(BINDIR)/cbftp-debug $(BINDIR)/datafilecat $(BINDIR)/datafilewrite
BINDIR = bin
SRC_TARGETS := src src/core src/http src/ext
SRC = $(wildcard src/*.cpp)
LIBS := $(wildcard $(addsuffix /*.a,$(SRC_TARGETS)))
OBJS = $(wildcard $(SRC:%.cpp=%.o))
ifneq ($(UI_PATH),)
UI_DEP = $(wildcard $(UI_PATH)/*.a)
ifeq ($(UNAME_S),Darwin)
UI_LINK = -Wl,-force_load $(UI_DEP)
else
UI_LINK = -Wl,--whole-archive $(UI_DEP) -Wl,--no-whole-archive
endif
SRC_TARGETS := $(SRC_TARGETS) $(UI_PATH)
endif
CLEAN_TARGETS = $(addprefix clean-,$(SRC_TARGETS))
.PHONY: $(SRC_TARGETS) $(CLEAN_TARGETS)
all: $(BINS)
$(SRC_TARGETS):
@+$(MAKE) -C $@
$(BINDIR):
mkdir -p $@
cbftp: $(SRC_TARGETS) | $(BINDIR)
@+$(MAKE) --no-print-directory $(BINDIR)/cbftp
$(BINDIR)/cbftp: $(OBJS) $(UI_DEP) $(LIBS)
$(CXX) -o $(BINDIR)/cbftp $(OPTFLAGS) $(SRC:%.cpp=%.o) $(UI_LINK) $(LIBS) $(LINKFLAGS)
$(BINDIR)/cbftp-debug: misc/start_with_gdb.sh | $(BINDIR)
cp misc/start_with_gdb.sh $@; chmod +x bin/cbftp-debug
$(BINDIR)/datafilecat: src/crypto.cpp src/tools/datafilecat.cpp Makefile.inc | $(BINDIR)
$(CXX) -o $@ $(OPTFLAGS) -std=c++11 $(STATIC_SSL_INCLUDE) src/crypto.cpp \
src/filesystem.cpp src/path.cpp src/tools/datafilecat.cpp $(SSL_LINKFLAGS) -lpthread
$(BINDIR)/datafilewrite: src/crypto.cpp src/tools/datafilewrite.cpp Makefile.inc | $(BINDIR)
$(CXX) -o $@ $(OPTFLAGS) -std=c++11 $(STATIC_SSL_INCLUDE) src/crypto.cpp \
src/filesystem.cpp src/path.cpp src/tools/datafilewrite.cpp $(SSL_LINKFLAGS) -lpthread
linecount:
find -not -path './src/ext/*'|grep -e '\.h$$' -e '\.cpp$$'|awk '{print $$1}'|xargs wc -l|sort -n
clean: $(CLEAN_TARGETS)
@if test -d $(BINDIR); then rm -rf $(BINDIR); echo rm -rf $(BINDIR); fi
$(CLEAN_TARGETS):
@+$(MAKE) -C $(@:clean-%=%) clean