# Copyright (C) 2009 Salvatore Sanfilippo <antirez at gmail dot com>
# This file is released under the BSD license, see the COPYING file
-DEBUG?= -g
-CFLAGS?= -std=c99 -pedantic -O2 -Wall -W -DSDS_ABORT_ON_OOM
-CCOPT= $(CFLAGS)
+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)
+ CCLINK?= -lm
+endif
+CCOPT= $(CFLAGS) $(CCLINK) $(ARCH)
+DEBUG?= -g -rdynamic -ggdb
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
log:
git log '--pretty=format:%ad %s' --date=short > Changelog
+
+32bit:
+ make ARCH="-arch i386"