CI/CD & build tooling
Makefile
make was built in 1976 to recompile C programs, and it's still everywhere because it solves a timeless problem: a named list of tasks, with dependencies between them, that only redoes work that's out of date. DevOps teams use a Makefile as the single front door to a repository — make test, make docker-build, make deploy ENV=staging — so the same commands work on a laptop, in Jenkins, and in GitHub Actions. Interviewers ask about it to see whether you understand dependency graphs, can debug the classic gotchas, and can design a clean developer interface.
After this topic you can
- Read and write Makefiles with targets and dependencies
- Use make as a simple task runner for a project
- Avoid common tab and variable pitfalls
Lessons
-
1How make thinks: targets, prerequisites, recipes
- The rule
- The decision algorithm
- Running make
-
2Phony targets: the DevOps reality
- Why .PHONY exists
- Mixing real-file and phony targets
- Order-only prerequisites
- Diagnosing "always runs" vs "never runs"
-
3Variables in depth
- Defining and referencing
- The assignment flavours
- Where values come from, and precedence
- Exporting to recipe shells
- Automatic variables
- Pattern rules
- Useful functions
-
4How recipes execute
- One shell per line
- Shell and error behaviour
- Prefixes
- $ in recipes
- Recursive make
- Parallel builds
- include
-
5Designing a DevOps Makefile
- A production-quality example
- Monorepos
-
6Make in CI and team workflows
- Same commands everywhere
- "Works locally, fails in CI"
- Windows developers
- Alternatives
-
7Interview questions and model answers
- "Why does make test say 'up to date' and not run my tests?"
- "What's the difference between = and :=?"
- "Why doesn't cd work across recipe lines?"
- "Parallel make -j breaks the build but serial works. Why?"
- "How would you design a Makefile for a team's service?"
- "Why use $(MAKE) instead of make in recipes?"
- "Makefile or bash script?"