What is a Makefile?
Makefiles were originally designed to decide which parts of a large C or C++ program need to be recompiled. But they are far more general than that — any language with a build step can benefit from a Makefile. Java has Ant, Maven, and Gradle. Go, Rust, and TypeScript have their own build tools. Makefiles sit above all of these as a portable, standardized command runner.
Installation on Windows
Using Chocolatey:
choco install make
Creating and using a Makefile
Create a file named Makefile in your project root. Inside, declare
targets — each target is like a stage or task that Make will execute.
one:
touch demo1.txt
two:
touch demo2.txt
all: one two
make one— runs theonetarget onlymake two— runs thetwotarget onlymake one two— runs both sequentiallymake all— runs both via thealltarget dependency
Targets can depend on other targets, making it easy to compose complex build workflows from simple primitives.
Using Makefiles in CI/CD
Makefiles integrate naturally with GitHub Actions and other CI systems.
Instead of repeating shell commands across pipeline steps, you define them
once in a Makefile and call make <target> from your pipeline. This keeps
your pipeline config thin and your build logic portable — runnable locally
and in CI with the same command.