Vault7: CIA Hacking Tools Revealed
Navigation: » Latest version
Making Make Suck Less
- Use Make. Build scripts are usually a mistake.
- Use GNU make. It sucks the least.
- Build targets in the current directory
- Only use VPATH to locate source files, not intermediate targets.
- Never write a filename more than once.
- Don't use Make recursively.
- Don't use Autotools to generate Makefiles.
- Use implicit rules and predefined variables as much as possible.
- If you're not using +=, ?=, and := often, you're probably doing it wrong.
- CFLAGS, CPPFLAGS, CXXFLAGS, LDFLAGS and LDLIBS should be used properly.
Sometimes, you don't even need a recipe to build a target. So don't type any more than you need to. For example, this Makefile compiles the foo executable from 3 implicit source files.
CPPFLAGS += -Wall
foo: foo.o bar.o baz.o