-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix makefile and log #1714
fix makefile and log #1714
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,7 @@ | |
# export PATH := $(PATH):$(GOPATH)/bin | ||
|
||
UNAME := $(shell uname) | ||
UNAME_M := $(shell uname -m) | ||
# for mac | ||
BRANCH := $(shell git branch | sed 's/* \(.*\)/\1/p') | ||
# for Linux | ||
|
@@ -65,8 +66,10 @@ all: build | |
build: deps | ||
ifeq ($(UNAME), Linux) | ||
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o bin/$(PROJNAME) | ||
else ifeq ($(UNAME), Darwin) | ||
else ifeq ($(UNAME_M), x86_64) | ||
CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 go build -o bin/$(PROJNAME) | ||
else ifeq ($(UNAME_M), arm64) | ||
CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -o bin/$(PROJNAME) | ||
endif | ||
|
||
deps: generateVer | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The code patch you provided seems to handle the build process based on the operating system and architecture. Here's a brief review with some suggestions:
Apart from these suggestions, the code patch looks fine and should work as intended. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The code patch includes a build target in a Makefile to handle cross-compilation for different operating systems and architectures. Here are some bug risks and improvement suggestions:
Apart from these minor issues, the code looks fine in terms of handling different operating systems (Linux and Darwin) and architectures (x86_64 and arm64). It sets the appropriate values for |
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you need to consider the situation of Linux and arm architecture?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done