Skip to content
This repository
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 58 lines (43 sloc) 1.332 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57
SHELL=/bin/bash

DST_ID=avocadodb
REPO=git://github.com/triAGENS/AvocadoDB.git

# defaults
BASE_DIR=$(HOME)/_build/$(DST_ID)
DST_DIR=/usr/local/_build/$(DST_ID)

DB_DIR=/tmp/vocabase
PIDFILE=$(DST_DIR)/app.pid
LOGFILE=$(DST_DIR)/output.log
HISTORY=$(BASE_DIR)/latest-build-hash
LAST_BUILT_COMMIT=$(shell cat $(HISTORY))
LAST_COMMIT=$(shell git ls-remote $(REPO) | head -n 1 | awk '{print $$1}')

.PHONY: install update clone configure build all stop start

clone:
cd `dirname $(BASE_DIR)` && \
git clone $(REPO) $(DST_ID) || echo "Project already clonned"

update:
cd $(BASE_DIR) && \
git pull $(REPO)

@echo Checking for updated HEAD $(LAST_COMMIT)
if [[ "$(LAST_COMMIT)" == "$(LAST_BUILT_COMMIT)" ]]; then exit 1; fi

echo "$(LAST_COMMIT)" > $(HISTORY)
configure:
cd $(BASE_DIR) && ./configure --prefix=$(DST_DIR)

build:
cd $(BASE_DIR) && make

install:
cd $(BASE_DIR) && make install
cd $(BASE_DIR) && make clean

start:
@echo Cleaning up
[ -d "$(DB_DIR)" ] && rm -rf $(DB_DIR) || echo "Directory $(DB_DIR) already cleaned up"
mkdir $(DB_DIR)

@echo Starting...
bash -c '$(DST_DIR)/sbin/avocado $(DB_DIR) 1> $(LOGFILE) & echo $$! > $(PIDFILE) &'
@echo Started
@echo DB Dir: $(DB_DIR)
@echo Logs are in $(LOGFILE)
@echo PID File in $(PIDFILE)

stop:
kill `cat $(PIDFILE)`
@echo Stopped

all: clone update configure build install
Something went wrong with that request. Please try again.