forked from GangZhuo/BaiduPCS
-
Notifications
You must be signed in to change notification settings - Fork 0
/
makefile
91 lines (76 loc) · 3.12 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
82
83
84
85
86
87
88
89
90
ver = release
OS_NAME = $(shell uname -s | cut -c1-6)
LC_OS_NAME = $(shell echo $(OS_NAME) | tr '[A-Z]' '[a-z]')
PCS_OBJS = bin/cJSON.o bin/pcs.o bin/pcs_fileinfo.o bin/pcs_http.o bin/pcs_mem.o bin/pcs_pan_api_resinfo.o bin/pcs_slist.o bin/pcs_utils.o
SHELL_OBJS = bin/shell.o bin/pcs_io.o bin/shell_args.o bin/dir.o bin/hashtable.o bin/rc4.o bin/daemon.o bin/logger.o
#CCFLAGS = -DHAVE_ASPRINTF -DHAVE_ICONV
ifeq ($(LC_OS_NAME), cygwin)
CYGWIN_CCFLAGS = -largp
else
CYGWIN_CCFLAGS =
endif
ifeq ($(LC_OS_NAME), darwin)
APPLE_CCFLAGS = -largp
else
APPLE_CCFLAGS =
endif
ifneq ($(ver), debug)
$(warning "Use 'make ver=debug' to build for gdb debug.")
CC = gcc
else
CC = gcc -g -DDEBUG -D_DEBUG
endif
all: pre test/version.h bin/libpcs.a bin/pcs
bin/pcs : bin/main.o bin/libpcs.a $(SHELL_OBJS)
$(CC) -o $@ bin/main.o $(SHELL_OBJS) $(CCFLAGS) $(CYGWIN_CCFLAGS) $(APPLE_CCFLAGS) -L./bin -lpcs -lm -lcurl -lssl -lcrypto -lsqlite3
bin/main.o: test/main.c test/shell.h
$(CC) -o $@ -c test/main.c $(PCS_CCFLAGS)
bin/shell.o: test/shell.c \
test/shell.h \
test/shell_args.h \
test/pcs_io.h \
test/rc4.h
$(CC) -o $@ -c $(PCS_CCFLAGS) test/shell.c
bin/pcs_io.o: test/pcs_io.c test/pcs_io.h
$(CC) -o $@ -c $(PCS_CCFLAGS) test/pcs_io.c
bin/shell_args.o: test/shell_args.c test/shell_args.h test/version.h
$(CC) -o $@ -c $(PCS_CCFLAGS) test/shell_args.c
bin/dir.o: test/dir.c test/dir.h
$(CC) -o $@ -c $(PCS_CCFLAGS)test/dir.c
bin/hashtable.o: test/hashtable.c test/hashtable.h
$(CC) -o $@ -c $(PCS_CCFLAGS) test/hashtable.c
bin/rc4.o: test/rc4.c test/rc4.h
$(CC) -o $@ -c $(PCS_CCFLAGS) test/rc4.c
bin/daemon.o: test/daemon.c test/daemon.h test/sql.h
$(CC) -o $@ -c $(PCS_CCFLAGS) test/daemon.c
bin/logger.o: test/logger.c test/logger.h
$(CC) -o $@ -c $(PCS_CCFLAGS) test/logger.c
test/version.h:
bash ver.sh
bin/libpcs.a : $(PCS_OBJS)
$(AR) crv $@ $^
bin/cJSON.o: pcs/cJSON.c pcs/cJSON.h
$(CC) -o $@ -c $(PCS_CCFLAGS) pcs/cJSON.c
bin/pcs.o: pcs/pcs.c pcs/pcs_defs.h pcs/pcs_mem.h pcs/pcs_utils.h pcs/pcs_slist.h pcs/pcs_http.h pcs/cJSON.h pcs/pcs.h pcs/pcs_fileinfo.h pcs/pcs_pan_api_resinfo.h
$(CC) -o $@ -c $(PCS_CCFLAGS) pcs/pcs.c
bin/pcs_fileinfo.o: pcs/pcs_fileinfo.c pcs/pcs_mem.h pcs/pcs_defs.h pcs/pcs_utils.h pcs/pcs_slist.h pcs/pcs_fileinfo.h
$(CC) -o $@ -c $(PCS_CCFLAGS) pcs/pcs_fileinfo.c
bin/pcs_http.o: pcs/pcs_http.c pcs/pcs_mem.h pcs/pcs_defs.h pcs/pcs_utils.h pcs/pcs_slist.h pcs/pcs_http.h
$(CC) -o $@ -c $(PCS_CCFLAGS) pcs/pcs_http.c
bin/pcs_mem.o: pcs/pcs_mem.c pcs/pcs_defs.h
$(CC) -o $@ -c $(PCS_CCFLAGS) pcs/pcs_mem.c
bin/pcs_pan_api_resinfo.o: pcs/pcs_pan_api_resinfo.c pcs/pcs_mem.h pcs/pcs_defs.h pcs/pcs_pan_api_resinfo.h
$(CC) -o $@ -c $(PCS_CCFLAGS) pcs/pcs_pan_api_resinfo.c
bin/pcs_slist.o: pcs/pcs_slist.c pcs/pcs_mem.h pcs/pcs_defs.h pcs/pcs_slist.h
$(CC) -o $@ -c $(PCS_CCFLAGS) pcs/pcs_slist.c
bin/pcs_utils.o: pcs/pcs_utils.c pcs/pcs_mem.h pcs/pcs_defs.h pcs/pcs_utils.h pcs/pcs_slist.h
$(CC) -o $@ -c $(PCS_CCFLAGS) pcs/pcs_utils.c
.PHONY : install
install:
cp ./bin/pcs /usr/local/bin
.PHONY : clean
clean :
-rm ./bin/*.o ./bin/libpcs.a ./bin/pcs ./test/version.h
.PHONY : pre
pre :
mkdir -p bin/