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