The Power Of Makefile
A makefile is a special file, containing shell commands, While in the directory containing this makefile, you will type make and the commands in the makefile will be executed
Get Started:
touch Makefile
Open Makefile and paste the following lines into it which three tasks
help
,install
andprepare
by default, make considers first task as default task to change this behavior add this line
.DEFAULT_GOAL := prepare
Now type make
Execute a set of tasks in one command
Assume you have a project and you have first to clean unwanted files then you have to download a file then execute the command it will be a lot of hassle to tell a user to do a set of tasks instead of that we can do it via a single and short command using Makefile.
so we have to define make file contains set of tasks clean, download, execute and install which will be the task that executes [clean, download, execute]
and this can happen using this syntax
install: clean download execute
As you see i have only two files ( Makefile and dummy.txt), dummy.txt contains text
Makefile Example:
Now type make
which will execute install
as we can see it executed three tasks clean, download and execute
and we have ipInfo.sh exists in current dir and it cleared dummy.txt content.
Autogenerate help command to make:
follow that then you will be able to generate it from comments
just you have to add comments that start with `##` then add the description
Output