subsonic-tui/Makefile
Sagi Dayan 864d56954a
Some checks failed
ci / check for spelling errors (pull_request) Successful in 20s
ci / code quality (lint/tests) (pull_request) Failing after 1m30s
ci / Make sure build does not fail (pull_request) Has been skipped
ci / notify-fail (pull_request) Failing after 13s
Added ci workflow + fixed linting issues
Signed-off-by: Sagi Dayan <sagidayan@gmail.com>
2024-12-18 17:34:39 +02:00

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