- Home
- Skills
- Akin Ozer
- Cc Devops Skills
- Makefile Validator
makefile-validator_skill
- HCL
83
GitHub Stars
1
Bundled Files
2 months ago
Catalog Refreshed
4 months ago
First Indexed
Readme & install
Copy the install command, review bundled files from the catalogue, and read any extended description pulled from the listing source.
Installation
Preview and clipboard use veilstrat where the catalogue uses aiagentskills.
npx veilstrat add skill akin-ozer/cc-devops-skills --skill makefile-validator- SKILL.md17.3 KB
Overview
This skill validates, lints, and optimizes Makefiles (Makefile, makefile, *.mk) to ensure reliable, secure, and well-formatted build configurations. It combines GNU make syntax checks, the mbake formatter/linter, and custom rules for security and best practices. Use it to catch syntax errors, enforce formatting, and surface performance or safety issues before they hit CI or production.
How this skill works
The validator runs a layered pipeline: dependency checks, a dry-run GNU make syntax validation, mbake validation/format checks, and custom pattern checks for security and best practices. It creates a temporary isolated Python venv, installs mbake, runs automated checks, generates a color-coded report with errors/warnings/info, and cleans up the venv on exit. The tool reports line numbers, suggested fixes, and commands to apply automatic formatting.
When to use it
- Pre-commit or CI validation of Makefiles and *.mk files
- Code reviews to enforce .PHONY, tab usage, and dependency correctness
- Security audits to find hardcoded credentials or unsafe command expansions
- Refactoring legacy Makefiles or converting to modern patterns
- Performance tuning to discover unnecessary recompilation or parallelization issues
Best practices
- Declare .PHONY for non-file targets to avoid conflicts with filesystem names
- Use TAB characters for recipe lines; mbake will detect and fix spacing issues
- Prefer := for immediate variable evaluation when appropriate to avoid recursion
- Add error handling in recipes (set -e, ||) and avoid unquoted variable use in shell commands
- Run the validator in pre-commit hooks and CI to catch regressions early
Example use cases
- Run validate_makefile.sh Makefile in a pre-commit hook to block commits with errors
- Use mbake format --diff Makefile to preview and apply formatting fixes
- Scan build recipes for unsafe commands like unquoted rm/curl/wget and hardcoded tokens
- Audit a legacy Makefile: fix tabs/syntax, add .PHONY, then re-run validation
- Integrate the validator into GitHub Actions to validate all Makefiles on PRs
FAQ
Exit code 0 means clean, 1 indicates warnings found, and 2 indicates errors that require fixes.
Does the validator modify files automatically?
The validator reports issues and suggests mbake commands; formatting can be applied automatically with mbake format but the validator itself does not change files unless you run format commands it recommends.