Skip to content
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

Merged
merged 4 commits into from
Aug 1, 2017
Merged

Added -ldflags to floop builds #6

merged 4 commits into from
Aug 1, 2017

Conversation

toddschilling
Copy link
Contributor

Pull request for issue #5

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//")
Copy link
Contributor

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

Copy link
Contributor Author

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)
Copy link
Contributor

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))
Copy link
Contributor

@euforia euforia Jul 31, 2017

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;

@euforia euforia merged commit 674b2a5 into master Aug 1, 2017
@euforia euforia deleted the build-flags branch August 1, 2017 20:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants