{"id":155201,"date":"2012-10-18T14:53:03","date_gmt":"2012-10-18T10:53:03","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=155201"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=155201","title":{"rendered":"<span class=\"post_title\">Makefile \u0434\u043b\u044f \u0441\u0430\u043c\u044b\u0445 \u043c\u0430\u043b\u0435\u043d\u044c\u043a\u0438\u0445<\/span>"},"content":{"rendered":"<div class=\"content html_format\">   \t\u041d\u0435 \u043e\u0447\u0435\u043d\u044c \u0441\u0442\u0440\u043e\u0433\u0438\u0439 \u043f\u0435\u0440\u0435\u0432\u043e\u0434 \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u0430 <a href=\"http:\/\/mrbook.org\/tutorials\/make\/\">mrbook.org\/tutorials\/make\/<\/a> \u041c\u043d\u0435 \u0432 \u0441\u0432\u043e\u0435 \u0432\u0440\u0435\u043c\u044f \u043e\u0447\u0435\u043d\u044c \u043d\u0435 \u0445\u0432\u0430\u0442\u0438\u043b\u043e \u043f\u043e\u0434\u043e\u0431\u043d\u043e\u0439 \u043c\u0435\u0442\u043e\u0434\u0438\u0447\u043a\u0438 \u0434\u043b\u044f \u043f\u043e\u043d\u0438\u043c\u0430\u043d\u0438\u044f \u0431\u0430\u0437\u043e\u0432\u044b\u0445 \u0432\u0435\u0449\u0435\u0439 \u043e make. \u0414\u0443\u043c\u0430\u044e, \u0431\u0443\u0434\u0435\u0442 \u0445\u043e\u0442\u044c \u043a\u043e\u043c\u0443-\u043d\u0438\u0431\u0443\u0434\u044c \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e. \u0425\u043e\u0442\u044f \u044d\u0442\u0430 \u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u044f \u0438 \u043e\u0442\u043c\u0438\u0440\u0430\u0435\u0442, \u043d\u043e \u0432\u0441\u0435 \u0440\u0430\u0432\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0432 \u043e\u0447\u0435\u043d\u044c \u043c\u043d\u043e\u0433\u0438\u0445 \u043f\u0440\u043e\u0435\u043a\u0442\u0430\u0445. \u041a\u0430\u0440\u043c\u044b \u043d\u0430 \u0445\u0430\u0431 \u00ab\u041f\u0435\u0440\u0435\u0432\u043e\u0434\u044b\u00bb \u043d\u0435 \u0445\u0432\u0430\u0442\u0438\u043b\u043e, \u043a\u0430\u043a \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u044f\u0432\u0438\u0442\u0441\u044f \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u2014 \u0434\u043e\u0431\u0430\u0432\u043b\u044e \u0438 \u0442\u0443\u0434\u0430. \u0415\u0441\u043b\u0438 \u0435\u0441\u0442\u044c \u043e\u0448\u0438\u0431\u043a\u0438 \u0432 \u043e\u0444\u043e\u0440\u043c\u043b\u0435\u043d\u0438\u0438, \u0442\u043e \u043f\u0440\u043e\u0448\u0443 \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u043d\u0430 \u043d\u0438\u0445. \u0411\u0443\u0434\u0443 \u0438\u0441\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c.<\/p>\n<p>  \u0421\u0442\u0430\u0442\u044c\u044f \u0431\u0443\u0434\u0435\u0442 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u0430\u044f \u043f\u0440\u0435\u0436\u0434\u0435 \u0432\u0441\u0435\u0433\u043e \u0438\u0437\u0443\u0447\u0430\u044e\u0449\u0438\u043c \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043d\u0430 C\/C++ \u0432 UNIX-\u043f\u043e\u0434\u043e\u0431\u043d\u044b\u0445 \u0441\u0438\u0441\u0442\u0435\u043c\u0430\u0445 \u043e\u0442 \u0441\u0430\u043c\u044b\u0445 \u043a\u043e\u0440\u043d\u0435\u0439, \u0431\u0435\u0437 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f IDE. <\/p>\n<p>  \u041a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u0440\u043e\u0435\u043a\u0442 \u0440\u0443\u0447\u043a\u0430\u043c\u0438 \u2014 \u0437\u0430\u043d\u044f\u0442\u0438\u0435 \u0432\u0435\u0441\u044c\u043c\u0430 \u0443\u0442\u043e\u043c\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0435, \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u043a\u043e\u0433\u0434\u0430 \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0445 \u0444\u0430\u0439\u043b\u043e\u0432 \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u0431\u043e\u043b\u044c\u0448\u0435 \u043e\u0434\u043d\u043e\u0433\u043e, \u0438 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0438\u0437 \u043d\u0438\u0445 \u043d\u0430\u0434\u043e \u043a\u0430\u0436\u0434\u044b\u0439 \u0440\u0430\u0437 \u043d\u0430\u0431\u0438\u0432\u0430\u0442\u044c \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438 \u0438 \u043b\u0438\u043d\u043a\u043e\u0432\u043a\u0438. \u041d\u043e \u043d\u0435 \u0432\u0441\u0435 \u0442\u0430\u043a \u043f\u043b\u043e\u0445\u043e. \u0421\u0435\u0439\u0447\u0430\u0441 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0443\u0447\u0438\u0442\u044c\u0441\u044f \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u041c\u0435\u0439\u043a\u0444\u0430\u0439\u043b\u044b. Makefile \u2014 \u044d\u0442\u043e \u043d\u0430\u0431\u043e\u0440 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0439 \u0434\u043b\u044f \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b make, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u043e\u043c\u043e\u0433\u0430\u0435\u0442 \u0441\u043e\u0431\u0438\u0440\u0430\u0442\u044c \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043d\u044b\u0439 \u043f\u0440\u043e\u0435\u043a\u0442 \u0431\u0443\u043a\u0432\u0430\u043b\u044c\u043d\u043e \u0432 \u043e\u0434\u043d\u043e \u043a\u0430\u0441\u0430\u043d\u0438\u0435.<br \/>  <a name=\"habracut\"><\/a><br \/>  \u0414\u043b\u044f \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0438 \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043c\u0438\u043a\u0440\u043e\u0441\u043a\u043e\u043f\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u043f\u0440\u043e\u0435\u043a\u0442 \u0430-\u043b\u044f Hello World \u0438\u0437 \u0447\u0435\u0442\u044b\u0440\u0435\u0445 \u0444\u0430\u0439\u043b\u043e\u0432 \u0432 \u043e\u0434\u043d\u043e\u043c \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0435:  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">main.cpp<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"cpp\">#include &lt;iostream&gt; #include &quot;functions.h&quot;  using namespace std;  int main(){     print_hello();     cout &lt;&lt; endl;     cout &lt;&lt; &quot;The factorial of 5 is &quot; &lt;&lt; factorial(5) &lt;&lt; endl;     return 0; } <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">hello.cpp<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"cpp\">#include &lt;iostream&gt; #include &quot;functions.h&quot;  using namespace std;  void print_hello(){    cout &lt;&lt; &quot;Hello World!&quot;; } <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">factorial.cpp<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"cpp\">#include &quot;functions.h&quot;  int factorial(int n){     if(n!=1){ \treturn(n * factorial(n-1));     }     else return 1; } <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">functions.h<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"cpp\">void print_hello(); int factorial(int n); <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u0412\u0441\u0435 \u0441\u043a\u043e\u043f\u043e\u043c \u043c\u043e\u0436\u043d\u043e \u0441\u043a\u0430\u0447\u0430\u0442\u044c <a href=\"https:\/\/docs.google.com\/open?id=0B_vFocZhMNUDc1VUR1VzWkJCQTQ\">\u043e\u0442\u0441\u044e\u0434\u0430<\/a><br \/>  \u0410\u0432\u0442\u043e\u0440 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b \u044f\u0437\u044b\u043a C++, \u0437\u043d\u0430\u0442\u044c \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u043e\u0432\u0441\u0435\u043c \u043d\u0435 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e, \u0438 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440 g++ \u0438\u0437 gcc. \u041b\u044e\u0431\u043e\u0439 \u0434\u0440\u0443\u0433\u043e\u0439 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440 \u0441\u043a\u043e\u0440\u0435\u0435 \u0432\u0441\u0435\u0433\u043e \u0442\u043e\u0436\u0435 \u043f\u043e\u0434\u043e\u0439\u0434\u0435\u0442. \u0424\u0430\u0439\u043b\u044b \u0441\u043b\u0435\u0433\u043a\u0430 \u043f\u043e\u0434\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u044b, \u0447\u0442\u043e\u0431\u044b \u0441\u043e\u0431\u0438\u0440\u0430\u043b\u0438\u0441\u044c gcc 4.7.1<\/p>\n<h5>\u041f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 make<\/h5>\n<p>  \u0415\u0441\u043b\u0438 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c<br \/>  <code>make<\/code><br \/>  \u0442\u043e \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u043f\u043e\u043f\u044b\u0442\u0430\u0435\u0442\u0441\u044f \u043d\u0430\u0439\u0442\u0438 \u0444\u0430\u0439\u043b \u0441 \u0438\u043c\u0435\u043d\u0435\u043c \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u0435 <code>makefile<\/code> \u0432 \u0442\u0435\u043a\u0443\u0449\u0435\u043c \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0435 \u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438 \u0438\u0437 \u043d\u0435\u0433\u043e. \u0415\u0441\u043b\u0438 \u0432 \u0442\u0435\u043a\u0443\u0449\u0435\u043c \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0435 \u0435\u0441\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043c\u0435\u0439\u043a\u0444\u0430\u0439\u043b\u043e\u0432, \u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u043d\u0430 \u043d\u0443\u0436\u043d\u044b\u0439 \u0432\u043e\u0442 \u0442\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<br \/>  <code>make -f MyMakefile<\/code><br \/>  \u0415\u0441\u0442\u044c \u0435\u0449\u0435 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u0434\u0440\u0443\u0433\u0438\u0445 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432, \u043d\u0430\u043c \u043f\u043e\u043a\u0430 \u043d\u0435 \u043d\u0443\u0436\u043d\u044b\u0445. \u041e \u043d\u0438\u0445 \u043c\u043e\u0436\u043d\u043e \u0443\u0437\u043d\u0430\u0442\u044c \u0432 \u043c\u0430\u043d-\u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0435.<\/p>\n<h5>\u041f\u0440\u043e\u0446\u0435\u0441\u0441 \u0441\u0431\u043e\u0440\u043a\u0438<\/h5>\n<p>  \u041a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440 \u0431\u0435\u0440\u0435\u0442 \u0444\u0430\u0439\u043b\u044b \u0441 \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u043c \u043a\u043e\u0434\u043e\u043c \u0438 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442 \u0438\u0437 \u043d\u0438\u0445 \u043e\u0431\u044a\u0435\u043a\u0442\u043d\u044b\u0435 \u0444\u0430\u0439\u043b\u044b. \u0417\u0430\u0442\u0435\u043c \u043b\u0438\u043d\u043a\u043e\u0432\u0449\u0438\u043a \u0431\u0435\u0440\u0435\u0442 \u043e\u0431\u044a\u0435\u043a\u0442\u043d\u044b\u0435 \u0444\u0430\u0439\u043b\u044b \u0438 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442 \u0438\u0437 \u043d\u0438\u0445 \u0438\u0441\u043f\u043e\u043b\u043d\u044f\u0435\u043c\u044b\u0439 \u0444\u0430\u0439\u043b. \u0421\u0431\u043e\u0440\u043a\u0430 = \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u044f + \u043b\u0438\u043d\u043a\u043e\u0432\u043a\u0430.<\/p>\n<h5>\u041a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u044f \u0440\u0443\u043a\u0430\u043c\u0438<\/h5>\n<p>  \u0421\u0430\u043c\u044b\u0439 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u0441\u043e\u0431\u0440\u0430\u0442\u044c \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443:<br \/>  <code>g++ main.cpp hello.cpp factorial.cpp -o hello<\/code><br \/>  \u041a\u0430\u0436\u0434\u044b\u0439 \u0440\u0430\u0437 \u043d\u0430\u0431\u0438\u0440\u0430\u0442\u044c \u0442\u0430\u043a\u043e\u0435 \u043d\u0435\u0443\u0434\u043e\u0431\u043d\u043e, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0431\u0443\u0434\u0435\u043c \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c.<\/p>\n<h5>\u0421\u0430\u043c\u044b\u0439 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u041c\u0435\u0439\u043a\u0444\u0430\u0439\u043b<\/h5>\n<p>  \u0412 \u043d\u0435\u043c \u0434\u043e\u043b\u0436\u043d\u044b \u0431\u044b\u0442\u044c \u0442\u0430\u043a\u0438\u0435 \u0447\u0430\u0441\u0442\u0438:  <\/p>\n<pre><code class=\"cmake\">\u0446\u0435\u043b\u044c: \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 [tab] \u043a\u043e\u043c\u0430\u043d\u0434\u0430 <\/code><\/pre>\n<p>  \u0414\u043b\u044f \u043d\u0430\u0448\u0435\u0433\u043e \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u043c\u0435\u0439\u043a\u0444\u0430\u0439\u043b \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u0442\u0430\u043a:  <\/p>\n<pre><code class=\"cmake\">all: \tg++ main.cpp hello.cpp factorial.cpp -o hello <\/code><\/pre>\n<p>  \u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u0447\u0442\u043e \u0441\u0442\u0440\u043e\u043a\u0430 \u0441 \u043a\u043e\u043c\u0430\u043d\u0434\u043e\u0439 \u0434\u043e\u043b\u0436\u043d\u0430 \u043d\u0430\u0447\u0438\u043d\u0430\u0442\u044c\u0441\u044f \u0441 \u0442\u0430\u0431\u0443\u043b\u044f\u0446\u0438\u0438! \u0421\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u0435 \u044d\u0442\u043e \u043f\u043e\u0434 \u0438\u043c\u0435\u043d\u0435\u043c <code>Makefile-1<\/code> \u0432 \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0435 \u0441 \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u043c \u0438 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u0435 \u0441\u0431\u043e\u0440\u043a\u0443 \u043a\u043e\u043c\u0430\u043d\u0434\u043e\u0439 <code>make -f Makefile-1<\/code><br \/>  \u0412 \u043f\u0435\u0440\u0432\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0446\u0435\u043b\u044c \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f <code>all<\/code>. \u042d\u0442\u043e \u0446\u0435\u043b\u044c \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0434\u043b\u044f \u043c\u0435\u0439\u043a\u0444\u0430\u0439\u043b\u0430, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c\u0441\u044f, \u0435\u0441\u043b\u0438 \u043d\u0438\u043a\u0430\u043a\u0430\u044f \u0434\u0440\u0443\u0433\u0430\u044f \u0446\u0435\u043b\u044c \u043d\u0435 \u0443\u043a\u0430\u0437\u0430\u043d\u0430 \u044f\u0432\u043d\u043e. \u0422\u0430\u043a\u0436\u0435 \u0443 \u044d\u0442\u043e\u0439 \u0446\u0435\u043b\u0438 \u0432 \u044d\u0442\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u043d\u0435\u0442 \u043d\u0438\u043a\u0430\u043a\u0438\u0445 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0435\u0439, \u0442\u0430\u043a \u0447\u0442\u043e make \u0441\u0440\u0430\u0437\u0443 \u043f\u0440\u0438\u0441\u0442\u0443\u043f\u0430\u0435\u0442 \u043a \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044e \u043d\u0443\u0436\u043d\u043e\u0439 \u043a\u043e\u043c\u0430\u043d\u0434\u044b. \u0410 \u043a\u043e\u043c\u0430\u043d\u0434\u0430 \u0432 \u0441\u0432\u043e\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440.<\/p>\n<h5>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0435\u0439<\/h5>\n<p>  \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0446\u0435\u043b\u0435\u0439 \u0432 \u043e\u0434\u043d\u043e\u043c \u043c\u0435\u0439\u043a\u0444\u0430\u0439\u043b\u0435 \u043f\u043e\u043b\u0435\u0437\u043d\u043e \u0434\u043b\u044f \u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u0432. \u042d\u0442\u043e \u0441\u0432\u044f\u0437\u0430\u043d\u043e \u0441 \u0442\u0435\u043c, \u0447\u0442\u043e \u043f\u0440\u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0438 \u043e\u0434\u043d\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430 \u043d\u0435 \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f \u043f\u0435\u0440\u0435\u0441\u043e\u0431\u0438\u0440\u0430\u0442\u044c \u0432\u0435\u0441\u044c \u043f\u0440\u043e\u0435\u043a\u0442, \u0430 \u043c\u043e\u0436\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u043e\u0431\u043e\u0439\u0442\u0438\u0441\u044c \u043f\u0435\u0440\u0435\u0441\u0431\u043e\u0440\u043a\u043e\u0439 \u0442\u043e\u043b\u044c\u043a\u043e \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u043d\u043e\u0439 \u0447\u0430\u0441\u0442\u0438. \u041f\u0440\u0438\u043c\u0435\u0440:  <\/p>\n<pre><code class=\"cmake\">all: hello  hello: main.o factorial.o hello.o \tg++ main.o factorial.o hello.o -o hello  main.o: main.cpp \tg++ -c main.cpp  factorial.o: factorial.cpp \tg++ -c factorial.cpp  hello.o: hello.cpp \tg++ -c hello.cpp  clean: \trm -rf *o hello <\/code><\/pre>\n<p>  \u042d\u0442\u043e \u043d\u0430\u0434\u043e \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c \u043f\u043e\u0434 \u0438\u043c\u0435\u043d\u0435\u043c <code>Makefile-2<\/code> \u0432\u0441\u0435 \u0432 \u0442\u043e\u043c \u0436\u0435 \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0435<\/p>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u0443 \u0446\u0435\u043b\u0438 <code>all<\/code> \u0435\u0441\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u044c, \u043d\u043e \u043d\u0435\u0442 \u043a\u043e\u043c\u0430\u043d\u0434\u044b. \u0412 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 make \u043f\u0440\u0438 \u0432\u044b\u0437\u043e\u0432\u0435 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442 \u0432\u0441\u0435 \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u044b\u0435 \u0432 \u0444\u0430\u0439\u043b\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u044d\u0442\u043e\u0439 \u0446\u0435\u043b\u0438.<br \/>  \u0415\u0449\u0435 \u0434\u043e\u0431\u0430\u0432\u0438\u043b\u0430\u0441\u044c \u043d\u043e\u0432\u0430\u044f \u0446\u0435\u043b\u044c <code>clean<\/code>. \u041e\u043d\u0430 \u0442\u0440\u0430\u0434\u0438\u0446\u0438\u043e\u043d\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u0431\u044b\u0441\u0442\u0440\u043e\u0439 \u043e\u0447\u0438\u0441\u0442\u043a\u0438 \u0432\u0441\u0435\u0445 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432 \u0441\u0431\u043e\u0440\u043a\u0438 \u043f\u0440\u043e\u0435\u043a\u0442\u0430. \u041e\u0447\u0438\u0441\u0442\u043a\u0430 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442\u0441\u044f \u0442\u0430\u043a: <code>make -f Makefile-2 clean<\/code><\/p>\n<h5>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0438 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0435\u0432<\/h5>\n<p>  \u041f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u0448\u0438\u0440\u043e\u043a\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u0432 \u043c\u0435\u0439\u043a\u0444\u0430\u0439\u043b\u0430\u0445. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u044d\u0442\u043e \u0443\u0434\u043e\u0431\u043d\u044b\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u0443\u0447\u0435\u0441\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u043f\u0440\u043e\u0435\u043a\u0442 \u0431\u0443\u0434\u0443\u0442 \u0441\u043e\u0431\u0438\u0440\u0430\u0442\u044c \u0434\u0440\u0443\u0433\u0438\u043c \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u043e\u043c \u0438\u043b\u0438 \u0441 \u0434\u0440\u0443\u0433\u0438\u043c\u0438 \u043e\u043f\u0446\u0438\u044f\u043c\u0438.  <\/p>\n<pre><code class=\"cmake\"># \u042d\u0442\u043e \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0439, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0433\u043e\u0432\u043e\u0440\u0438\u0442, \u0447\u0442\u043e \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f CC \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0439 \u0434\u043b\u044f \u0441\u0431\u043e\u0440\u043a\u0438 CC=g++ #\u042d\u0442\u043e \u0435\u0449\u0435 \u043e\u0434\u0438\u043d \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0439. \u041e\u043d \u043f\u043e\u044f\u0441\u043d\u044f\u0435\u0442, \u0447\u0442\u043e \u0432 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 CFLAGS \u043b\u0435\u0436\u0430\u0442 \u0444\u043b\u0430\u0433\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u0435\u0440\u0435\u0434\u0430\u044e\u0442\u0441\u044f \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u0443 CFLAGS=-c -Wall  all: hello  hello: main.o factorial.o hello.o \t$(CC) main.o factorial.o hello.o -o hello  main.o: main.cpp \t$(CC) $(CFLAGS) main.cpp  factorial.o: factorial.cpp \t$(CC) $(CFLAGS) factorial.cpp  hello.o: hello.cpp \t$(CC) $(CFLAGS) hello.cpp  clean: \trm -rf *o hello <\/code><\/pre>\n<p>  \u042d\u0442\u043e <code>Makefile-3<\/code><br \/>  \u041f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u2014 \u043e\u0447\u0435\u043d\u044c \u0443\u0434\u043e\u0431\u043d\u0430\u044f \u0448\u0442\u0443\u043a\u0430. \u0414\u043b\u044f \u0438\u0445 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u043d\u0430\u0434\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u0440\u0438\u0441\u0432\u043e\u0438\u0442\u044c \u0438\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0434\u043e \u043c\u043e\u043c\u0435\u043d\u0442\u0430 \u0438\u0445 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f. \u041f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0442\u044c \u0438\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0432 \u043d\u0443\u0436\u043d\u043e\u0435 \u043c\u0435\u0441\u0442\u043e \u0432\u043e\u0442 \u0442\u0430\u043a\u0438\u043c \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u043c: <code>$(VAR)<\/code><\/p>\n<h5>\u0427\u0442\u043e \u0434\u0435\u043b\u0430\u0442\u044c \u0434\u0430\u043b\u044c\u0448\u0435<\/h5>\n<p>  \u041f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u043a\u0440\u0430\u0442\u043a\u043e\u0433\u043e \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u0430\u0436\u0430 \u0443\u0436\u0435 \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0442\u044c \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u043f\u0440\u043e\u0441\u0442\u044b\u0435 \u043c\u0435\u0439\u043a\u0444\u0430\u0439\u043b\u044b \u0441\u0430\u043c\u043e\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u043e. \u0414\u0430\u043b\u044c\u0448\u0435 \u043d\u0430\u0434\u043e \u0447\u0438\u0442\u0430\u0442\u044c \u0441\u0435\u0440\u044c\u0435\u0437\u043d\u044b\u0435 \u0443\u0447\u0435\u0431\u043d\u0438\u043a\u0438 \u0438 \u0440\u0443\u043a\u043e\u0432\u043e\u0434\u0441\u0442\u0432\u0430. \u041a\u0430\u043a \u0444\u0438\u043d\u0430\u043b\u044c\u043d\u044b\u0439 \u0430\u043a\u043a\u043e\u0440\u0434 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0442\u044c \u0441\u0430\u043c\u043e\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u043e \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u0442\u044c \u0438 \u043e\u0441\u043e\u0437\u043d\u0430\u0442\u044c \u0442\u0430\u043a\u043e\u0439 \u0443\u043d\u0438\u0432\u0435\u0440\u0441\u0430\u043b\u044c\u043d\u044b\u0439 \u043c\u0435\u0439\u043a\u0444\u0430\u0439\u043b, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u043e\u0436\u043d\u043e \u0432 \u0434\u0432\u0430 \u043a\u0430\u0441\u0430\u043d\u0438\u044f \u0430\u0434\u0430\u043f\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u043e\u0434 \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043b\u044e\u0431\u043e\u0439 \u043f\u0440\u043e\u0435\u043a\u0442:  <\/p>\n<pre><code class=\"cmake\">CC=g++ CFLAGS=-c -Wall LDFLAGS= SOURCES=main.cpp hello.cpp factorial.cpp OBJECTS=$(SOURCES:.cpp=.o) EXECUTABLE=hello  all: $(SOURCES) $(EXECUTABLE) \t $(EXECUTABLE): $(OBJECTS)  \t$(CC) $(LDFLAGS) $(OBJECTS) -o $@  .cpp.o: \t$(CC) $(CFLAGS) $&lt; -o $@ <\/code><\/pre>\n<p>  <code>Makefile-4<\/code><br \/>  \u0423\u0441\u043f\u0435\u0445\u043e\u0432!    \t   \t<\/p>\n<div class=\"clear\"><\/div>\n<\/p><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"http:\/\/habrahabr.ru\/post\/155201\/\"> http:\/\/habrahabr.ru\/post\/155201\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"content html_format\">   \t\u041d\u0435 \u043e\u0447\u0435\u043d\u044c \u0441\u0442\u0440\u043e\u0433\u0438\u0439 \u043f\u0435\u0440\u0435\u0432\u043e\u0434 \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u0430 <a href=\"http:\/\/mrbook.org\/tutorials\/make\/\">mrbook.org\/tutorials\/make\/<\/a> \u041c\u043d\u0435 \u0432 \u0441\u0432\u043e\u0435 \u0432\u0440\u0435\u043c\u044f \u043e\u0447\u0435\u043d\u044c \u043d\u0435 \u0445\u0432\u0430\u0442\u0438\u043b\u043e \u043f\u043e\u0434\u043e\u0431\u043d\u043e\u0439 \u043c\u0435\u0442\u043e\u0434\u0438\u0447\u043a\u0438 \u0434\u043b\u044f \u043f\u043e\u043d\u0438\u043c\u0430\u043d\u0438\u044f \u0431\u0430\u0437\u043e\u0432\u044b\u0445 \u0432\u0435\u0449\u0435\u0439 \u043e make. \u0414\u0443\u043c\u0430\u044e, \u0431\u0443\u0434\u0435\u0442 \u0445\u043e\u0442\u044c \u043a\u043e\u043c\u0443-\u043d\u0438\u0431\u0443\u0434\u044c \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e. \u0425\u043e\u0442\u044f \u044d\u0442\u0430 \u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u044f \u0438 \u043e\u0442\u043c\u0438\u0440\u0430\u0435\u0442, \u043d\u043e \u0432\u0441\u0435 \u0440\u0430\u0432\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0432 \u043e\u0447\u0435\u043d\u044c \u043c\u043d\u043e\u0433\u0438\u0445 \u043f\u0440\u043e\u0435\u043a\u0442\u0430\u0445. \u041a\u0430\u0440\u043c\u044b \u043d\u0430 \u0445\u0430\u0431 \u00ab\u041f\u0435\u0440\u0435\u0432\u043e\u0434\u044b\u00bb \u043d\u0435 \u0445\u0432\u0430\u0442\u0438\u043b\u043e, \u043a\u0430\u043a \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u044f\u0432\u0438\u0442\u0441\u044f \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u2014 \u0434\u043e\u0431\u0430\u0432\u043b\u044e \u0438 \u0442\u0443\u0434\u0430. \u0415\u0441\u043b\u0438 \u0435\u0441\u0442\u044c \u043e\u0448\u0438\u0431\u043a\u0438 \u0432 \u043e\u0444\u043e\u0440\u043c\u043b\u0435\u043d\u0438\u0438, \u0442\u043e \u043f\u0440\u043e\u0448\u0443 \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u043d\u0430 \u043d\u0438\u0445. \u0411\u0443\u0434\u0443 \u0438\u0441\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c.<\/p>\n<p>  \u0421\u0442\u0430\u0442\u044c\u044f \u0431\u0443\u0434\u0435\u0442 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u0430\u044f \u043f\u0440\u0435\u0436\u0434\u0435 \u0432\u0441\u0435\u0433\u043e \u0438\u0437\u0443\u0447\u0430\u044e\u0449\u0438\u043c \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043d\u0430 C\/C++ \u0432 UNIX-\u043f\u043e\u0434\u043e\u0431\u043d\u044b\u0445 \u0441\u0438\u0441\u0442\u0435\u043c\u0430\u0445 \u043e\u0442 \u0441\u0430\u043c\u044b\u0445 \u043a\u043e\u0440\u043d\u0435\u0439, \u0431\u0435\u0437 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f IDE. <\/p>\n<p>  \u041a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u0440\u043e\u0435\u043a\u0442 \u0440\u0443\u0447\u043a\u0430\u043c\u0438 \u2014 \u0437\u0430\u043d\u044f\u0442\u0438\u0435 \u0432\u0435\u0441\u044c\u043c\u0430 \u0443\u0442\u043e\u043c\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0435, \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u043a\u043e\u0433\u0434\u0430 \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0445 \u0444\u0430\u0439\u043b\u043e\u0432 \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u0431\u043e\u043b\u044c\u0448\u0435 \u043e\u0434\u043d\u043e\u0433\u043e, \u0438 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0438\u0437 \u043d\u0438\u0445 \u043d\u0430\u0434\u043e \u043a\u0430\u0436\u0434\u044b\u0439 \u0440\u0430\u0437 \u043d\u0430\u0431\u0438\u0432\u0430\u0442\u044c \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438 \u0438 \u043b\u0438\u043d\u043a\u043e\u0432\u043a\u0438. \u041d\u043e \u043d\u0435 \u0432\u0441\u0435 \u0442\u0430\u043a \u043f\u043b\u043e\u0445\u043e. \u0421\u0435\u0439\u0447\u0430\u0441 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0443\u0447\u0438\u0442\u044c\u0441\u044f \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u041c\u0435\u0439\u043a\u0444\u0430\u0439\u043b\u044b. Makefile \u2014 \u044d\u0442\u043e \u043d\u0430\u0431\u043e\u0440 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0439 \u0434\u043b\u044f \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b make, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u043e\u043c\u043e\u0433\u0430\u0435\u0442 \u0441\u043e\u0431\u0438\u0440\u0430\u0442\u044c \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043d\u044b\u0439 \u043f\u0440\u043e\u0435\u043a\u0442 \u0431\u0443\u043a\u0432\u0430\u043b\u044c\u043d\u043e \u0432 \u043e\u0434\u043d\u043e \u043a\u0430\u0441\u0430\u043d\u0438\u0435.  <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-155201","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/155201","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=155201"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/155201\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=155201"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=155201"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=155201"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}