subsonic-tui/Makefile
Sagi Dayan 99e8e299e4
Some checks failed
ci / check for spelling errors (pull_request) Failing after 22s
ci / Make sure build does not fail (pull_request) Successful in 2m52s
ci / code quality (lint/tests) (pull_request) Has been skipped
Added ci workflow + fixed linting issues
Signed-off-by: Sagi Dayan <sagidayan@gmail.com>
2024-12-18 17:29:16 +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