# Copyright (C) 2009 Salvatore Sanfilippo <antirez at gmail dot com>
# This file is released under the BSD license, see the COPYING file
+uname_S := $(shell sh -c 'uname -s 2>/dev/null || echo not')
+ifeq ($(uname_S),SunOS)
+ CFLAGS?= -std=c99 -pedantic -O2 -Wall -W -D__EXTENSIONS__ -D_XPG6
+ CCLINK?= -ldl -lnsl -lsocket -lm
+else
+ CFLAGS?= -std=c99 -pedantic -O2 -Wall -W $(ARCH) $(PROF)
+ CCLINK?= -lm
+endif
+CCOPT= $(CFLAGS) $(CCLINK) $(ARCH) $(PROF)
DEBUG?= -g -rdynamic -ggdb
-CFLAGS?= -std=c99 -O2 -pedantic -Wall -W
-CCOPT= $(CFLAGS)
OBJ = adlist.o ae.o anet.o dict.o redis.o sds.o zmalloc.o lzf_c.o lzf_d.o pqsort.o
BENCHOBJ = ae.o anet.o benchmark.o sds.o adlist.o zmalloc.o
$(CC) -o $(CLIPRGNAME) $(CCOPT) $(DEBUG) $(CLIOBJ)
.c.o:
- $(CC) -c $(CCOPT) $(DEBUG) $(COMPILE_TIME) $<
+ $(CC) -c $(CFLAGS) $(DEBUG) $(COMPILE_TIME) $<
clean:
rm -rf $(PRGNAME) $(BENCHPRGNAME) $(CLIPRGNAME) *.o
dep:
$(CC) -MM *.c
+staticsymbols:
+ tclsh utils/build-static-symbols.tcl > staticsymbols.h
+
test:
tclsh test-redis.tcl
log:
git log '--pretty=format:%ad %s' --date=short > Changelog
+
+32bit:
+ make ARCH="-arch i386"
+
+gprof:
+ make PROF="-pg"
+
+32bitgprof:
+ make PROF="-pg" ARCH="-arch i386"