Skip to content

Instantly share code, notes, and snippets.

@uebayasi
Last active December 24, 2015 17:39
Show Gist options
  • Save uebayasi/6837047 to your computer and use it in GitHub Desktop.
Save uebayasi/6837047 to your computer and use it in GitHub Desktop.

Tips

  • Phony is evil
  • Keep makefiles contain only dependency
  • Don't define -DXXX in makefiles (makefile changes output content)
  • If do so, output has to depend on makefile itself (evil road...)
  • How to pass vars to sub-make ("VAR=val make" vs. "env VAR=val make" vs. "make VAR=val")
  • Evaluation order (variables are evaluated at statements like .if, .for, ...)
  • .SUFFIXES (inference rule) is GREAT
  • Don't treat directories as input/output
  • Object directory means nothing
  • Use mkdep (generate accurate dependency automatically; avoid hand-write them)
  • Use relative paths (from ${.CURDIR}) to refer to sources (to use absolute paths, you have to pass around variables)
  • XXX

Variable assignment precedence

  1. Command-line
  2. Macro (assignment in make files)
  3. Environmental variable
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment