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

Add Makefile #41

Merged
merged 2 commits into from
Oct 6, 2020
Merged

Conversation

MistaTwista
Copy link

Makefile help newcomers to understand what to do with project.

By running:

$ make help

or just

$ 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.

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.
@MistaTwista MistaTwista mentioned this pull request Oct 3, 2020
Copy link
Member

@aryan9600 aryan9600 left a 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
Copy link
Member

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.

Copy link
Author

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.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also, there is something like standard layout for go projects, you can read about it here and there

Copy link
Member

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. 👍

@MistaTwista
Copy link
Author

Added make clean command

Copy link
Member

@aryan9600 aryan9600 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@aryan9600 aryan9600 merged commit 1334a2c into IEEE-VIT:master Oct 6, 2020
@aryan9600 aryan9600 linked an issue Oct 6, 2020 that may be closed by this pull request
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.

[Feature] Add Makefile
2 participants