Created
July 3, 2026 10:34
-
-
Save Pierstoval/88b3a929d02bd57ea79241df4527504d to your computer and use it in GitHub Desktop.
Makefile example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| DOCKER_COMPOSE = docker compose | |
| COMPOSE_EXEC = $(DOCKER_COMPOSE) exec | |
| COMPOSE_RUN = $(DOCKER_COMPOSE) run --rm | |
| PHP = $(COMPOSE_EXEC) php | |
| COMPOSER = $(PHP) composer | |
| NODE = $(COMPOSE_RUN) node | |
| NPM = $(NODE) npm | |
| define info | |
| sh -c 'color="\033[42;30m";export txt="$$*";printf "$$color %s \033[0m\n" "$$txt"' -- | |
| endef | |
| define error | |
| sh -c 'color="\033[41;37m";export txt="$$*";printf "$$color %s \033[0m\n" "$$txt"' -- | |
| endef | |
| ## | |
| ## Project | |
| ## ------- | |
| ## | |
| .DEFAULT_GOAL := help | |
| help: ## Show this help message | |
| @grep -E '(^[a-zA-Z_-]+:.*?##.*$$)|(^##)' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?##"}; {printf " \033[32m%-25s\033[0m%s\n", $$1, $$2}' | sed -e 's/\[32m##/[33m/' | |
| .PHONY: help | |
| install: build-docker-images node_modules start ## Install and start the project | |
| .PHONY: install | |
| build-docker-images: | |
| $(DOCKER_COMPOSE) build --pull | |
| .PHONY: build-docker-images | |
| vendor: | |
| $(COMPOSER) install | |
| .PHONY: vendor | |
| node_modules: | |
| $(NPM) clean-install | |
| .PHONY: node_modules | |
| start: ## Start Docker services | |
| $(DOCKER_COMPOSE) up | |
| .PHONY: start | |
| stop: ## Stop Docker services | |
| $(DOCKER_COMPOSE) down | |
| .PHONY: stop | |
| restart: stop start ## Restart all Docker services | |
| cc: ## Clear the cache | |
| -@if git clean --force -dx -- \ | |
| var/cache \ | |
| build \ | |
| dist \ | |
| public/build \ | |
| ; then \ | |
| $(info) "✅️ Cache Cleared" ; \ | |
| else \ | |
| $(error) "🚨 Cache clear error:" ; \ | |
| fi | |
| .PHONY: cc | |
| ## | |
| ## Deployment | |
| ## | |
| build: ## Build project | |
| # TODO | |
| @$(info) "✅️ Project built!" | |
| .PHONY: build | |
| ## | |
| ## Integration | |
| ## ----------- | |
| ## | |
| static-analysis: ## Static analysis | |
| # TODO | |
| .PHONY: static-analysis | |
| lint: ## Lint files | |
| # TODO | |
| .PHONY: lint | |
| format: ## Format code and modify files | |
| # TODO | |
| .PHONY: format | |
| format-dry-run: ## Format code without modifying files | |
| # TODO | |
| .PHONY: format-dry-run | |
| test: ## Run automated tests | |
| # TODO | |
| .PHONY: test | |
| tests: test | |
| ci: static-analysis lint format-dry-run build | |
| .PHONY: ci | |
| ## |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment