summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Crute <mike@crute.us>2023-08-03 13:35:20 -0700
committerMike Crute <mike@crute.us>2023-08-03 13:35:20 -0700
commit42ca26235a2303e75d549db5fc1a735583e09c73 (patch)
tree8ab048250a3c402cffa134c7383654d0ca7e4e8a
parentb9d3742fc6312b7495baa0a6c318f2f9d673848b (diff)
downloadwebsocket_proxy-42ca26235a2303e75d549db5fc1a735583e09c73.tar.bz2
websocket_proxy-42ca26235a2303e75d549db5fc1a735583e09c73.tar.xz
websocket_proxy-42ca26235a2303e75d549db5fc1a735583e09c73.zip
Cleanup Makefile
-rw-r--r--Makefile45
1 files changed, 25 insertions, 20 deletions
diff --git a/Makefile b/Makefile
index 6baad7f..a0196b1 100644
--- a/Makefile
+++ b/Makefile
@@ -1,16 +1,20 @@
1IMAGE=docker.crute.me/ssh-proxy 1IMAGE=docker.crute.me/ssh-proxy
2BINARY=ssh-proxy 2SERVER_BINARY=ssh-proxy
3CLIENT_BINARY=ssh-proxy-client 3CLIENT_BINARY=client
4 4
5$(BINARY): $(CLIENT_BINARY) $(shell find . -name '*.go' -o -name '*.tpl' -o -name '*.js') 5SERVER_FILES := $(shell find . -name '*.go' -o -name '*.tpl' -o -name '*.js')
6 @[ "$(CLIENT_ID)" ] || ( echo "CLIENT_ID must be set"; exit 1 ) 6CLIENT_FILES := $(shell find . -name '*.go')
7 7
8$(SERVER_BINARY): $(SERVER_FILES)
9 @mkdir clients/ || true
10 @touch clients/keep
8 CGO_ENABLED=0 go build \ 11 CGO_ENABLED=0 go build \
9 -ldflags "-X main.appVersion=$(shell git describe --long --tags --dirty --always) \ 12 -ldflags "-X main.appVersion=$(shell git describe --long --tags --dirty --always) \
10 -X code.crute.us/mcrute/ssh-proxy/cmd/client.clientId=$(CLIENT_ID)" \ 13 -X code.crute.us/mcrute/ssh-proxy/cmd/client.clientId=$(CLIENT_ID)" \
11 -o $@ 14 -o $@
12 15
13$(CLIENT_BINARY): $(shell find . -name '*.go') 16.PHONY: client
17client:
14 @[ "$(CLIENT_ID)" ] || ( echo "CLIENT_ID must be set"; exit 1 ) 18 @[ "$(CLIENT_ID)" ] || ( echo "CLIENT_ID must be set"; exit 1 )
15 19
16 CGO_ENABLED=0 go build \ 20 CGO_ENABLED=0 go build \
@@ -18,15 +22,24 @@ $(CLIENT_BINARY): $(shell find . -name '*.go')
18 -ldflags "-X main.appVersion=$(shell git describe --long --tags --dirty --always) \ 22 -ldflags "-X main.appVersion=$(shell git describe --long --tags --dirty --always) \
19 -X code.crute.us/mcrute/ssh-proxy/cmd/client.clientId=$(CLIENT_ID) \ 23 -X code.crute.us/mcrute/ssh-proxy/cmd/client.clientId=$(CLIENT_ID) \
20 -s -w" \ 24 -s -w" \
21 -o $@ 25 -o $(OUTFILE)
26
27clients/$(CLIENT_BINARY)-x86_64: $(CLIENT_FILES)
28 GOARCH=amd64 OUTFILE=$@ $(MAKE) client
29
30clients/$(CLIENT_BINARY)-arm64: $(CLIENT_FILES)
31 GOARCH=arm64 OUTFILE=$@ $(MAKE) client
32
33.PHONY: release
34release: clients/$(CLIENT_BINARY)-x86_64 clients/$(CLIENT_BINARY)-arm64 $(SERVER_BINARY)
22 35
23.PHONY: vet 36.PHONY: vet
24vet: main.go 37vet: main.go
25 go vet $< 38 go vet $<
26 39
27.PHONY: docker 40.PHONY: docker
28docker: $(BINARY) 41docker: $(SERVER_BINARY)
29 mkdir docker; cp Dockerfile $(BINARY) docker; cd docker; \ 42 mkdir docker; cp Dockerfile $(SERVER_BINARY) docker; cd docker; \
30 docker pull $(shell grep '^FROM ' Dockerfile | cut -d' ' -f2); \ 43 docker pull $(shell grep '^FROM ' Dockerfile | cut -d' ' -f2); \
31 docker build --no-cache -t $(IMAGE):stage . 44 docker build --no-cache -t $(IMAGE):stage .
32 45
@@ -41,23 +54,15 @@ publish-prod:
41 54
42.PHONY: clean 55.PHONY: clean
43clean: 56clean:
44 rm -rf docker || true 57 rm -rf docker clients || true
45 rm $(BINARY) || true 58 rm $(SERVER_BINARY) || true
46
47.PHONY: run-backfill
48run-backfill: clean $(BINARY)
49 test -n "$(VAULT_ROLE_ID)" # Caller must export VAULT_ROLE_ID
50 test -n "$(VAULT_SECRET_ID)" # Caller must also export VAULT_SECRET_ID
51 VAULT_ADDR="https://vault.sea4.crute.me:8200" \
52 VAULT_SKIP_VERIFY=true \
53 ./web-server backfill-shakes
54 59
55.PHONY: run-web 60.PHONY: run-web
56run-web: clean $(BINARY) 61run-web: clean $(SERVER_BINARY)
57 test -n "$(VAULT_ROLE_ID)" # Caller must export VAULT_ROLE_ID 62 test -n "$(VAULT_ROLE_ID)" # Caller must export VAULT_ROLE_ID
58 test -n "$(VAULT_SECRET_ID)" # Caller must also export VAULT_SECRET_ID 63 test -n "$(VAULT_SECRET_ID)" # Caller must also export VAULT_SECRET_ID
59 VAULT_ADDR="https://vault.sea4.crute.me:8200" \ 64 VAULT_ADDR="https://vault.sea4.crute.me:8200" \
60 VAULT_SKIP_VERIFY=true \ 65 VAULT_SKIP_VERIFY=true \
61 ./$(BINARY) \ 66 ./$(SERVER_BINARY) \
62 --hostname=dev.ssh-proxy.crute.me \ 67 --hostname=dev.ssh-proxy.crute.me \
63 web 68 web