-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
41 lines (29 loc) · 964 Bytes
/
Makefile
File metadata and controls
41 lines (29 loc) · 964 Bytes
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
include .env
export $(shell sed 's/=.*//' .env)
SHELL = bash
LINUX := linux/amd64
OSX := darwin/amd64
PLATFORMS := $(LINUX) $(OSX)
# reverse list of words e.g. "foo baz bar" => "bar baz foo"
reverse = $(if $(1),$(call reverse,$(wordlist 2,$(words $(1)),$(1)))) $(firstword $(1))
last_word = $(words $(temp))
temp = $(subst /, ,$@)
os = $(word 2, $(call reverse,$(temp)))
arch = $(word $(last_word), $(temp))
.PHONY: test, bench, build, clean
clean:
rm build/*
test:
go test -v .
bench:
go test -bench .
build: $(PLATFORMS)
$(PLATFORMS):
GOOS=$(os) GOARCH=$(arch) go build -o build/'$(os)-$(arch)'
rollout: $(LINUX) rollout/$(LINUX)
$(addprefix rollout/, $(PLATFORMS)):
scp build/$(os)-$(arch) root@$(HOST):/usr/sbin/licenser-server
ssh root@$(HOST) mkdir -p /etc/licenser-server/
scp -r templates root@$(HOST):/etc/licenser-server/
scp .env root@$(HOST):/etc/licenser-server/
scp misc/licenser-server.service root@$(HOST):/etc/systemd/system/