I add a Makefile to every project I work with. I don’t usually work on C/C++ projects or any other compiled languages but Makefile is good to make aliases for long commands.
Here is an example of short version of Makefile I use:
.PHONY: up
up:
docker-compose up -d
.PHONY: logs
logs:
tail -f ./storage/logs/*.log
There are set of aliases / mnemonics that I used to:
Here is small note about the target I put in every Makefile I have.
The target is called list
and looks like this:
.PHONY: list
list:
@$(MAKE) -pRrq -f $(lastword $(MAKEFILE_LIST)) : 2>/dev/null | awk -v RS= -F: '/^# File/,/^# Finished Make data base/ {if ($$1 !~ "^[#.]") {print $$1}}' | sort | egrep -v -e '^[^[:alnum:]]' -e '^$@$$'
It prints list of all targets defined in your Makefile.
Took it from this brilliant stackoverflow answer