From da0cbb7d379fd5440993223094976d76f7b06f58 Mon Sep 17 00:00:00 2001 From: Sebastien Douheret Date: Fri, 12 May 2017 12:01:45 +0200 Subject: Add install rule Installation directory can be changed using INSTALL_DIR and INSTALL_WEBAPP_DIR env variables Signed-off-by: Sebastien Douheret --- Makefile | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/Makefile b/Makefile index b6c8a30..5fb3204 100644 --- a/Makefile +++ b/Makefile @@ -8,6 +8,13 @@ ifeq ($(origin VERSION), undefined) endif endif +# Configurable variables for installation (default /usr/local/...) +ifeq ($(origin INSTALL_DIR), undefined) + INSTALL_DIR := /usr/local/bin +endif +ifeq ($(origin INSTALL_WEBAPP_DIR), undefined) + INSTALL_WEBAPP_DIR := ${INSTALL_DIR}/xds-server-www +endif HOST_GOOS=$(shell go env GOOS) HOST_GOARCH=$(shell go env GOARCH) @@ -76,21 +83,9 @@ webapp/install: (cd webapp && npm install) -# FIXME - package webapp -release: releasetar - goxc -d ./release -tasks-=go-vet,go-test -os="linux darwin" -pv=$(VERSION) -arch="386 amd64 arm arm64" -build-ldflags="-X main.AppVersionGitTag=$(VERSION)" -resources-include="README.md,Documentation,LICENSE,contrib" -main-dirs-exclude="vendor" - -releasetar: - mkdir -p release/$(VERSION) - glide install --strip-vcs --strip-vendor --update-vendored --delete - glide-vc --only-code --no-tests --keep="**/*.json.in" - git ls-files > /tmp/xds-server-build - find vendor >> /tmp/xds-server-build - find webapp/ -path webapp/node_modules -prune -o -print >> /tmp/xds-server-build - tar -cvf release/$(VERSION)/xds-server_$(VERSION)_src.tar -T /tmp/xds-server-build --transform 's,^,xds-server_$(VERSION)/,' - rm /tmp/xds-server-build - gzip release/$(VERSION)/xds-server_$(VERSION)_src.tar - +install: all + mkdir -p ${INSTALL_DIR} && cp bin/xds-server ${INSTALL_DIR} + mkdir -p ${INSTALL_WEBAPP_DIR} && cp -a webapp/dist/* ${INSTALL_WEBAPP_DIR} vendor: tools/glide glide.yaml ./tools/glide install --strip-vendor -- cgit 1.2.3-korg