mirror of https://gitee.com/bigwinds/arangodb
58 lines
1.3 KiB
Makefile
58 lines
1.3 KiB
Makefile
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
|