summaryrefslogtreecommitdiff
path: root/deps
diff options
context:
space:
mode:
authorPieter Noordhuis <pcnoordhuis@gmail.com>2012-03-24 19:25:03 -0700
committerantirez <antirez@gmail.com>2012-04-11 11:24:17 +0200
commit0a08d2b0e5d2e8a0cbaf7bbf712799ae2778a57a (patch)
tree84c2efd22e07ce11c6f6496c57cfe10f3d8add6a /deps
parent3f7438ef9b969aa4bb90445b51fd93652a377ea0 (diff)
downloadredis-0a08d2b0e5d2e8a0cbaf7bbf712799ae2778a57a.tar.gz
Clean up Makefiles
Remove unused variables. Instead of overriding non-standard variables such as ARCH and PROF, use standard variables CFLAGS and LDFLAGS to override Makefile settings. Move dependencies generated by `make dep` to a separate file.
Diffstat (limited to 'deps')
-rw-r--r--deps/Makefile85
-rw-r--r--deps/linenoise/Makefile17
2 files changed, 66 insertions, 36 deletions
diff --git a/deps/Makefile b/deps/Makefile
index b881c814e..7cd9c0f64 100644
--- a/deps/Makefile
+++ b/deps/Makefile
@@ -1,17 +1,6 @@
# Redis dependency Makefile
-UNAME_S:=$(shell sh -c 'uname -s 2> /dev/null || echo not')
-
-LUA_CFLAGS=-O2 -Wall $(ARCH)
-ifeq ($(UNAME_S),SunOS)
- # Make isinf() available
- LUA_CFLAGS+= -D__C99FEATURES__=1
-endif
-
-JEMALLOC_CFLAGS=
-ifeq ($(ARCH),-m32)
- JEMALLOC_CFLAGS+=CFLAGS="-std=gnu99 -Wall -pipe -g3 -fvisibility=hidden -O3 -funroll-loops -m32"
-endif
+uname_S:= $(shell sh -c 'uname -s 2>/dev/null || echo not')
CCCOLOR="\033[34m"
LINKCOLOR="\033[34;1m"
@@ -23,37 +12,67 @@ ENDCOLOR="\033[0m"
default:
@echo "Explicit target required"
-# Clean everything when ARCH is different
-ifneq ($(shell sh -c '[ -f .make-arch ] && cat .make-arch'), $(ARCH))
-.make-arch: distclean
-else
-.make-arch:
+.PHONY: default
+
+# Prerequisites target
+.make-prerequisites:
+ @touch $@
+
+# Clean everything when CFLAGS is different
+ifneq ($(shell sh -c '[ -f .make-cflags ] && cat .make-cflags || echo none'), $(CFLAGS))
+.make-cflags: distclean
+ -(echo "$(CFLAGS)" > .make-cflags)
+.make-prerequisites: .make-cflags
endif
-.make-arch:
- -(echo $(ARCH) > .make-arch)
+# Clean everything when LDFLAGS is different
+ifneq ($(shell sh -c '[ -f .make-ldflags ] && cat .make-ldflags || echo none'), $(LDFLAGS))
+.make-ldflags: distclean
+ -(echo "$(LDFLAGS)" > .make-ldflags)
+.make-prerequisites: .make-ldflags
+endif
distclean:
-(cd hiredis && $(MAKE) clean) > /dev/null || true
-(cd linenoise && $(MAKE) clean) > /dev/null || true
-(cd lua && $(MAKE) clean) > /dev/null || true
-(cd jemalloc && [ -f Makefile ] && $(MAKE) distclean) > /dev/null || true
- -(rm -f .make-arch)
+ -(rm -f .make-*)
+
+.PHONY: distclean
+
+hiredis: .make-prerequisites
+ @printf '%b %b\n' $(MAKECOLOR)MAKE$(ENDCOLOR) $(BINCOLOR)$@$(ENDCOLOR)
+ cd hiredis && $(MAKE) static
+
+.PHONY: hiredis
+
+linenoise: .make-prerequisites
+ @printf '%b %b\n' $(MAKECOLOR)MAKE$(ENDCOLOR) $(BINCOLOR)$@$(ENDCOLOR)
+ cd linenoise && $(MAKE)
+
+.PHONY: linenoise
+
+ifeq ($(uname_S),SunOS)
+ # Make isinf() available
+ LUA_CFLAGS= -D__C99FEATURES__=1
+endif
+
+LUA_CFLAGS+= -O2 -Wall -DLUA_ANSI $(CFLAGS)
+LUA_LDFLAGS+= $(LDFLAGS)
-hiredis: .make-arch
- @printf '%b %b\n' $(MAKECOLOR)MAKE$(ENDCOLOR) $(BINCOLOR)hiredis$(ENDCOLOR)
- cd hiredis && $(MAKE) static ARCH="$(ARCH)"
+lua: .make-prerequisites
+ @printf '%b %b\n' $(MAKECOLOR)MAKE$(ENDCOLOR) $(BINCOLOR)$@$(ENDCOLOR)
+ cd lua/src && $(MAKE) all CFLAGS="$(LUA_CFLAGS)" MYLDFLAGS="$(LUA_LDFLAGS)"
-linenoise: .make-arch
- @printf '%b %b\n' $(MAKECOLOR)MAKE$(ENDCOLOR) $(BINCOLOR)linenoise$(ENDCOLOR)
- cd linenoise && $(MAKE) ARCH="$(ARCH)"
+.PHONY: lua
-lua: .make-arch
- @printf '%b %b\n' $(MAKECOLOR)MAKE$(ENDCOLOR) $(BINCOLOR)lua$(ENDCOLOR)
- cd lua && $(MAKE) CFLAGS="$(LUA_CFLAGS)" MYLDFLAGS="$(ARCH)" ansi
+JEMALLOC_CFLAGS= -std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops $(CFLAGS)
+JEMALLOC_LDFLAGS= $(LDFLAGS)
-jemalloc: .make-arch
- @printf '%b %b\n' $(MAKECOLOR)MAKE$(ENDCOLOR) $(BINCOLOR)jemalloc$(ENDCOLOR)
- cd jemalloc && ./configure $(JEMALLOC_CFLAGS) --with-jemalloc-prefix=je_ --enable-cc-silence && $(MAKE) lib/libjemalloc.a
+jemalloc: .make-prerequisites
+ @printf '%b %b\n' $(MAKECOLOR)MAKE$(ENDCOLOR) $(BINCOLOR)$@$(ENDCOLOR)
+ cd jemalloc && ./configure --with-jemalloc-prefix=je_ --enable-cc-silence CFLAGS="$(JEMALLOC_CFLAGS)" LDFLAGS="$(JEMALLOC_LDFLAGS)"
+ cd jemalloc && $(MAKE) lib/libjemalloc.a
-.PHONY: default conditional_clean hiredis linenoise lua jemalloc
+.PHONY: jemalloc
diff --git a/deps/linenoise/Makefile b/deps/linenoise/Makefile
index 841f39072..1dd894b49 100644
--- a/deps/linenoise/Makefile
+++ b/deps/linenoise/Makefile
@@ -1,10 +1,21 @@
-linenoise_example: linenoise.h linenoise.c
+STD=
+WARN= -Wall
+OPT= -Os
+
+R_CFLAGS= $(STD) $(WARN) $(OPT) $(DEBUG) $(CFLAGS)
+R_LDFLAGS= $(LDFLAGS)
+DEBUG= -g
+
+R_CC=$(CC) $(R_CFLAGS)
+R_LD=$(CC) $(R_LDFLAGS)
+
+linenoise.o: linenoise.h linenoise.c
linenoise_example: linenoise.o example.o
- $(CC) $(ARCH) -Wall -W -Os -g -o linenoise_example linenoise.o example.o
+ $(R_LD) -o $@ $^
.c.o:
- $(CC) $(ARCH) -c -Wall -W -Os -g $<
+ $(R_CC) -c $<
clean:
rm -f linenoise_example *.o