]> git.saurik.com Git - redis.git/blame_incremental - deps/hiredis/Makefile
show initial querybuf bytes on querybuf overflow.
[redis.git] / deps / hiredis / Makefile
... / ...
CommitLineData
1# Hiredis Makefile
2# Copyright (C) 2010 Salvatore Sanfilippo <antirez at gmail dot com>
3# This file is released under the BSD license, see the COPYING file
4
5OBJ = net.o hiredis.o sds.o async.o
6BINS = hiredis-example hiredis-test
7
8uname_S := $(shell sh -c 'uname -s 2>/dev/null || echo not')
9OPTIMIZATION?=-O3
10ifeq ($(uname_S),SunOS)
11 CFLAGS?=-std=c99 -pedantic $(OPTIMIZATION) -fPIC -Wall -W -D__EXTENSIONS__ -D_XPG6 $(ARCH) $(PROF)
12 CCLINK?=-ldl -lnsl -lsocket -lm -lpthread
13 LDFLAGS?=-L. -Wl,-R,.
14 DYLIBNAME?=libhiredis.so
15 DYLIB_MAKE_CMD?=$(CC) -G -o ${DYLIBNAME} ${OBJ}
16 STLIBNAME?=libhiredis.a
17 STLIB_MAKE_CMD?=ar rcs ${STLIBNAME} ${OBJ}
18else
19ifeq ($(uname_S),Darwin)
20 CFLAGS?=-std=c99 -pedantic $(OPTIMIZATION) -fPIC -Wall -W -Wstrict-prototypes -Wwrite-strings $(ARCH) $(PROF)
21 CCLINK?=-lm -pthread
22 LDFLAGS?=-L. -Wl,-rpath,.
23 OBJARCH?=-arch i386 -arch x86_64
24 DYLIBNAME?=libhiredis.dylib
25 DYLIB_MAKE_CMD?=libtool -dynamic -o ${DYLIBNAME} -lm ${DEBUG} - ${OBJ}
26 STLIBNAME?=libhiredis.a
27 STLIB_MAKE_CMD?=libtool -static -o ${STLIBNAME} - ${OBJ}
28else
29 CFLAGS?=-std=c99 -pedantic $(OPTIMIZATION) -fPIC -Wall -W -Wstrict-prototypes -Wwrite-strings $(ARCH) $(PROF)
30 CCLINK?=-lm -pthread
31 LDFLAGS?=-L. -Wl,-rpath,.
32 DYLIBNAME?=libhiredis.so
33 DYLIB_MAKE_CMD?=gcc -shared -Wl,-soname,${DYLIBNAME} -o ${DYLIBNAME} ${OBJ}
34 STLIBNAME?=libhiredis.a
35 STLIB_MAKE_CMD?=ar rcs ${STLIBNAME} ${OBJ}
36endif
37endif
38
39CCOPT= $(CFLAGS) $(CCLINK)
40DEBUG?= -g -ggdb
41
42PREFIX?= /usr/local
43INSTALL_INC= $(PREFIX)/include/hiredis
44INSTALL_LIB= $(PREFIX)/lib
45INSTALL= cp -a
46
47all: ${DYLIBNAME} ${BINS}
48
49# Deps (use make dep to generate this)
50net.o: net.c fmacros.h net.h
51async.o: async.c async.h hiredis.h sds.h util.h dict.c dict.h
52example.o: example.c hiredis.h
53hiredis.o: hiredis.c hiredis.h net.h sds.h util.h
54sds.o: sds.c sds.h
55test.o: test.c hiredis.h
56
57${DYLIBNAME}: ${OBJ}
58 ${DYLIB_MAKE_CMD}
59
60${STLIBNAME}: ${OBJ}
61 ${STLIB_MAKE_CMD}
62
63dynamic: ${DYLIBNAME}
64static: ${STLIBNAME}
65
66# Binaries:
67hiredis-example-libevent: example-libevent.c adapters/libevent.h ${DYLIBNAME}
68 $(CC) -o $@ $(CCOPT) $(DEBUG) $(LDFLAGS) -lhiredis -levent example-libevent.c
69
70hiredis-example-libev: example-libev.c adapters/libev.h ${DYLIBNAME}
71 $(CC) -o $@ $(CCOPT) $(DEBUG) $(LDFLAGS) -lhiredis -lev example-libev.c
72
73ifndef AE_DIR
74hiredis-example-ae:
75 @echo "Please specify AE_DIR (e.g. <redis repository>/src)"
76 @false
77else
78hiredis-example-ae: example-ae.c adapters/ae.h ${DYLIBNAME}
79 $(CC) -o $@ $(CCOPT) $(DEBUG) -I$(AE_DIR) $(LDFLAGS) -lhiredis example-ae.c $(AE_DIR)/ae.o $(AE_DIR)/zmalloc.o
80endif
81
82hiredis-%: %.o ${DYLIBNAME}
83 $(CC) -o $@ $(CCOPT) $(DEBUG) $(LDFLAGS) -lhiredis $<
84
85test: hiredis-test
86 ./hiredis-test
87
88.c.o:
89 $(CC) -c $(CFLAGS) $(OBJARCH) $(DEBUG) $(COMPILE_TIME) $<
90
91clean:
92 rm -rf ${DYLIBNAME} ${STLIBNAME} $(BINS) hiredis-example* *.o *.gcda *.gcno *.gcov
93
94dep:
95 $(CC) -MM *.c
96
97install: ${DYLIBNAME} ${STLIBNAME}
98 mkdir -p $(INSTALL_INC) $(INSTALL_LIB)
99 $(INSTALL) hiredis.h async.h adapters $(INSTALL_INC)
100 $(INSTALL) ${DYLIBNAME} ${STLIBNAME} $(INSTALL_LIB)
101
10232bit:
103 @echo ""
104 @echo "WARNING: if it fails under Linux you probably need to install libc6-dev-i386"
105 @echo ""
106 $(MAKE) ARCH="-m32"
107
108gprof:
109 $(MAKE) PROF="-pg"
110
111gcov:
112 $(MAKE) PROF="-fprofile-arcs -ftest-coverage"
113
114noopt:
115 $(MAKE) OPTIMIZATION=""