blob: e348a54675b53e13bb492bb697e3c745b898ea07 [file] [log] [blame]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<html lang="en">
<head>
<meta http-equiv="Content-Language" content="en-us">
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Creating your makefile</title>
<link rel="stylesheet" type="text/css" href="../help.css">
</head>
<body>
<h1>Creating your makefile</h1>
<p>For the purpose of this tutorial, you were instructed to create a Standard
Make C++ Project which requires you to create a makefile. Managed Make C/C++ projects generate makefiles for you.</p>
<p>To create your makefile:</p>
<ol>
<li>In the <b>C++ Projects</b> view, right-click the <b>HelloWorld</b> project
folder and select <b>New &gt; File</b>.</li>
<li>In the <b>File name</b> box, type <b>makefile</b>.</li>
<li>Click <b>Finish</b>.</li>
<li>Type the gnu make instructions below in the editor. Lines are
indented with tab characters, not with spaces.</li>
<blockquote>
<p>
<br>
all: hello.exe<br>
<br>
clean:<br>
&nbsp;&nbsp;&nbsp; rm main.o hello.exe<br>
<br>
hello.exe: main.o<br>
&nbsp;&nbsp;&nbsp; g++ -g -o hello main.o<br>
<br>
main.o:<br>
&nbsp;&nbsp;&nbsp; g++ -c -g main.cpp<br>
&nbsp;</p>
</blockquote>
<li>Click <b>File &gt;
Save</b>.</li></ol>
<p>Your new makefile, along with your main.cpp file are
displayed in the C/C++ Projects view and in the Navigator view. Your project now
contains main.cpp and makefile. You can now build your HelloWorld project.</p>
<p>
<a href="cdt_w_build.htm" style="text-decoration: none">
<img border="0" src="../images/ngnext.gif" width="16" height="16"></a>
<b><a href="cdt_w_build.htm">
Next: Building your project</a><a href="cdt_w_build.htm" style="text-decoration: none"> </a> </b>
</p>
<p align="left">
<a href="cdt_w_newcpp.htm">
<img border="0" src="../images/ngback.gif" width="16" height="16"></a> <b><a href="cdt_w_newcpp.htm">Back: Creating your C++ file</a></b> </p>
<p><img border="0" src="../images/ngconcepts.gif" ALT="Related concepts" width="143" height="21">
<br>
<a href="../concepts/cdt_o_projects.htm">Project</a><br>
<a href="../concepts/cdt_o_code_entry.htm">Code entry</a></p>
<p><img border="0" src="../images/ngtasks.gif" ALT="Related tasks" width="143" height="21">
<br>
<a href="../tasks/cdt_o_proj_files.htm">Working with C/C++ project files</a><br>
<a href="../tasks/cdt_o_write_code.htm">Writing code</a></p>
<p><img border="0" src="../images/ngref.gif" ALT="Related reference" width="143" height="21">
<br>
<a href="../reference/cdt_o_proj_prop_pages.htm">C/C++ Projects view</a></p>
<p>
<img src="../images/ng03_04.gif" ALT="IBM Copyright Statement" BORDER=0 width="324" height="14">
</body>
</html>