Makefiles: Stop Typing for Nothing
Automate your commands, save your fingers.
Typing the same long-ass commands into your terminal every five minutes is a special kind of masochism. You aren't paid by the keystroke, so stop acting like it.
Makefile has been around since 1976. It’s older than your favorite "game-changing" framework and it still does the job better than most of them.
"If it’s stupid but it works, it ain't stupid. But if it’s manual and repetitive, it’s definitely fucking stupid." — Every Dev Ever
The Magic
You don't need a complex CI/CD pipeline to run a few scripts. You just need a file named Makefile and a dream.
build:
docker build -t my-app .
run:
docker run -p 8080:8080 my-app
clean:
docker system prune -f
Now, instead of remembering flags, you just type make build.
Scaling Up
You can use variables and shell commands inside your Makefile to handle the heavy lifting. Instead of hardcoding paths, let the script find them.
# Variables are your friends
SWIFT_FILES = $(shell find . -name "*.swift")
BUNDLE_ID = com.example.App
# Automate the boring stuff (like Plist generation)
app: build
@echo "Creating app bundle..."
mkdir -p MyApp.app/Contents/MacOS
cp $(EXECUTABLE) MyApp.app/Contents/MacOS/
@echo '<?xml version="1.0" encoding="UTF-8"?>' > MyApp.app/Contents/Info.plist
@echo '<dict><key>CFBundleIdentifier</key><string>$(BUNDLE_ID)</string></dict>' >> MyApp.app/Contents/Info.plist
Why this wins
- Variables: Change your
BUNDLE_IDonce, and it updates everywhere. - Phony Targets: Use
.PHONYto tell Make thatcleanorrunaren't actual files, avoiding weird conflicts. - Cleanup: A single
make cleanthat actually kills processes and wipes caches beats manual hunting every time.
- Define your environment variables.
- Automate the scaffolding (folders, plists, configs).
- Chain your commands (e.g.,
dev: clean app).
Stop fighting your tools and start making them work for you.
Why it stays
It’s language-agnostic. Whether you’re pushing Go code, compiling C, or just trying to manage a messy React project, Make doesn't care. It checks timestamps: if the file hasn't changed, it doesn't waste time rebuilding.
- Create a
Makefile. - Map your long commands to short aliases.
- Get back to actual work.
Don't over-engineer your workflow when a 50-year-old tool solves it in two minutes.
Did you enjoy this article?
Share it with your network or follow me for more.