2024-01-16 15:21:35 +00:00
|
|
|
BINARY_NAME=subsonic-tui
|
|
|
|
BUILD_FOLDER=build
|
2024-12-18 15:29:16 +00:00
|
|
|
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}'"
|
2024-01-16 15:21:35 +00:00
|
|
|
|
|
|
|
|
|
|
|
.PHONY: build
|
2024-12-15 17:24:10 +00:00
|
|
|
build: dep
|
2024-12-18 15:29:16 +00:00
|
|
|
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
|
2024-01-16 15:21:35 +00:00
|
|
|
|
|
|
|
run: build
|
|
|
|
./${BINARY_NAME}
|
|
|
|
|
|
|
|
clean:
|
|
|
|
go clean
|
2024-12-15 17:24:10 +00:00
|
|
|
rm -rf ./${BUILD_FOLDER}
|
2024-01-16 15:21:35 +00:00
|
|
|
|
|
|
|
test:
|
|
|
|
go test ./...
|
|
|
|
|
|
|
|
test_coverage:
|
|
|
|
go test ./... -coverprofile=coverage.out
|
|
|
|
|
|
|
|
dep:
|
2024-12-15 09:22:46 +00:00
|
|
|
go mod tidy
|
|
|
|
go mod vendor
|
2024-01-16 15:21:35 +00:00
|
|
|
|
|
|
|
vet:
|
|
|
|
go vet
|
|
|
|
|
|
|
|
lint:
|
|
|
|
golangci-lint run --enable-all
|
2024-12-18 15:29:16 +00:00
|
|
|
|
|
|
|
.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
|
|
|
|
|