Mark Eschbach

Software Developer && System Analyst

Makefile

At a high level, Makefile is a tool to build files when they are out of date. In partice Makefiles are used to produce software modules only on chnage. This is particularly useful in languages such as C and C++ where modules only need to be recompiled and linked on change. There are many Makefile flavors, most notably in the Open Source world are BSD Make and GNU Make.

GNU Make

GNU Make is commonly used under the Linux family of operating systems to build binaries.

Metaprogramming

This is useful for generating targets. The following will dynamically generate targets

define build_target
$1_target:
	$$(MAKE) -C $1 all
endef

TARGETS=yeah aha

$(foreach d,$(TARGETS),$(eval $(call build_target,$d)))

Xref
Eval

Xref