-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
45 lines (33 loc) · 1.26 KB
/
Makefile
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
42
43
44
45
include Makefile.in
SRC := $(shell find . -name '*.go' -type f)
.PHONY: all clean test run build upgrade help
all: # default action
@pre-commit install --install-hooks
@git config commit.template .git-commit-template
clean: # clean-up environment
@find . -name '*.sw[po]' -delete
@rm -f pwnpi
test: # run test
go mod tidy
gofmt -s -w $(SRC)
go test -v ./...
run: # run in the local environment
go mod tidy
go run cmd/pwnpi/main.go
build: # build the binary/library
go build -ldflags "-s -w" -o pwnpi cmd/pwnpi/main.go
upgrade: # upgrade all the necessary packages
pre-commit autoupdate
help: # show this message
@printf "Usage: make [OPTION]\n"
@printf "\n"
@perl -nle 'print $$& if m{^[\w-]+:.*?#.*$$}' $(MAKEFILE_LIST) | \
awk 'BEGIN {FS = ":.*?#"} {printf " %-18s %s\n", $$1, $$2}'
.PHONY: prologue install
SSH_PUBLIC_KEY := ~/.ssh/id_ed25519.pub
prologue: # setup everything before access your PwnPi
@ssh-copy-id -i $(SSH_PUBLIC_KEY) $(USERNAME)@$(HOSTNAME)
install: # sync and instal the package to your PwnPi
env GOOS=linux GOARCH=arm GOARM=7 go build -ldflags "-s -w" -o pwnpi cmd/pwnpi/main.go
rsync --progress pwnpi $(USERNAME)@$(HOSTNAME):~
ssh $(USERNAME)@$(HOSTNAME) "sudo mv ~/pwnpi /usr/local/bin/pwnpi && sudo pwnpi install -vv"