summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorNick Thomas <nick@gitlab.com>2021-07-01 13:26:48 +0100
committerNick Thomas <nick@gitlab.com>2021-07-01 13:47:38 +0100
commitc289756d4ee4cb11fc41dc5ac7aafe19bfc12b92 (patch)
tree263b4ece854a5ad7123528e3e4fab92aa6adce73 /Makefile
parent1a299b07881096ae7e5f5190687d2d6318662219 (diff)
downloadgitlab-shell-c289756d4ee4cb11fc41dc5ac7aafe19bfc12b92.tar.gz
Add a make install command
Changelog: added
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile17
1 files changed, 14 insertions, 3 deletions
diff --git a/Makefile b/Makefile
index 9e4abba..88daed3 100644
--- a/Makefile
+++ b/Makefile
@@ -1,4 +1,4 @@
-.PHONY: validate verify verify_ruby verify_golang test test_ruby test_golang coverage coverage_golang setup _install build compile check clean
+.PHONY: validate verify verify_ruby verify_golang test test_ruby test_golang coverage coverage_golang setup _script_install build compile check clean install
GO_SOURCES := $(shell find . -name '*.go')
VERSION_STRING := $(shell git describe --match v* 2>/dev/null || awk '$0="v"$0' VERSION 2>/dev/null || echo unknown)
@@ -6,6 +6,8 @@ BUILD_TIME := $(shell date -u +%Y%m%d.%H%M%S)
BUILD_TAGS := tracer_static tracer_static_jaeger continuous_profiler_stackdriver
GOBUILD_FLAGS := -ldflags "-X main.Version=$(VERSION_STRING) -X main.BuildTime=$(BUILD_TIME)" -tags "$(BUILD_TAGS)"
+PREFIX ?= /usr/local
+
validate: verify test
verify: verify_golang
@@ -30,9 +32,9 @@ coverage: coverage_golang
coverage_golang:
[ -f cover.out ] && go tool cover -func cover.out
-setup: _install bin/gitlab-shell
+setup: _script_install bin/gitlab-shell
-_install:
+_script_install:
bin/install
build: bin/gitlab-shell
@@ -45,3 +47,12 @@ check:
clean:
rm -f bin/check bin/gitlab-shell bin/gitlab-shell-authorized-keys-check bin/gitlab-shell-authorized-principals-check bin/gitlab-sshd
+
+install: compile
+ mkdir -p $(DESTDIR)$(PREFIX)/bin/
+ install -m755 bin/check $(DESTDIR)$(PREFIX)/bin/check
+ install -m755 bin/gitlab-shell $(DESTDIR)$(PREFIX)/bin/gitlab-shell
+ install -m755 bin/gitlab-shell $(DESTDIR)$(PREFIX)/bin/gitlab-shell-authorized-keys-check
+ install -m755 bin/gitlab-shell $(DESTDIR)$(PREFIX)/bin/gitlab-shell-authorized-principals-check
+ install -m755 bin/gitlab-shell $(DESTDIR)$(PREFIX)/bin/gitlab-sshd
+