make and makefile interview questions

Source code can be found here .
 Just download or clone and build by running command "make".
Q)What is make?
->make is a build automation tool that automatically build executables and libraries by reading a file called Makefile which tells the make how to compile and link a program.
Q)What is a makefile?
Makefile is the recipe(rule to build) file, which tells the build automation tool "make" how to compile and link.
Q)What does a makefile contains?
A makefile mainly contains directives(rules) like target,dependency and and rule. It also contains "set" directive to set a variable and comments, statements stating with a #.
Syntax of a makefile:
target: dependencies
[ a tab ]recipe (system commands)

Where: target, is name of the executable(binary),object file or any action like "clean".
dependency, is the input files required to create the binary and
recipe, are the system commands that make carries out.
Q)What is the difference between makefile and Makefile?
Order of execution is the difference.
If for execution "make" is not given "-f" option then it first looks for a file "makefile" then "Makefile".
If for execution "make" is given "-f" option then it first looks for a file "Makefile" then "makefile".

A simple example of makefile:
hello: main.o factorial.o hello.o
g++ main.o factorial.o hello.o -o hello
main.o: main.cpp functions.h
g++ -c main.cpp
factorial.o: factorial.cpp functions.h
g++ -c factorial.cpp
hello.o: hello.cpp functions.h
g++ -c hello.cpp
clean:
-rm *.o
---------------------------
code:
//main.cpp
#include <iostream>
using namespace std;
#include "functions.h"

int main(){
   print_hello();
   cout << endl;
   cout << "The factorial of 5 is " << factorial(5) << endl;
   return 0;
}

//functions.h
void print_hello();
int factorial(int n);

//functions.cpp
#include "functions.h"
int factorial(int n){
   if(n!=1){
      return(n * factorial(n-1));
   }
   else return 1;
}
//hello.cpp
#include <iostream>
using namespace std;
#include "functions.h"
void print_hello(){
   cout << "Hello World!";
}

CMakeLists.txt and cmake interview questions