-
Notifications
You must be signed in to change notification settings - Fork 5
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
Added -ldflags to floop builds #6
Conversation
Makefile
Outdated
@@ -1,22 +1,40 @@ | |||
|
|||
NAME = floop | |||
FILES = cmd/main.go cmd/cli.go | |||
BRANCH = $(shell git rev-parse --abbrev-ref HEAD) | |||
COMMIT = $(shell git rev-parse --short HEAD) | |||
VERSION = $(shell git describe | sed -e "s/^v//") |
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.
This line will cause problems if there is no tag present
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.
Understood. I added an initial tag on the repo so the condition where no tag is present should never happen from now on.
Makefile
Outdated
@@ -1,22 +1,40 @@ | |||
|
|||
NAME = floop | |||
FILES = cmd/main.go cmd/cli.go | |||
BRANCH = $(shell git rev-parse --abbrev-ref HEAD) |
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.
Branch is no longer required and can be removed
Makefile
Outdated
GOOS=darwin $(BUILD_CMD) -o ./dist/$(NAME)-darwin $(FILES) | ||
GOOS=windows $(BUILD_CMD) -o ./dist/$(NAME)-windows $(FILES) | ||
|
||
$(eval OS := linux) $(eval OUTFILE := ./dist/$(NAME)-$(OS)-$(VERSION)) |
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.
Evals are not required for this. You can simple compile each bin with GOOS=linux|darwin|windows
. Here's an example dist Makefile block:
dist:
[ -d dist ] || mkdir dist
for os in linux darwin windows; do \
GOOS=$${os} $(BUILD_CMD) $(LD_OPTS) -o dist/$(NAME)-$${os} $(SRC_FILES); \
tar -C dist -czf dist/$(NAME)-$${os}.tgz $(NAME)-$${os}; \
done;
Pull request for issue #5