diff --git a/Makefile b/Makefile index 1fd46bc..44bd694 100644 --- a/Makefile +++ b/Makefile @@ -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..."