How to use Makefiles to boost command-line productivity
Makefiles are an awesome tool which can help you become more productive command-line wise by encapsulating long commands and/or sequences of commands. They also help abstract away complexity.
One practical example of creating a make command would be setting up a Laravel project. All you need to do is create a file called Makefile
and type in the following.
.PHONY setup
setup: # Setup project
composer install
php artisan migrate:fresh --seed
npm install
...
Now, a new developer who needs to setup his/her project can skip writing down that series of commands by simply typing in the following:
make setup
But this doesn't end here. You can create virtually any command to help you automate certain processes such as creating or deleting files, changing permissions etc.