-
Notifications
You must be signed in to change notification settings - Fork 16
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
Add Makefile #41
Add Makefile #41
Conversation
Makefile help newcomers to understand what to do with project. By running: ```bash $ make help ``` or just ```bash $ make ``` there will be help message with all available commands. Help message parsed from Makefile itself, by finding `##` comments after command name. Currently usefull commands are: - *dep* - install dependencies and make vendoring folder - *test*- run unit tests, but before it runs `dep` - *build* - run test and build a binary into ./bin folder - *run* - just execute binary - *rerun* - build and run - *printvars* - print all variables available for make its usefull when you need to debug some settings On top of Makefile there are variables for all these commands, like: - PROJECT_NAME - BUILD_DIR - VERSION - BUILD_DATE - COMMIT_SHA - and LDFLAGS LDFLAGS used on binary compilation, to inject some build data and get this information inside app. Also this commit contains small changes in forming of version string There is a good practices to add version with git tags, but also a commit message and build date.
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.
Can we also have a target clean
which runs go clean
?
Makefile
Outdated
@@ -0,0 +1,45 @@ | |||
# Build variables | |||
PROJECT_NAME = $(shell basename "$(PWD)") | |||
BUILD_DIR = bin |
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.
I think it'll be better to have the BUILD_DIR as the root of the project itself.
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.
I think it's easier to .gitignore folder with some files than just some files in the root of a project, perhaps in future you will generate several binaries for different operating systems, so you will need to add them in .gitignore or don't think about it, and just put bin
folder there.
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.
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.
Actually termiboard aims to ship one binary for all platforms, but after going through the articles (thanks for the links btw), I think it makes sense to have it a /bin
folder. 👍
Added |
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.
LGTM!
Makefile help newcomers to understand what to do with project.
By running:
$ make help
or just
there will be help message with all available commands.
Help message parsed from Makefile itself, by finding
##
comments after command name.Currently usefull commands are:
dep
its usefull when you need to debug some settings
On top of Makefile there are variables for all these commands, like:
LDFLAGS used on binary compilation, to inject some build data
and get this information inside app.
Also this commit contains small changes in forming of version string
There is a good practices to add version with git tags, but also
a commit message and build date.