diff options
author | Pieter Noordhuis <pcnoordhuis@gmail.com> | 2011-11-15 12:40:49 -0800 |
---|---|---|
committer | Pieter Noordhuis <pcnoordhuis@gmail.com> | 2011-11-15 12:41:35 -0800 |
commit | 4b8a63941dc360a0d2dcba1ec182a006221e4a20 (patch) | |
tree | 484c0e192ffe36f59ef19440980683e93f15d9f3 /deps/Makefile | |
parent | 321a0440c0dde3ea00a72da0751fd7beb8f9bb93 (diff) | |
download | redis-4b8a63941dc360a0d2dcba1ec182a006221e4a20.tar.gz |
Rebuild deps/ and src/ when ARCH changes
This change moves the build instructions for dependencies to a separate
Makefile in deps/. The ARCH environment variable is stored in a
.make-arch file in the same directory as the Makefile. The contents of
this file is read and compared to the current ARCH, and, on a mismatch
triggers rebuilding the entire source tree.
When file .make-arch exists and matches with ARCH from the environment,
the dependencies are assumed to already be built.
The new "clean" target only cleans the Redis source tree, not its
dependencies. To clear the dependencies as well, the "distclean" target
can be used.
Diffstat (limited to 'deps/Makefile')
-rw-r--r-- | deps/Makefile | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/deps/Makefile b/deps/Makefile new file mode 100644 index 000000000..b881c814e --- /dev/null +++ b/deps/Makefile @@ -0,0 +1,59 @@ +# 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 + +CCCOLOR="\033[34m" +LINKCOLOR="\033[34;1m" +SRCCOLOR="\033[33m" +BINCOLOR="\033[37;1m" +MAKECOLOR="\033[32;1m" +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: +endif + +.make-arch: + -(echo $(ARCH) > .make-arch) + +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) + +hiredis: .make-arch + @printf '%b %b\n' $(MAKECOLOR)MAKE$(ENDCOLOR) $(BINCOLOR)hiredis$(ENDCOLOR) + cd hiredis && $(MAKE) static ARCH="$(ARCH)" + +linenoise: .make-arch + @printf '%b %b\n' $(MAKECOLOR)MAKE$(ENDCOLOR) $(BINCOLOR)linenoise$(ENDCOLOR) + cd linenoise && $(MAKE) ARCH="$(ARCH)" + +lua: .make-arch + @printf '%b %b\n' $(MAKECOLOR)MAKE$(ENDCOLOR) $(BINCOLOR)lua$(ENDCOLOR) + cd lua && $(MAKE) CFLAGS="$(LUA_CFLAGS)" MYLDFLAGS="$(ARCH)" ansi + +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 + +.PHONY: default conditional_clean hiredis linenoise lua jemalloc |