2013-06-20 00:00:00 -0700
A good plan violently executed now is better than a perfect plan executed next week.
George S. Patton
Recursive Make Considered Harmful
replace from/pattern with to/replacement in text patsubst looks for whitespace separated words in text which matches pattern. There is an escapable wildcard character ’%’, which matches any number of characters in a word. If ‘%” is also present in the replacement, it will replace the first occurence of from in a word with replacement. Otherwise, it replaces the entire word if the pattern matches a part of a word. subst replaces every occurence of from with to in text
$(subst .c, .o, text) is therefore equilavent with $(patsubst %.c, %.o, text)
returns a space separated list of all files which match the pattern
returns a space separated list of either directory portion or the file portion of a space separated list of file paths
create new function $(name param1 param2 …)
name of the current target
foo: foo.c gcc foo.c -o $@ bar: bar.c gcc bar.c -o $@
will produce foo.o and bar.o respectively
all dependencies more recent than the target