-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathMakefile
109 lines (85 loc) · 2.2 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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
all: post sse
static:
STATIC=1 RELEASE=1 make clean all
release:
RELEASE=1 make clean all
debug:
make clean all
# set PLATFORM values. NOTE: this is not yet used.
PLATFORM=
# The URL for curl.
CURL_URL=http://curl.haxx.se/download/curl-7.28.0.tar.gz
# --- compile flags ---------------------------------------------------
CFLAGS=-Isrc
RFLAGS=-Os -DNDEBUG -Wall
DFLAGS=-g -Wall -Werror
ifeq ($(RELEASE),1)
CFLAGS:=$(CFLAGS) $(RFLAGS)
else
CFLAGS:=$(CFLAGS) $(DFLAGS)
endif
ifeq ($(STATIC),1)
CFLAGS:=$(CFLAGS) -I./curl/include
LFLAGS=-L./lib -lcurl -lcrypto -lssl -lz
else
LFLAGS=-lcurl
endif
# --- shortcuts -------------------------------------------------------
bin:
mkdir bin
tmp:
mkdir tmp
post: bin bin/post
sse: bin bin/sse
clean:
rm -rf bin/*
# --- binaries --------------------------------------------------------
bin/post: bin/sse
$(shell cd bin; ln -sf sse post)
bin/sse: src/main.c src/post.c src/sse.c src/tools.c src/http.c src/parse-sse.c
gcc $(CFLAGS) -o $@ $^ $(LFLAGS)
ifeq ($(RELEASE),1)
strip bin/sse
endif
src/parse-sse.c: src/parse-sse.fl
flex -I -o $@ $<
# --- libcurl --------------------------------------------------------
#
# This makefile is prepared to build a libcurl.a static library. To use
# it run "make static"
LIBCURL_CONFIG=--disable-debug \
--enable-optimize \
--enable-warnings \
--disable-curldebug \
--enable-symbol-hiding\
--disable-largefile \
--disable-shared \
--enable-http \
--disable-ftp \
--disable-file \
--disable-ldap \
--disable-ldaps \
--disable-rtsp \
--enable-proxy \
--disable-dict \
--disable-telnet \
--disable-tftp \
--disable-pop3 \
--disable-imap \
--disable-smtp \
--disable-gopher \
--disable-manual \
--enable-libcurl-option \
--disable-ipv6 \
--enable-verbose \
--enable-crypto-auth \
--enable-cookies
curl: tmp tmp/curl.tar.gz
tar xvfz tmp/curl.tar.gz
ln -sf curl-7.*.* curl
tmp/curl.tar.gz:
curl -o tmp/curl.tar.gz $(CURL_URL)
lib/libcurl.a: curl
cd curl && ./configure $(LIBCURL_CONFIG) && make
mkdir -p lib
cp curl/lib/.libs/libcurl.a lib