From 0163145b5bbe2e2583dc2f1b3545c7f13d84c9e7 Mon Sep 17 00:00:00 2001 From: Sergey Yelin Date: Mon, 18 Jul 2011 10:59:48 +0400 Subject: [PATCH] Auto download Berkeley DB from Oralce then needed --- Makefile | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index a4845c1..62ad2ac 100644 --- a/Makefile +++ b/Makefile @@ -1,8 +1,25 @@ -all: c_src/system/lib/libdb.a - ./rebar compile eunit ct +BDB_VERSION=5.1.25 +BDB_DIST=db-$(BDB_VERSION).tar.gz +BDB_LOCAL_DIST=c_src/$(BDB_DIST) +BDB_LOCAL_LIB=c_src/system/lib/libdb.a +BDB_DIST_URL=http://download.oracle.com/berkeley-db/$(BDB_DIST) -c_src/system/lib/libdb.a: +ERL = erl +REBAR = ./rebar +REBAR_FLAGS= + +all: $(BDB_LOCAL_LIB) + $(REBAR) $(REBAR_FLAGS) compile eunit ct + +$(BDB_LOCAL_DIST): + $(ERL) -noshell -s inets -eval 'httpc:request(get, {"$(BDB_DIST_URL)", []}, [], [{stream, "$(BDB_LOCAL_DIST)"}])' -s init stop + +$(BDB_LOCAL_LIB): $(BDB_LOCAL_DIST) c_src/buildlib.sh clean: - ./rebar clean + $(REBAR) $(REBAR_FLAGS) clean +distclean: clean + -rm -rf $(BDB_LOCAL_DIST) + -rm -rf c_src/sources + -rm -rf priv