17 private links
I like to use Makefiles. I like to use Makefiles in Java. I like to use Makefiles in Erlang. I like to use Makefiles in Elixir. And most recently, I like to use Makefiles in Ruby. I think you, too, would like to use Makefiles in your environment, and the engineering community would benefit if more of us used Makefiles, in general.
I work on a lot of Javascript projects. The fashion in Javascript is to use build tools like Gulp or Webpack that are written and configured in Javascript. I want to talk about the merits of Make (specifically GNU Make).
Make is a general-purpose build tool that has been improved upon and refined continuously since its introduction over forty years ago. Make is great at expressing build steps concisely and is not specific to Javascript projects. It is very good at incremental builds, which can save a lot of time when you rebuild after changing one or two files in a large project.
Make has been around long enough to have solved problems that newer build tools are only now discovering for themselves.
Despite the title of this post, Make is still widely used. But I think that it is underrepresented in Javascript development. You are more likely to see a Makefile in a C or C++ project, for example.
My guess is that a large portion of the Javascript community did not come from a background of Unix programming, and never had a good opportunity to learn what Make is capable of.
I want to provide a quick primer here; I will go over the contents of the Makefile that I use with my own Javascript projects.
When passing parameters to a make command, reference them like you would other internal make variables.
If your makefile looks like:
run:
script $(param1) $(param2)
You can call it with the following syntax:
$> make run param1=20 param2=30
and make should call the script like:
script 20 30
wo of the most common programming tools are way too useful to be left to the programmers. We'll cover how to use the Git version control system and the Make utility to get more accurate and faster results on a variety of common tasks.
Edit files in Markdown format, while you collaborate with users who run Microsoft Word--you can have diffs, while they can use their "DOCX" format and "Track Changes" functionality.
"Win" National Novel Writing Month with the help of Git hooks--a handy way to set up programs to assist you with word count and spelling.
Do double-entry accounting for a small business, and generate financial statements in HTML.
Keep your files consistent across multiple in-house and/or cloud servers, even if all servers are accepting a push at the same time.
And you don't have to keep typing "make" -- we'll cover a simple way to re-run your task when anything changes, and have the result automatically refresh in your browser.
Don Marti presented a talk where he describes how he uses make, git, and other tools for work other than software development. His primary example use case was document processing, but he noted the applicability of the tools to other scenarios.
Compiling your source code files can be tedious, specially when you want to include several source files and have to type the compiling command everytime you want to do it.