11
22SHELL := bash
33
4+ # Build the vproxy binary (using go build)
45build : clean
56 go build ./bin/vproxy
7+ echo " built ./vproxy"
68
9+ # Build a snapshot (using goreleaser)
710snapshot : clean
811 goreleaser release --snapshot --clean
912
13+ # Install the generated homebrew formula into local homebrew tap
1014install-formula : snapshot
11- cp -a dist/homebrew/Formula/* .rb /usr/local/Homebrew/Library/Taps/jittering/homebrew-kegs/Formula/
15+ [ -z " $$ HOMEBREW_PREFIX" ] && echo " HOMEBREW_PREFIX is not set" && exit 1
16+ cp -a dist/homebrew/Formula/* .rb $$ {HOMEBREW_PREFIX}/Library/Taps/jittering/homebrew-kegs/Formula/
1217
18+ # Build for linux (x64) (for testing only, release uses goreleaser)
1319build-linux :
1420 GOOS=linux go build -o vproxy-linux-x64 ./bin/vproxy/
1521
22+ # Build for mac (x64) (for testing only, release uses goreleaser)
1623build-mac :
1724 GOOS=darwin go build -o vproxy-macos-x64 ./bin/vproxy/
1825
26+ # Build for windows (x64) (for testing only, release uses goreleaser)
1927build-windows :
2028 GOOS=windows go build -o vproxy-windows-x64 ./bin/vproxy/
2129
30+ # Release using goreleaser
2231release : clean
2332 goreleaser release --clean
2433
34+ # Check goreleaser config and generated homebrew formula style for errors
2535check-style :
2636 goreleaser check
2737 goreleaser --snapshot --skip-validate --clean
@@ -30,6 +40,7 @@ check-style:
3040 | grep -v Enabled | grep -v ' #' | grep -v ' ^$$' | tr ' :\n' ' ,' ); \
3141 brew style --display-cop-names --except-cops=" $$ {cops}" ./dist/* .rb;
3242
43+ # # Build and install into homebrew bin path, restart service
3344build-brew :
3445 go build -ldflags \
3546 " -X main.version=snapshot \
@@ -38,12 +49,27 @@ build-brew:
3849 -X main.builtBy=$$(whoami ) " \
3950 -o vproxy ./bin/vproxy/
4051
41- sudo mv vproxy /opt/homebrew /opt/vproxy/bin/vproxy
52+ sudo mv vproxy $${HOMEBREW_PREFIX} /opt/vproxy/bin/vproxy
4253 sudo pkill -f 'vproxy daemon'
4354
55+ # Clean build artifacts
4456clean :
4557 rm -f ./vproxy*
4658 rm -rf ./dist/
4759
60+ # Build and install to /usr/local/bin
4861install : build
4962 sudo cp -a ./vproxy /usr/local/bin/vproxy
63+
64+ help : # # Show make target help
65+ @ (grep -A1 ' ^#' $( MAKEFILE_LIST) \
66+ | grep -v ' ^--$$' \
67+ | while IFS= read -r line1 && IFS= read -r line2; do \
68+ if [[ " $$ line2" =~ ^[a-zA-Z_-]+:.* $$ ]]; then \
69+ echo " $$ line2 #$$ line1" ; \
70+ fi ; \
71+ done ; \
72+ grep -hE ' ^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST ) ) \
73+ | sort \
74+ | awk ' !seen[$$1]++' \
75+ | awk ' BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
0 commit comments