Verified Commit fe0de257 authored by doshitan's avatar doshitan
Browse files

Update make page

parent b56b4264
......@@ -96,7 +96,18 @@ gets run.
It [[][doesn't really matter]]. ~Makefile~ is conventional.
Note that GNU make searches for ~makefile~ before ~Makefile~, so if both are
present (why?), the lowercase one wins.
present, the lowercase one wins.
This can be an interesting feature in a shared project. For instance, if you
have a version tracked/shared ~Makefile~, then a local ~makefile~ that does an
~include Makefile~ to pull in the shared one, you can then add personal targets
to your ~makefile~, things that are only useful for you or that you are giving a
trial run for a while.
This is also potentially dangerous, mixing local modifications in the same
interface, safer to have a differently named, like a ~make.local~ that you have
to ~make -f make.local <target>~, but sometimes it's nice to have your tweaks
presented in the same interface.
I prefer lowercase ~makefile~ as it's ever so slightly easier to type and it's
usually surrounded by other lowercased names so it looks better to me to match.
......@@ -385,6 +396,11 @@ help:
Which will show the targets in the order they are in the makefile, even
highlighting the target name (and other comment pattern junk).
Or with straight ~awk~[fn::Sourced from]
#+BEGIN_SRC makefile
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z0-9_-]+:.*?## / {gsub("\\\\n",sprintf("\n%22c",""), $$2);printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST)
Or use a different pattern:
#+BEGIN_SRC makefile
# target: help - Display callable targets.
......@@ -673,6 +689,14 @@ regenerating all of them from scratch, or we just don't need them anymore.
This is just a simple example, but hopefully illustrative of the how we can take
advantage of some of make's features to build a simple and powerful tool.
* Libraries
You can import other makefiles with the ~include <file>~ feature, which means it
is possible to develop "libraries" of useful things you can copy
around/submodule/fetch from wherever.
Some existing ones to use or borrow from:
- GNU Make Standard Library:
* Bigger example
Extracted from a old, but real project.
......@@ -755,3 +779,7 @@ help: ## Displays this help screen
* Misc.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment