DEV Community

Cover image for Streamline your projects using Makefile

Streamline your projects using Makefile

Yankee Maharjan on December 26, 2020

make is one of the tools that we use heavily for streamlining tasks on our projects. It has proven to be helpful specifically for streamlining the ...
Collapse
 
mjgs profile image
Info Comment hidden by post author - thread only accessible via permalink
Mark Smith

I like the general idea of where this tutorial was going but there were some parts that either were not well described (@ symbol) or inconsistencies (env variables) that broke the flow, making it difficult to understand.

Collapse
 
yankee profile image
Yankee Maharjan • Edited

Hey Mark, thank you for the comment, I have written about `@ symbol on the Notes section here.

For environment variables, from where did you find it confusing? Is it the sub topic Variables itself or Include other Makefiles?

Let me know, I will update accordingly to make it more understandable. πŸ™‚

Collapse
 
mjgs profile image
Mark Smith

@ symbol is for disabling the echo for recipe.

I have no idea what that means. It feels weird adding symbols to bash commands like that, where is the symbol interpreted?

In our shell we can export an environment variable called greeting.

But then the name of the variable is not β€˜greeting’:

$ export INFO="Run make help to show

These sorts of small inconsistencies really break the flow of the entire piece.

Thread Thread
 
yankee profile image
Yankee Maharjan

Made the tweaks. On regards for the @ symbol, that's the standard syntax for Makefile and just how it works to disable printing the recipe to your stdout. As the note section suggests, you can try to build a rule where there is no @ symbol in the recipe to see what it means.

If you find the @ symbol weird in front of the bash commands. you can run the commands with -s flag

$ make -s <target-name>
Enter fullscreen mode Exit fullscreen mode

to disable printing the recipe to your stdout.

Hope it helps. Cheers!

Thread Thread
 
mjgs profile image
Mark Smith

It’s not clear to me what this means:

printing the recipe to your stdout

Are you saying that adding the @ causes make to suppress command output to stdout? Or is it that make doesn’t print the step name to stdout? Or something else?

It might be more obvious with some example make output.

Thread Thread
 
yankee profile image
Yankee Maharjan

Doing is knowing, so just try it out first!

Thread Thread
 
mjgs profile image
Mark Smith

Honestly I didn’t make it to the end of the article, I stopped after the second round of confusion.

Collapse
 
victoria profile image
Victoria Drake

Saw this pop up in my feed and was pleasantly surprised to see you spreading the word about self-documenting Makefiles! πŸ˜„πŸ™Œ

My article you’ve linked is here on dev.to as well, in case folks want to stay on the site: dev.to/victoria/how-to-create-a-se...

Thanks for sharing your tips, Yankee!

Collapse
 
yankee profile image
Yankee Maharjan

Thanks to you, using Makefiles has been more intuitive Victoria πŸ˜„
Also, updated link to your article and profile accordingly.

Collapse
 
adam_b profile image
Adam Braimah

I like it! Make is a bit of a forgotten tool nowadays, but I hadn't thought of using it for anything besides actual builds.

Collapse
 
yankee profile image
Yankee Maharjan

Thank you! Hope it helps in your workflow πŸš€

Collapse
 
paras594 profile image
Paras πŸ§™β€β™‚οΈ

okay...nice insight of make files. I have used make file for c++ but didn't know we can use it like this in a general way

Collapse
 
yankee profile image
Yankee Maharjan

Awesome! πŸ˜€

Some comments have been hidden by the post's author - find out more