title: What is the difference between makefile and sh file
body: <p>What is the difference between makefile and sh file.    sh(shell
     script file) file also can work at the place of makefile(means we can
     do same thing using shell file like makefile can do) then what is
     difference between them. there is any execution difference or any
     standard where we have to use makefile and sh file.</p>
  
  <p><em><strong>one Example of this to compile a hello.c file with Makefile and shell file</em></strong></p>
  
  <p>shell.sh</p>
  
  <pre><code>param="$1";
  
  CC="gcc"
  
  CFLAGS="-c -Wall";
  
  if [ "$param" == "clean" ];
  
  then
  
   rm -rf hello
  
  else
  
  $CC $CFLAGS hello.c -o hello
  
  fi
  </code></pre>
  
  <ol>
  <li><code>./shell.sh</code> { will build hello.c file }</li>
  <li><code>./shell.sh clean</code> { this will clean the build file }</li>
  </ol>
  
  <p><strong>Same thing with Makefile..</strong></p>
  
  <pre><code>CC=gcc
  
  CFLAGS=-c -Wall
  
  hello: hello.c
          $(CC) $(CFLAGS) hello.c -o hello
  
  clean:
          rm -rf hello 
  </code></pre>
  
  <p><code>make</code>  {it will build}<br>
  <code>make clean</code> {it will clean build file}</p>
  
  <p>Both files can generate same output.
  This question because some people use Makefile and some people use shell..</p>