{"id":3461,"date":"2017-07-29T15:47:53","date_gmt":"2017-07-29T07:47:53","guid":{"rendered":"https:\/\/ixyzero.com\/blog\/?p=3461"},"modified":"2017-07-29T15:47:53","modified_gmt":"2017-07-29T07:47:53","slug":"%e6%ba%90%e7%a0%81%e7%bc%96%e8%af%91%e4%b8%adconfiguremakemake-install%e8%83%8c%e5%90%8e%e7%9a%84%e9%ad%94%e5%8a%9b","status":"publish","type":"post","link":"https:\/\/ixyzero.com\/blog\/archives\/3461.html","title":{"rendered":"\u6e90\u7801\u7f16\u8bd1\u4e2dconfigure&#038;&#038;make&#038;&#038;make install\u80cc\u540e\u7684\u9b54\u529b"},"content":{"rendered":"<p>=Start=<\/p>\n<h4 id=\"id-\u6a21\u677f-\u7f18\u7531\uff1a\">\u7f18\u7531\uff1a<\/h4>\n<p>\u63a5\u89e6Linux\u597d\u51e0\u5e74\u4e86\uff0c\u4ece\u4e00\u5f00\u59cb\u7684\u53ea\u4f1a\u5bf9\u7740\u7f51\u4e0a\u6559\u7a0b\u8fdb\u884c\u64cd\u4f5c\u5230\u73b0\u5728\u5df2\u7ecf\u80fd\u660e\u767d\u4e00\u4e9b\u64cd\u4f5c\/\u547d\u4ee4\u80cc\u540e\u7684\u539f\u7406\uff0c\u8fd9\u4e2d\u95f4\u7ecf\u5386\u4e86\u5f88\u591a\u3002\u867d\u7136\u73b0\u5728\u5728\u6e90\u7801\u7f16\u8bd1\u7684\u8fc7\u7a0b\u4e2d\u7ecf\u5e38\u7528\u5230 <code>.\/configure &amp;&amp; make &amp;&amp; make install<\/code> \u64cd\u4f5c\uff0c\u4e4b\u524d\u4e5f\u6709\u8fc7\u4e00\u5b9a\u7684\u5b66\u4e60\u3001\u4e86\u89e3\uff0c\u4ee5\u4e3a\u81ea\u5df1\u5df2\u7ecf\u61c2\u4e86\uff0c\u4f46\u6700\u8fd1\u5728\u5b9e\u9645\u63a5\u89e6\u4e00\u4e9b\u8f83\u5927\u7684\u5de5\u7a0b\u65f6\u624d\u53d1\u73b0\u81ea\u5df1\u77e5\u9053\u7684\u592a\u5c11\u4e86\uff0c\u5f88\u591a\u4e1c\u897f\u4f3c\u61c2\u975e\u61c2\uff0c\u9700\u8981\u91cd\u65b0\u6df1\u5165\u5b66\u4e60\u4e00\u4e0b\u3002<\/p>\n<h4 id=\"id-\u6a21\u677f-\u6b63\u6587\uff1a\">\u6b63\u6587\uff1a<\/h4>\n<h5 id=\"id-\u6a21\u677f-\u53c2\u8003\u89e3\u7b54\uff1a\">\u53c2\u8003\u89e3\u7b54\uff1a<\/h5>\n<h6><span style=\"color: #ff0000;\"><strong>\u6e90\u7801\u7f16\u8bd1\u548c\u5206\u53d1\u8fc7\u7a0b\u4e2d\u7684\u4e00\u4e9b\u547d\u4ee4\uff1a<\/strong><\/span><\/h6>\n<p>\u5728\u5f00\u53d1\/\u7ef4\u62a4\u8005\u7684\u7cfb\u7edf\u4e0a\uff1a<\/p>\n<pre class=\"lang:default decode:true\">aclocal # Set up an m4 environment\r\nautoconf # Generate configure from configure.ac\r\nautomake --add-missing # Generate Makefile.in from Makefile.am\r\n.\/configure # Generate Makefile from Makefile.in\r\nmake distcheck # Use Makefile to build and test a tarball to distribute<\/pre>\n<p>\u5728\u7ec8\u7aef\u7528\u6237\u7684\u7cfb\u7edf\u4e0a\uff1a<\/p>\n<pre class=\"lang:default decode:true\">.\/configure  # Generate Makefile from Makefile.in\r\nmake         # Use Makefile to build the program\r\nmake install # Use Makefile to install the program<\/pre>\n<hr \/>\n<h6 id=\"N10077\"><span style=\"color: #ff0000;\">\u751f\u6210 Makefile \u7684\u6765\u9f99\u53bb\u8109\uff1a<\/span><\/h6>\n<p>\u9996\u5148\u8fdb\u5165\u6e90\u4ee3\u7801\u6240\u5728\u76ee\u5f55\uff0c\u7136\u540e\u5728\u8be5\u76ee\u5f55\u4e0b\u8fd0\u884c\u4e00\u7cfb\u5217\u547d\u4ee4\uff0c\u521b\u5efa\u548c\u4fee\u6539\u51e0\u4e2a\u6587\u4ef6\uff0c\u5c31\u53ef\u4ee5\u751f\u6210\u7b26\u5408\u8be5\u5e73\u53f0\u7684Makefile\u6587\u4ef6\uff0c\u64cd\u4f5c\u8fc7\u7a0b\u5982\u4e0b\uff1a<\/p>\n<ol>\n<li>\u8fd0\u884cautoscan\u547d\u4ee4<\/li>\n<li>\u5c06configure.scan \u6587\u4ef6\u91cd\u547d\u540d\u4e3aconfigure.in\uff0c\u5e76\u4fee\u6539configure.in\u6587\u4ef6<\/li>\n<li>\u5728project\u76ee\u5f55\u4e0b\u65b0\u5efaMakefile.am\u6587\u4ef6\uff0c\u5e76\u5728core\u548cshell\u76ee\u5f55\u4e0b\u4e5f\u65b0\u5efamakefile.am\u6587\u4ef6<\/li>\n<li>\u5728project\u76ee\u5f55\u4e0b\u65b0\u5efaNEWS\u3001 README\u3001 ChangeLog \u3001AUTHORS\u6587\u4ef6<\/li>\n<li>\u5c06\/usr\/share\/automake-1.X\/\u76ee\u5f55\u4e0b\u7684depcomp\u548ccomplie\u6587\u4ef6\u62f7\u8d1d\u5230\u672c\u76ee\u5f55\u4e0b<\/li>\n<li>\u8fd0\u884caclocal\u547d\u4ee4<\/li>\n<li>\u8fd0\u884cautoconf\u547d\u4ee4<\/li>\n<li>\u8fd0\u884cautomake -a\u547d\u4ee4<\/li>\n<li>\u8fd0\u884c.\/confiugre\u811a\u672c<\/li>\n<\/ol>\n<p>\u5177\u4f53\u6d41\u7a0b\u56fe\u5982\u4e0b\uff1a<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-3462\" src=\"https:\/\/ixyzero.com\/blog\/wp-content\/uploads\/2017\/07\/\u751f\u6210Makefile\u6d41\u7a0b\u56fe.gif\" alt=\"\" width=\"468\" height=\"338\" \/><\/p>\n<hr \/>\n<div>\n<h6><span style=\"color: #ff0000;\"><strong>\u6211\u7684\u7406\u89e3\uff1a<\/strong><\/span><\/h6>\n<p>autoconf \u547d\u4ee4\u662f\u7528\u4e8e\u6839\u636e configure.in \u751f\u6210 configure \u6587\u4ef6\u7684\uff1b\u800c automake \u547d\u4ee4\u662f\u7528\u4e8e\u6839\u636e Makefile.am \u751f\u6210 Makefile.in \u6587\u4ef6\u7684\u3002<\/p>\n<p>Makefile.am\u662f\u4e00\u79cd\u6bd4Makefile\u66f4\u9ad8\u5c42\u6b21\u7684\u89c4\u5219\u3002<\/p>\n<\/div>\n<div><code>'source code' -&gt; 'configure.scan' -&gt; 'configure.in' -&gt; 'configure'+'Makefile.in' -&gt; 'Makefile'<\/code><\/div>\n<div><\/div>\n<ul>\n<li>.\/configure \u8fd9\u4e00\u6b65\u4e00\u822c\u7528\u6765\u751f\u6210 Makefile\uff0c\u540c\u65f6\u68c0\u67e5\u540e\u671f\u5728build\u548cinstall\u65f6\u7684\u4f9d\u8d56\u662f\u5426\u6ee1\u8db3\uff0c\u4ee5\u4e3a\u4e0b\u4e00\u6b65\u7684\u7f16\u8bd1\u505a\u51c6\u5907\uff0c\u4f60\u53ef\u4ee5\u901a\u8fc7\u5728 configure \u540e\u52a0\u4e0a\u53c2\u6570\u6765\u5bf9\u7f16\u8bd1\u9009\u9879\u3001\u5b89\u88c5\u4f4d\u7f6e\u8fdb\u884c\u63a7\u5236\uff1bconfigure\u811a\u672c\u8fd8\u6709\u4e00\u4e2a\u529f\u80fd\u5c31\u662f\u6839\u636e\u6a21\u677f Makefile.in \u751f\u6210 Makefile \u6587\u4ef6\uff1b<\/li>\n<li>make \u662f\u7528\u6765\u7f16\u8bd1\u7684\uff0c\u5b83\u4eceMakefile\u4e2d\u8bfb\u53d6\u6307\u4ee4\uff0c\u7136\u540e\u7f16\u8bd1\uff1b<\/li>\n<li>make install \u662f\u7528\u6765\u5b89\u88c5\u7684\uff0c\u5b83\u4e5f\u4eceMakefile\u4e2d\u8bfb\u53d6\u6307\u4ee4\uff0c\u5b89\u88c5\u5230\u6307\u5b9a\u7684\u4f4d\u7f6e\u3002<\/li>\n<\/ul>\n<h5 id=\"id-\u6a21\u677f-\u53c2\u8003\u94fe\u63a5\uff1a\">\u53c2\u8003\u94fe\u63a5\uff1a<\/h5>\n<p><span style=\"color: #ff0000;\"><strong>The magic behind configure, make, make install<\/strong><\/span><br \/>\n<a href=\"https:\/\/robots.thoughtbot.com\/the-magic-behind-configure-make-make-install\">https:\/\/robots.thoughtbot.com\/the-magic-behind-configure-make-make-install<\/a><\/p>\n<p><span style=\"color: #ff0000;\">What are Makefile.am and Makefile.in?<\/span><br \/>\n<a href=\"https:\/\/stackoverflow.com\/questions\/2531827\/what-are-makefile-am-and-makefile-in\">https:\/\/stackoverflow.com\/questions\/2531827\/what-are-makefile-am-and-makefile-in<\/a><\/p>\n<p><span style=\"color: #ff0000;\"><strong>\u4f8b\u89e3 autoconf \u548c automake \u751f\u6210 Makefile \u6587\u4ef6<\/strong><\/span><br \/>\n<a href=\"https:\/\/www.ibm.com\/developerworks\/cn\/linux\/l-makefile\/\">https:\/\/www.ibm.com\/developerworks\/cn\/linux\/l-makefile\/<\/a><\/p>\n<p>\u6df1\u5165\u7406\u89e3C\u8bed\u8a00<br \/>\n<a href=\"http:\/\/coolshell.cn\/articles\/5761.html\">http:\/\/coolshell.cn\/articles\/5761.html<\/a><\/p>\n<p><strong>\u8ddf\u6211\u4e00\u8d77\u5199 Makefile\uff08\u4e00\uff09<\/strong><br \/>\n<a href=\"http:\/\/blog.csdn.net\/haoel\/article\/details\/2886\">http:\/\/blog.csdn.net\/haoel\/article\/details\/2886<\/a><\/p>\n<p>\u5982\u4f55\u8c03\u8bd5makefile\u53d8\u91cf<br \/>\n<a href=\"http:\/\/coolshell.cn\/articles\/3790.html\">http:\/\/coolshell.cn\/articles\/3790.html<\/a><\/p>\n<p>\u5982\u4f55\u7cfb\u7edf\u5730\u5b66\u4e60 Makefile \u76f8\u5173\u7684\u77e5\u8bc6\uff08\u8bfb\/\u5199\uff09\uff1f<br \/>\n<a href=\"https:\/\/www.zhihu.com\/question\/23792247\">https:\/\/www.zhihu.com\/question\/23792247<\/a><\/p>\n<p>=END=<\/p>\n","protected":false},"excerpt":{"rendered":"<p>=Start= \u7f18\u7531\uff1a \u63a5\u89e6Linux\u597d\u51e0\u5e74\u4e86\uff0c\u4ece\u4e00\u5f00\u59cb\u7684\u53ea\u4f1a\u5bf9\u7740\u7f51\u4e0a\u6559\u7a0b\u8fdb\u884c\u64cd\u4f5c\u5230\u73b0\u5728\u5df2\u7ecf\u80fd\u660e\u767d\u4e00\u4e9b\u64cd\u4f5c\/\u547d [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[23,11,12],"tags":[875,30,876,877],"class_list":["post-3461","post","type-post","status-publish","format-standard","hentry","category-knowledgebase-2","category-linux","category-tools","tag-configure","tag-linux","tag-make","tag-makefile"],"views":3768,"_links":{"self":[{"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/posts\/3461","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/comments?post=3461"}],"version-history":[{"count":2,"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/posts\/3461\/revisions"}],"predecessor-version":[{"id":3464,"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/posts\/3461\/revisions\/3464"}],"wp:attachment":[{"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/media?parent=3461"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/categories?post=3461"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/tags?post=3461"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}