fix Makefile for install

This commit is contained in:
rmanach 2025-04-30 15:49:24 +02:00
parent d927ce24aa
commit 3ccfcfc451

View File

@ -1,16 +1,20 @@
BIN_NAME = "hmdeploy"
BIN_INSTALL = $(shell whereis $(BIN_NAME) | cut -d ' ' -f2 | xargs rm -f)
BIN_NAME = "hmdeploy-linux-unknown-amd64"
BIN_INSTALL = $(shell whereis $(BIN_NAME) | cut -d ' ' -f2)
VERSION = 0.1.1
run: lint
@go run main.go
build: lint
@echo "building binary..."
@go build -ldflags "-X main.Version=0.1.1" -o $(BIN_NAME) main.go && echo "$(BIN_NAME) built"
@CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags "-s -w -X main.Version=$(VERSION)" -o $(BIN_NAME) main.go && echo "$(BIN_NAME) v$(VERSION) built"
install: build
@echo "installing v$(VERSION)..."
@mv $(BIN_NAME) $(GOPATH)/bin/hmdeploy
@echo "program installed: $(GOPATH)/bin/hmdeploy"
@$(GOPATH)/bin/hmdeploy --version
lint:
@echo "format and lint..."