Sagi Dayan
92e3c4ea7d
All checks were successful
ci / check for spelling errors (pull_request) Successful in 21s
ci / code quality (lint/tests) (pull_request) Successful in 2m29s
ci / Make sure build does not fail (pull_request) Successful in 2m25s
ci / notify-fail (pull_request) Has been skipped
ci / check for spelling errors (push) Successful in 22s
ci / code quality (lint/tests) (push) Successful in 1m53s
ci / Make sure build does not fail (push) Successful in 2m55s
ci / notify-fail (push) Has been skipped
Signed-off-by: Sagi Dayan <sagidayan@gmail.com>
50 lines
1.3 KiB
Makefile
50 lines
1.3 KiB
Makefile
BINARY_NAME=subsonic-tui
|
|
BUILD_FOLDER=build
|
|
VERSION=0.0.1
|
|
|
|
GO_BUILD_LD_FLAGS=-ldflags="-s -w -X 'git.dayanhub.com/sagi/subsonic-tui/internal/variables.Commit=$(shell git rev-parse --short HEAD)' \
|
|
-X 'git.dayanhub.com/sagi/subsonic-tui/internal/variables.Version=${VERSION}'"
|
|
|
|
|
|
.PHONY: build
|
|
build: dep
|
|
GOARCH=amd64 GOOS=darwin go build ${GO_BUILD_LD_FLAGS} -o ${BUILD_FOLDER}/${BINARY_NAME}-${VERSION}-amd64-darwin main.go
|
|
GOARCH=amd64 GOOS=linux go build ${GO_BUILD_LD_FLAGS} -o ${BUILD_FOLDER}/${BINARY_NAME}-${VERSION}-amd64-linux main.go
|
|
GOARCH=amd64 GOOS=windows go build ${GO_BUILD_LD_FLAGS} -o ${BUILD_FOLDER}/${BINARY_NAME}-${VERSION}-amd64-windows main.go
|
|
|
|
run: build
|
|
./${BINARY_NAME}
|
|
|
|
clean:
|
|
go clean
|
|
rm -rf ./${BUILD_FOLDER}
|
|
|
|
test:
|
|
go test ./...
|
|
|
|
test_coverage:
|
|
go test ./... -coverprofile=coverage.out
|
|
|
|
dep:
|
|
go mod tidy
|
|
go mod vendor
|
|
|
|
vet:
|
|
go vet
|
|
|
|
lint:
|
|
golangci-lint run --enable-all
|
|
|
|
.PHONY: install
|
|
install: build
|
|
ifeq ($(OS),Windows_NT) # is Windows_NT on XP, 2000, 7, Vista, 10...
|
|
$(error Unable to install on windows)
|
|
else
|
|
ifeq ($(shell uname), Linux)
|
|
sudo cp ${BUILD_FOLDER}/${BINARY_NAME}-${VERSION}-amd64-linux /usr/local/bin/${BINARY_NAME}
|
|
else
|
|
@echo $(shell uname)
|
|
$(error Unable to install on systems that are not linux)
|
|
endif
|
|
endif
|
|
|