Skip to content

Commit

Permalink
chore: optimize Makefile
Browse files Browse the repository at this point in the history
  • Loading branch information
windvalley committed Jan 16, 2024
1 parent d1ed85f commit eb42f56
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 8 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Optimize config template and config file.
- Optimize pubkeys authentication.
- Optimize some flags description.
- Optimize Makefile.

## [1.15.0]

Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ define USAGE_OPTIONS
Options:

PLATFORMS The multiple platforms to build.
Default is 'darwin_amd64 darwin_arm64 linux_amd64 linux_arm64 windows_amd64'.
Default is 'darwin_amd64 darwin_arm64 linux_amd64 linux_arm64'.
This option is available when using: make build.multiarch.
Example: make build.multiarch PLATFORMS="linux_amd64"
endef
Expand Down
2 changes: 0 additions & 2 deletions pkg/inventory/inventory_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ func TestGetAllHosts(t *testing.T) {
Password: "123456",
Keys: []string{
"~/.ssh/id_rsa",
"~/.ssh/id_ecdsa",
},
Passphrase: "xxx",
},
Expand Down Expand Up @@ -122,7 +121,6 @@ func TestGetHostsByGroup(t *testing.T) {
Password: "123456",
Keys: []string{
"~/.ssh/id_rsa",
"~/.ssh/id_ecdsa",
},
Passphrase: "xxx",
},
Expand Down
8 changes: 4 additions & 4 deletions scripts/makefiles/go.makefile
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@ go.build.%:
$(eval ARCH := $(word 2,$(subst _, ,${PLATFORM})))
$(eval GO_BIN_EXT = $(if $(findstring windows,${OS}),.exe,))
@echo "==========> Building binary '${COMMAND}${GO_BIN_EXT}' ${VERSION} for ${OS} ${ARCH}"
@mkdir -p ${OUTPUT_DIR}/platforms/${OS}/${ARCH}
@CGO_ENABLED=0 GOOS=${OS} GOARCH=${ARCH} ${GO} build ${GO_BUILD_FLAGS} -o ${OUTPUT_DIR}/platforms/${OS}/${ARCH}/${COMMAND}${GO_BIN_EXT} ${ROOT_PACKAGE}/cmd/${COMMAND}
@echo "${OUTPUT_DIR}/platforms/${OS}/${ARCH}/${COMMAND}${GO_BIN_EXT}"
@mkdir -p ${OUTPUT_DIR}/bins
@CGO_ENABLED=0 GOOS=${OS} GOARCH=${ARCH} ${GO} build ${GO_BUILD_FLAGS} -o ${OUTPUT_DIR}/bins/${COMMAND}${GO_BIN_EXT}-${VERSION}-${OS}-${ARCH} ${ROOT_PACKAGE}/cmd/${COMMAND}
@echo "${OUTPUT_DIR}/bins/${COMMAND}${GO_BIN_EXT}-${VERSION}-${OS}-${ARCH}"

.PHONY: go.build
go.build: go.tidy $(addprefix go.build., $(addprefix ${PLATFORM}., ${BINS}))
Expand Down Expand Up @@ -98,7 +98,7 @@ go.install.%:
$(eval ARCH := $(word 2,$(subst _, ,${PLATFORM})))
$(eval GO_BIN_EXT = $(if $(findstring windows,${OS}),.exe,))
@echo "==========> Install binary '${COMMAND}${GO_BIN_EXT}' ${VERSION} for ${OS} ${ARCH}"
cp ${OUTPUT_DIR}/platforms/${OS}/${ARCH}/${COMMAND}${GO_BIN_EXT} /usr/local/bin/
cp ${OUTPUT_DIR}/bins/${COMMAND}${GO_BIN_EXT}-${VERSION}-${OS}-${ARCH} /usr/local/bin/gossh

.PHONY: go.install
go.install: $(addprefix go.install., $(addprefix ${PLATFORM}., ${BINS}))
2 changes: 1 addition & 1 deletion scripts/makefiles/share.makefile
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ ifeq ($(origin COVERAGE), undefined)
endif

# The OS can be linux/windows/darwin when building binaries.
PLATFORMS ?= darwin_amd64 darwin_arm64 linux_amd64 linux_arm64 windows_amd64
PLATFORMS ?= darwin_amd64 darwin_arm64 linux_amd64 linux_arm64

# Set a specific platform.
ifeq ($(origin PLATFORM), undefined)
Expand Down

0 comments on commit eb42f56

Please sign in to comment.