-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
70 lines (56 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
OBJS= echttp.o \
echttp_static.o \
echttp_cors.o \
echttp_tls.o \
echttp_raw.o \
echttp_hash.o \
echttp_sorted.o \
echttp_catalog.o \
echttp_encoding.o \
echttp_option.o \
echttp_json.o \
echttp_xml.o \
echttp_parser.o
PUBLIC_INCLUDE=echttp.h \
echttp_encoding.h \
echttp_catalog.h \
echttp_hash.h \
echttp_sorted.h \
echttp_static.h \
echttp_cors.h \
echttp_json.h \
echttp_xml.h \
echttp_parser.h
all: libechttp.a echttp_print echttp_get
dev:
mkdir -p /usr/local/lib
cp libechttp.a /usr/local/lib
chown root:root /usr/local/lib/libechttp.a
chmod 644 /usr/local/lib/libechttp.a
mkdir -p /usr/local/include
cp $(PUBLIC_INCLUDE) /usr/local/include
chown root:root /usr/local/include/echttp*.h
chmod 644 /usr/local/include/echttp*.h
cp echttp_print echttp_get /usr/local/bin
chown root:root /usr/local/bin/echttp_*
chmod 755 /usr/local/bin/echttp_*
install: dev
clean:
rm -f *.o *.a echttp_print echttp_get
rm -f echttp_jsonprint echttp_jsonget
rebuild: clean all
uninstall:
rm -f /usr/local/lib/libechttp.a
rm -f /usr/local/include/echttp*.h
rm -f /usr/local/bin/echttp_print /usr/local/bin/echttp_get
rm -f /usr/local/bin/echttp_jsonprint /usr/local/bin/echttp_jsonget
purge: uninstall
%.o: %.c
gcc -c -Os -fPIC -o $@ $<
libechttp.a: $(OBJS)
ar r $@ $^
ranlib $@
echttp_print: echttp_print.o libechttp.a
gcc -Os -fPIC -o $@ echttp_print.o libechttp.a
echttp_get: echttp_get.o libechttp.a
gcc -Os -fPIC -o $@ echttp_get.o libechttp.a