Makefile Cheat Sheet/ifdef conditional

Check whether a variable is defined.

Section: Includes and conditionals

ifdef conditional

makefile
makefile
ifdef CI
  TEST_FLAGS += --maxfail=1
endif
Explanation

Useful for CI-vs-local behavior.

Learn the surrounding workflow

Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.

Related commands

Same sheet · prioritizing Includes and conditionals
ifeq conditional
Branch based on string equality.
OpenIn sheetmakefilesame section
OS-specific include
Branch based on operating system or shell-provided variables.
OpenIn sheetmakefilesame section
Include another makefile
Read another file while parsing.
OpenIn sheetmakefilesame section
Optional include
Ignore missing include files.
OpenIn sheetmakefilesame section
Run default target
Run make using the default makefile and first target.
Basic rule
Define a target, prerequisites, and recipe.
OpenIn sheetmakefile