This repository has been archived by the owner on Jul 22, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
39 lines (39 loc) · 1.74 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
build:
go build -ldflags "-X github.com/IBM/db2ctl/cmd.gitCommitHash=`git rev-parse HEAD` -X github.com/IBM/db2ctl/cmd.buildTime=`date -u '+%Y-%m-%d--%H:%M:%S%p'` -X github.com/IBM/db2ctl/cmd.gitBranch=`git branch --show-current` -X github.com/IBM/db2ctl/cmd.tagVersion=`git describe --tags --long`" -o bin/db2ctl main.go
build-w-clean: clean build
build-linux: # example: make build-linux DB_PATH=/dir/to/db
env GOOS=linux GOARCH=amd64 go build -ldflags "-X github.com/IBM/db2ctl/internal/command.stateDBPathFromEnv=/tmp -X github.com/IBM/db2ctl/internal/command.logDirPathFromEnv=/var/log/IBM/db2ctl -X github.com/IBM/db2ctl/cmd.gitCommitHash=`git rev-parse HEAD` -X github.com/IBM/db2ctl/cmd.buildTime=`date -u '+%Y-%m-%d--%H:%M:%S%p'` -X github.com/IBM/db2ctl/cmd.gitBranch=`git branch --show-current` -X github.com/IBM/db2ctl/cmd.tagVersion=`git describe --tags --long`" -o bin/db2ctl main.go
send-linux: install build-linux
scp bin/db2ctl root@p01.zinox.com:/usr/local/bin
clean:
rm -f bin/db2ctl
rm -rf generated
rm -rf logs
rm -f *.db
rm -f *.log
install: add-static clean
go install
add-static: #add static code to binary. if error: do 'go get github.com/rakyll/statik'
statik -src static -f
run-help:
go run main.go --help
run-server: install
db2ctl server
server-live: # go get -u github.com/cosmtrek/air
air -c .air.toml
# save github token in an environment variable export GITHUB_TOKEN="token"
add-tag:
ifeq (,$(findstring v,$(tag)))
@echo "error : tag needs to be of format v0.x.x. Usage --> make upload tag=v0.x.x"
@echo
exit 1
endif
git fetch
git tag $(tag)
git push origin --tags
upload: add-tag install build-linux #make upload tag=v0.x.x, install --> brew install goreleaser
goreleaser --rm-dist
test:
go test -v ./...
start-ws:
go run ws/ws.go