Today, Amrit gave a presentation on Make. It was a very good presentation. Anyone can make makefile who listened to his presentation.
Before start, he presents difference between script and make. When the script is used, all files are compiled during compilation, even only single file is changed. But when we make makefile, it will compile only that s changed. And make is beneficial only if there is a large project.
After that he shows us demo of a makefile. Basically, to create makefile We must know the steps of compilation to get final result. We must know commands that will be used to get the final output. Then follow same steps in a makefile. But must create object file that is needed to get final output. And there is one option “-I “, when this option used compiler search current directory to get header file (.h file created by us). If this optoin “I” is not used then the compiler will search standard library to get your header file. And .PHONY is most important in a makefile. Using it, compiler recognised that there are commands under the variable assigned to .PHONY. For example: If I define .PHONY=CLEAN and write some bash commands under CLEAN then compiler will run that commands. Without assigning CLEAN to .PHONY, a compiler will consider CLEAN as a file.