title: Creating makefile and build file for c++ program
body: <p>I 'm new to linux, I have read many tutorials on how to make a <code>makefile</code> but couldn't create it. I m trying to write a <code>makefile</code> which creates a new file copy the content of <code>format.cpp</code> in the new file and launch that file in <code>sublime</code>.
  e.g if I type <code>make hello.cpp</code>, then it will create a new file <code>hello.cpp</code> and will copy the content of <code>format.cpp</code> into this <code>hello.cpp</code> and launch this file in <code>sublime</code>.</p>
  
  <p>Secondly, I m trying to write a <code>build</code> file which compiles and runs that c++ file.
  e.g currently I m compiling and running my c++ file as</p>
  
  <pre><code>g++ -o hello hello.cpp
  ./hello &lt; input.txt &gt; output.txt`
  </code></pre>
  
  <p>Please Help!!!</p>
  
  <p>The code for makefile is:</p>
  
  <pre><code>src?=a.cpp
  </code></pre>
  
  <p><code>new:
      rm -f *.o *.out*
      cp format.cpp a.cpp
      subl a.in a.cpp</code></p>
  
  <p>The code for build is:</p>
  
  <pre><code>in: $(src)
  g++ -std=c++14 -fmax-errors=1 -DLOCAL -O3 $(src) -o a.out
  ./a.out &lt; input.txt &gt; output.txt
  subl output.txt
  </code></pre>
  
  <p>If we dont type any file name then it will open a.cpp by default</p>