{"id":566,"date":"2022-02-08T17:40:13","date_gmt":"2022-02-08T09:40:13","guid":{"rendered":"http:\/\/124.223.94.246\/?p=566"},"modified":"2022-06-11T02:57:31","modified_gmt":"2022-06-10T18:57:31","slug":"ffmpeg-makefile%e7%bc%96%e8%af%91%e5%88%86%e6%9e%90","status":"publish","type":"post","link":"https:\/\/www.xianwaizhiyin.net\/?p=566","title":{"rendered":"ffmpeg-makefile\u7f16\u8bd1\u5206\u6790"},"content":{"rendered":"\n<p>\u672c\u6587\u4ee5 ffmpeg-n4.4.1 \u7684\u7248\u672c\u4e3a\u51c6\uff0c\u4e3b\u8981\u5206\u6790 ffmpeg \u9879\u76ee\u4e2d Makefile \u7684\u903b\u8f91\u3002<\/p>\n\n\n\n<p>\u6211\u7684\u73af\u5883\u662fwindow10 + msys2 \uff0c\u4ee5\u8fd9\u4e2a\u73af\u5883\u4e3a\u57fa\u7840\u8fdb\u884c\u8bb2\u89e3\u3002<\/p>\n\n\n\n<p>\u300affmpeg-configure\u7f16\u8bd1\u5206\u6790\u300b \u4e4b\u524d\u5df2\u7ecf\u8bb2\u89e3\u4e86 configure \u7684\u4f5c\u7528\uff0c\u5c31\u662f\u6839\u636e\u4e0d\u540c\u7684\u7f16\u8bd1\u73af\u5883\uff0c\u751f\u6210\u4e86\u76f8\u5e94\u7684 configure.h \u8ddf config.mak\u3002\u4f8b\u5982 \u5982\u679c\u6307\u5b9a --toolchain=msvc \uff0cmakefile\u91cc\u9762\u7684\u89c4\u5219 \u5c31\u4f1a\u4f7f\u7528vs2019\u7684 cl.exe \u8ddf link.exe \u6765\u7f16\u8bd1\u8ddf\u94fe\u63a5 C\u4ee3\u7801\u3002\u5982\u679c\u6ca1\u6307\u5b9a toolchain\uff0c \u5c31\u4f1a\u9ed8\u8ba4\u4f7f\u7528 msys2 \u91cc\u9762\u7684 gcc.exe \u6765\u7f16\u8bd1\u8ddf\u94fe\u63a5 C\u4ee3\u7801\u3002<\/p>\n\n\n\n<p>msys2 \u91cc\u9762\u6267\u884c<code class=\"prettyprint\" >.\/configure --toolchain=msvc<\/code> \u8ddf <code>.\/configure<\/code> \u751f\u6210\u7684 config.mak \u5dee\u5f02\u5982\u4e0b\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1484\" height=\"805\" src=\"\/wp-content\/uploads\/2022\/02\/mf-1-1.png\" alt=\"\" class=\"wp-image-567\"\/><\/figure>\n\n\n\n<p>\u4ece\u4e0a\u56fe\u53ef\u4ee5\u770b\u5230\uff0cconfigure \u7684\u65f6\u5019\u53ef\u4ee5\u901a\u8fc7 --toolchain \u5f71\u54cd\u7f16\u8bd1\u7684\u65f6\u5019\u4f7f\u7528\u4ec0\u4e48\u6837\u7684\u7f16\u8bd1\u5668\u3002<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p>google_ads_content<\/p>\n\n\n\n<hr class=\"wp-block-separator has-css-opacity\"\/>\n\n\n\n<p><strong>\u5e38\u89c1\u9519\u8bef\uff1a<\/strong><\/p>\n\n\n\n<p>1\uff0cMakefile:25: *** missing separator. Stop.<\/p>\n\n\n\n<p>\u4e0a\u9762\u7684\u9519\u8bef\u57fa\u672c\u4e0a\u662f\u56e0\u4e3a makefile \u4e2d\u8981\u6267\u884c\u7684\u547d\u4ee4\uff0c\u524d\u9762\u4e0d\u662ftab\u952e\uff0c\u800c\u662f\u51e0\u4e2a\u7a7a\u683c\uff0c\u7f16\u8f91\u5668\u95ee\u9898\u3002<\/p>\n\n\n\n<hr class=\"wp-block-separator has-css-opacity\"\/>\n\n\n\n<p>\u5728\u5f00\u59cb\u5206\u6790\u4e4b\u524d\uff0c\u8bb2\u4e00\u4e2a makefile \u7684\u8c03\u8bd5\u6280\u5de7\uff0c\u63a8\u8350\u9605\u8bfb<a href=\"https:\/\/coolshell.cn\/articles\/3790.html\">\u300a\u5982\u4f55\u8c03\u8bd5MAKEFILE\u53d8\u91cf\u300b<\/a><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"prettyprint\" >make -f Makefile -f vars.mk HOSTPROGS<\/code><\/pre>\n\n\n\n<p>\u8fd9\u91cc\u6211\u5bf9 vars.mk \u505a\u4e86\u70b9\u4fee\u6539\uff0c\u56e0\u4e3a\u6e90 vars.mk \u6ca1\u5904\u7406\u7279\u6b8a\u5b57\u7b26\uff0c\u76f4\u63a5echo \u4f1a\u62a5\u9519\u3002ffmpeg makefile \u7684\u53d8\u91cf\u5f88\u591a\u7279\u6b8a\u5b57\u7b26\u3002\u6211\u7528\u4e86 warning \u6765\u8f93\u51fa\uff0c\u5c31\u4e0d\u4f1a\u62a5\u9519\u3002<\/p>\n\n\n\n<p>vars.mk \u6587\u4ef6\u5185\u5bb9\u5982\u4e0b\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"prettyprint\" >%:\n    $(warning &#039;$*=$($*)&#039;)\n\u200b\nd-%:\n#   @printf &quot;%s =888 %s\\n&quot; &quot;abc&quot; $($*)\n    $(warning &#039;$*=$($*)&#039;)\n#   @echo &#039;$*=$($*)&#039;\n\u200b\n#   @echo &#039;  origin = $(origin $*)&#039;\n#   @echo &#039;   value = $(value  $*)&#039;\n#   @echo &#039;  flavor = $(flavor $*)&#039;<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-css-opacity\"\/>\n\n\n\n<p>\u73b0\u5728\u4ece\u7b2c\u4e00\u884c\u4ee3\u7801\u5f00\u59cb\u5206\u6790 ffmpeg \u91cc Makefile \u6587\u4ef6\u7684\u903b\u8f91\u3002\u4e0d\u719f\u6089 makefile \u7684\u53ef\u4ee5\u5148\u770b\u4e00\u904d<a href=\"https:\/\/seisman.github.io\/how-to-write-makefile\/invoke.html\">\u300a\u8ddf\u6211\u4e00\u8d77\u5199 makefile\u300b<\/a><\/p>\n\n\n\n<p><strong>\u7b2c1~2\u884c\u4ee3\u7801\u5982\u4e0b\uff1a<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"prettyprint\" >MAIN_MAKEFILE=1\ninclude ffbuild\/config.mak<\/code><\/pre>\n\n\n\n<p>\u5b9a\u4e49 MAIN_MAKEFILE \uff0c\u7136\u540e\u628a config.mak include\u8fdb\u6765\u3002config.mak \u6587\u4ef6\u91cc\u9762\u5168\u662f\u4e00\u4e9b\u53d8\u91cf\u7684\u5b9a\u4e49\u3002<\/p>\n\n\n\n<p>PS\uff1aMAIN_MAKEFILE \u53ef\u4ee5\u5f71\u54cd\u6539\u53d8 config.mak \u7684 SRC_PATH \u53d8\u91cf\uff0c\u4f30\u8ba1\u662f\u5904\u7406\u4e0d\u540c\u76ee\u5f55\u7684\u60c5\u51b5\u3002<\/p>\n\n\n\n<p><strong>\u7b2c4~16\u884c\u4ee3\u7801\u5982\u4e0b\uff1a<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"prettyprint\" >vpath %.c    $(SRC_PATH)\nvpath %.cpp  $(SRC_PATH)\nvpath %.h    $(SRC_PATH)\nvpath %.inc  $(SRC_PATH)\n\u7701\u7565<\/code><\/pre>\n\n\n\n<p>\u8fd9\u4e2a\u5176\u5b9e\u5c31\u662f\u6307\u5bfcmake \u7684\u65f6\u5019\u6587\u4ef6\u641c\u7d22\u8def\u5f84\uff0cvpath \u7684\u7528\u6cd5\u8bf7\u9605\u8bfb <a href=\"https:\/\/blog.csdn.net\/haoel\/article\/details\/2889\">\u300a\u8ddf\u6211\u4e00\u8d77\u5199 Makefile\uff08\u56db\uff09\u300b<\/a><\/p>\n\n\n\n<p><strong>\u7b2c18~19\u884c\u4ee3\u7801\u5982\u4e0b\uff1a<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"prettyprint\" >TESTTOOLS   = audiogen videogen rotozoom tiny_psnr tiny_ssim base64 audiomatch\nHOSTPROGS  := $(TESTTOOLS:%=tests\/%) doc\/print_options<\/code><\/pre>\n\n\n\n<p>\u4e0a\u9762\u7684\u4ee3\u7801\u53ea\u662f\u58f0\u660e\u53d8\u91cf\uff0c\u63a8\u8350\u9605\u8bfb<a href=\"https:\/\/www.cnblogs.com\/wanqieddy\/archive\/2011\/09\/21\/2184257.html\">\u300aMakefile \u4e2d:= ?= += =\u7684\u533a\u522b\u300b<\/a><\/p>\n\n\n\n<p><strong>\u7b2c37~39\u884c\u4ee3\u7801\u5982\u4e0b\uff1a<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"prettyprint\" ># first so &quot;all&quot; becomes default target\nall: all-yes<\/code><\/pre>\n\n\n\n<p>\u4e0a\u9762\u5b9a\u4e49\u4e86\u7b2c\u4e00\u4e2a target \uff08\u7f16\u8bd1\u76ee\u6807\uff09\uff0cmakefile\u7684\u8bed\u6cd5\u662f\uff0cmake\u7684\u65f6\u5019\u5982\u679c\u4e0d\u6307\u5b9atarget \uff0c\u7b2c\u4e00\u4e2a\u4e0d\u4ee5 . \u5f00\u5934\u7684target \u5c31\u662f\u9ed8\u8ba4target\u3002\u63a8\u8350\u9605\u8bfb<a href=\"https:\/\/blog.csdn.net\/hfyinsdu\/article\/details\/106816734\">\u300amakefile default target\u300b<\/a><\/p>\n\n\n\n<p>\u6700\u540e\u628a all all-yes \u5b9a\u4e49\u4e3a \u4f2a\u76ee\u6807\u3002\u4f2a\u76ee\u6807\u53ef\u4ee5\u9632\u6b62\u751f\u6210\u6587\u4ef6\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"prettyprint\" >.PHONY: all all-yes alltools build check config testprogs<\/code><\/pre>\n\n\n\n<p>\u8fd9\u91cc\u5267\u900f\u4e00\u4e0b\uff0c\u56e0\u4e3a\u6b64\u65f6 all \u8fd9\u4e2a target \u4f9d\u8d56\u4e8e all-yes \uff0c\u6240\u4ee5make\u4f1a\u53bb\u627e all-yes \u7684target\uff0call-yes \u7684 target \u5b9a\u4e49\u5728 <strong>ffbuild\/library.mak<\/strong> \u91cc\uff0c\u5982\u4e0b<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"prettyprint\" >all-$(CONFIG_STATIC): $(SUBDIR)$(LIBNAME)  $(SUBDIR)lib$(FULLNAME).pc\nall-$(CONFIG_SHARED): $(SUBDIR)$(SLIBNAME) $(SUBDIR)lib$(FULLNAME).pc<\/code><\/pre>\n\n\n\n<p><strong>\u7b2c40~41\u884c\u4ee3\u7801\u5982\u4e0b\uff1a<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"prettyprint\" >include $(SRC_PATH)\/tools\/Makefile\ninclude $(SRC_PATH)\/ffbuild\/common.mak<\/code><\/pre>\n\n\n\n<p>\u5f15\u5165\u4e86\u4e24\u4e2a Makefile \u6587\u4ef6\uff0c\u9996\u5148 tools\/Makefile \u6709\u4ee5\u4e0b\u91cd\u70b9\uff1a<\/p>\n\n\n\n<p>1\uff0c<code class=\"prettyprint\" >tools\\Makefile<\/code> \u91cc\u9762\u7684\u6709\u4e2a\u53d8\u91cf COMPILE_C \u6bd4\u8f83\u590d\u6742\uff0c\u7528\u6765\u7f16\u8bd1 tool \u76ee\u5f55\u4e0b\u7684C\u4ee3\u7801\u7684\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"705\" height=\"280\" src=\"\/wp-content\/uploads\/2022\/02\/mf-1-1-1.png\" alt=\"\" class=\"wp-image-568\"\/><\/figure>\n\n\n\n<p>\u6211\u5728shell \u91cc\u6267\u884c\u4e86\u8fd9\u4e2a\u547d\u4ee4 \uff0c<code class=\"prettyprint\" >make tools\/target_dec_tiff_fuzzer.o<\/code>\uff0c\u4e0a\u56fe\u4e2d\u7684 $* \u662f % \u5339\u914d\u5230\u7684\u5185\u5bb9\uff0c\u6240\u4ee5$* = tiff<\/p>\n\n\n\n<p>\u4e0b\u9762\u662f COMPILE_C \u8fd9\u4e2a\u53d8\u91cf\u7684\u5177\u4f53\u7684\u503c<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1241\" height=\"308\" src=\"\/wp-content\/uploads\/2022\/02\/mf-1-2.png\" alt=\"\" class=\"wp-image-569\"\/><\/figure>\n\n\n\n<p>\u53ef\u4ee5\u770b\u5230 COMPILE_C \u5b9e\u9645\u4e0a\u6267\u884c\u4e863\u4e2a\u547d\u4ee4\u3002<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>\u7528 cl.exe \u7f16\u8bd1\u5668 \u751f\u6210\u5185\u5bb9\uff0c\u4f20\u9012\u7ed9 awk\uff0c\u518d\u8f93\u51fa\u7ed9 tools\/target_dec_tiff_fuzzer.d\uff0c\u5728\u540e\u9762\u4f1a\u628a\u8fd9\u4e2a .d \u540e\u7f00\u6587\u4ef6 include \u8fdb\u53bb\u3002<\/li><li>printf \u6253\u5370\u4e00\u4e0b\u63d0\u793a\u4fe1\u606f\u3002<\/li><li>\u6b63\u5f0f\u7528 cl.exe \u7f16\u8bd1 target_dec_fuzer.c \u7684\u4ee3\u7801,<\/li><\/ul>\n\n\n\n<p>2\uff0c<code class=\"prettyprint\" >-include $(wildcard tools\/*.d)<\/code> \u524d\u9762\u5e26\u4e00\u4e2a - \u662f\u9632\u6b62\u62a5\u9519\uff0c\u63a8\u8350\u9605\u8bfb \u300a<a href=\"https:\/\/stackoverflow.com\/questions\/16981464\/difference-between-include-and-include-in-a-makefile\">Difference between \"include\" and \"-include\" in a makefile<\/a>\u300b<\/p>\n\n\n\n<p>\u91cd\u8981\u77e5\u8bc6\u70b9\uff1a<\/p>\n\n\n\n<ol class=\"wp-block-list\"><li>gcc.exe \u6216 cl.exe \u540e\u9762 -D \u4ee3\u8868\u5b9a\u4e49\u4e00\u4e2a\u5b8f\uff0c\u4f20\u9012\u8fdb\u53bbC\u4ee3\u7801\u91cc\u9762\u3002\u4f8b\u5982 -DFFMPEG_DECODER=tiff<\/li><li>makefile \u8bed\u6cd5\uff0c$* \u662f % \u5339\u914d\u5230\u7684\u5185\u5bb9\uff0c\u6240\u4ee5$* = tiff<\/li><\/ol>\n\n\n\n<hr class=\"wp-block-separator has-css-opacity\"\/>\n\n\n\n<p>\u8fd8\u6709\u4e00\u4e2a\u6bd4\u8f83\u91cd\u8981\u7684\u77e5\u8bc6\u70b9\uff0ctools\/Makefile \u91cc\u9762\u4f7f\u7528 COMPILE_C \u53d8\u91cf\uff0c\u662f ffbuild\/common.mak \u91cc\u9762\u5b9a\u4e49\u7684\uff0c\u4f46\u662f tools\/Makefile \u7f3a\u662f\u5728 ffbuild\/common.mak \u524d\u9762 include \u8fdb\u53bb\u7684\u3002<\/p>\n\n\n\n<p>\u8fd9\u4e2a\u8981\u6ce8\u610f\u4e00\u4e0b\uff0cmakefile\u7684\u8bed\u6cd5 \u5148\u540e\u987a\u5e8f \u6bd4\u8f83\u6a21\u7cca\u7684\uff0c\u4ed6\u662f\u5148\u628a\u6240\u6709\u7684 makefile \u5c55\u5f00\u518d\u6c42\u503c\uff0c\u63a8\u8350\u9605\u8bfb \u300aMakefile \u4e2d:= ?= += =\u7684\u533a\u522b\u300b\uff0c\u91cc\u9762\u7684 <code class=\"prettyprint\" >=<\/code> \u8ddf <code>:=<\/code> \u5145\u5206\u8868\u660e\u4e86\uff0cmakefile \u662f\u5c55\u5f00\u540e\u518d\u6c42\u503c\u3002<\/p>\n\n\n\n<hr class=\"wp-block-separator has-css-opacity\"\/>\n\n\n\n<p>\u63a5\u4e0b\u6765\u5206\u6790 \u5f15\u5165 \u7684 <code class=\"prettyprint\" >ffbuild\/common.mak<\/code> \u6587\u4ef6\uff0c\u90e8\u5206\u4ee3\u7801\u5982\u4e0b\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"prettyprint\" >#\n# common bits used by all libraries\n#\n\u200b\nDEFAULT_X86ASMD=.dbg\n\u200b\nifeq ($(DBG),1)\nX86ASMD=$(DEFAULT_X86ASMD)\nelse\nX86ASMD=\nendif\n\u200b\nifndef SUBDIR\n\u200b\nifndef V\nQ      = @\nECHO   = printf &quot;$(1)\\t%s\\n&quot; $(2)\nBRIEF  = CC CXX OBJCC HOSTCC HOSTLD AS X86ASM AR LD STRIP CP WINDRES NVCC<\/code><\/pre>\n\n\n\n<p>makefile \u7684\u8c03\u8bd5\u975e\u5e38\u9ebb\u70e6\uff0c\u8fd9\u91cc\u4ecb\u7ecd\u4e2a\u65b9\u6cd5\uff0c\u4f8b\u5982\u6211\u60f3\u77e5\u9053\u6709\u6ca1\u8dd1\u8fdb\u53bb ifndef SUBDIR \u8fd9\u4e2a\u6761\u4ef6\uff0c\u53ef\u4ee5\u4f7f\u7528\u8fd9\u4e2a\u547d\u4ee4 <code class=\"prettyprint\" >make -f Makefile -f vars.mk d-ECHO<\/code> \u6253\u5370\u51fa ECHO \u53d8\u91cf\u3002<\/p>\n\n\n\n<p>common.mak \u6587\u4ef6\u90fd\u662f\u4e00\u4e9b\u901a\u7528\u7684\u53d8\u91cf\u5b9a\u4e49\uff0c\u4e0d\u592a\u5bb9\u6613\u7406\u89e3\u7684\u5730\u65b9\u6709\u4ee5\u4e0b\uff1a<\/p>\n\n\n\n<p>1\uff0c\u8bf7\u770b\u4e0b\u9762\u4ee3\u7801\uff0c\u4ed6\u8fd9\u4e9b \u89c4\u5219\uff0ccommand \u91cc\u9762\u53ea\u6709\u4e00\u4e2a $(COMPILE_MMI) \uff0c\u540e\u9762\u6ca1\u6709\u63a5\u4e0a\u6587\u4ef6\u540d\uff0c\u770b\u4e0a\u53bb\u4e0d\u77e5\u9053\u8981\u7f16\u8bd1\u4ec0\u4e48\u6587\u4ef6\uff0c\u5b9e\u9645\u4e0a\uff0c\u8981\u7f16\u8bd1\u7684\u6587\u4ef6\u540d\u5c31\u5728 $(COMPILE_MMI) \u53d8\u91cf\u91cc\u9762\uff0c\u901a\u8fc7\u4e0a\u9762\u7684 % \u5339\u914d\u5230\u7684\u5b57\u7b26\uff0c\u4f20\u9012\u8fdb\u53bb\u7ed9 $(COMPILE_MMI) \uff0c\u53ef\u4ee5\u628a $(COMPILE_MMI) \u6253\u5370\u51fa\u6765\uff0c\u5c31\u80fd\u77e5\u9053\u5177\u4f53\u903b\u8f91\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"prettyprint\" >%_mmi.o: %_mmi.c\n   $(COMPILE_MMI)\n\u200b\n%_msa.o: %_msa.c\n   $(COMPILE_MSA)\n\u200b\n%.o: %.c\n   $(COMPILE_C)<\/code><\/pre>\n\n\n\n<p>2\uff0c\u8bf7\u770b\u4e0b\u9762\u4ee3\u7801\uff0ctarget \u540e\u9762\u5e26\u4e00\u4e2a <code class=\"prettyprint\" >|<\/code> \uff0c\u6211\u4e5f\u4e0d\u77e5\u9053\u662f\u505a\u4ec0\u4e48\u7528\u7684\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"prettyprint\" >$(OBJS):     | $(sort $(dir $(OBJS)))\n$(HOBJS):    | $(sort $(dir $(HOBJS)))\n$(HOSTOBJS): | $(sort $(dir $(HOSTOBJS)))\n$(SLIBOBJS): | $(sort $(dir $(S<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-css-opacity\"\/>\n\n\n\n<p><strong>\u7b2c98~107\u884c\u4ee3\u7801\u5982\u4e0b\uff1a<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"prettyprint\" >define DOSUBDIR\n$(foreach V,$(SUBDIR_VARS),$(eval $(call RESET,$(V))))\nSUBDIR := $(1)\/\ninclude $(SRC_PATH)\/$(1)\/Makefile\n-include $(SRC_PATH)\/$(1)\/$(ARCH)\/Makefile\n-include $(SRC_PATH)\/$(1)\/$(INTRINSICS)\/Makefile\ninclude $(SRC_PATH)\/ffbuild\/library.mak\nendef\n\u200b\n$(foreach D,$(FFLIBS),$(eval $(call DOSUBDIR,lib$(D))))<\/code><\/pre>\n\n\n\n<p>\u4e0a\u9762\u8fd9\u6bb5\u4ee3\u7801\u7279\u522b\u91cd\u8981\uff0c\u6709\u4e00\u4e2a\u547d\u4ee4\u5305DOSUBDIR\u3002\u5728\u8be5\u547d\u4ee4\u5305\u901a\u8fc7\u5305\u542blibavXXX\/Makefile\u548clibrary.mak\u7b49\u6587\u4ef6\uff0c\u5b9a\u4e49\u4e86FFmpeg\u7c7b\u5e93\uff08\u4f8b\u5982libavformat\uff0clibavcodec\uff0clibavutil\u7b49\uff09\u7684\u4f9d\u8d56\u5173\u7cfb\u3002<\/p>\n\n\n\n<p>\u6ce8\u610f\u770b\u6700\u540e\u4e00\u4e2a <code class=\"prettyprint\" >ffbuild\/library.mak<\/code> \u8fd9\u4e2amakefile \u662f\u6700\u540e\u5305\u542b\u8fdb\u6765\u7684\uff0c\u4e13\u95e8\u5904\u7406\u4e4b\u524d include\u8fdb\u6765\u7684\u6587\u4ef6\u3002DOSUBDIR \u7684\u8c03\u7528\u662f\u5728\u4e00\u4e2a foreach \u5faa\u73af\u91cc\u9762\u7684\uff0c\u4e3e\u4e2a\u4f8b\u5b50\uff1a<\/p>\n\n\n\n<p><code class=\"prettyprint\" >libavdevice\\Makefile<\/code> \u6587\u4ef6\u91cc\u9762 \u5b9a\u4e49\u4e86 <code>DESC = FFmpeg device handling library<\/code> ,<\/p>\n\n\n\n<p>\u7136\u540e <code class=\"prettyprint\" >library.mak<\/code> \u91cc\u9762\u5c31\u4f1a\u4f7f\u7528\u8fd9\u4e2a DESC \u53d8\u91cf\uff0c\u628a\u4ed6\u5c55\u5f00\uff0c\u5982\u4e0b\uff0clibrary.mak \u7b2c 42 \u884c\u4ee3\u7801\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"prettyprint\" >$(SUBDIR)lib$(FULLNAME).pc: $(SUBDIR)version.h ffbuild\/config.sh | $(SUBDIR)\n    $$(M) $$(SRC_PATH)\/ffbuild\/pkgconfig_generate.sh $(NAME) &quot;$(DESC)&quot;<\/code><\/pre>\n\n\n\n<p>\u4e0d\u540c\u7684\u7c7b\u5e93\u6709\u4e0d\u540c \u7684 DESC \u5b9a\u4e49\u3002libavformat\\Makefile \u7684 DESC \u5b9a\u4e49\u5982\u4e0b\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"prettyprint\" >DESC = FFmpeg container format library<\/code><\/pre>\n\n\n\n<p><strong>ffbuild\/library.mak<\/strong> \u662f\u6700\u91cd\u8981\u7684\u4e00\u4e2a\u6587\u4ef6\uff0c\u4ed6\u5c31\u662f make \u547d\u4ee4\u7684\u5165\u53e3\uff0c\u4f60\u53ef\u4ee5\u7406\u89e3\u4e3a main() \u51fd\u6570\u5165\u53e3\u51fd\u6570\uff0c\u7b2c\u4e00\u4e2a \u7f16\u8bd1\u547d\u4ee4\u5c31\u662f\u4ece\u8fd9\u91cc\u8fd0\u884c\u7684\uff0c\u5177\u4f53\u6d41\u7a0b\u662f\u600e\u6837\u7684\uff1f\u8bf7\u7ee7\u7eed\u770b\uff0c\u4e4b\u524d\u8bf4\u8fc7\uff0c\u6839\u76ee\u5f55\u7684 Makefile \u5728\u5165\u53e3\u5b9a\u4e49\u4e86 all: all-yes \uff0c\u6240\u4ee5 all \u5c31\u662fmake\u7684\u9ed8\u8ba4 target\uff0c\u9ed8\u8ba4\u76ee\u6807\u3002<\/p>\n\n\n\n<p>all \u4f9d\u8d56 all-yes\uff0c\u6240\u4ee5\u5c31\u4f1a\u5bfc\u81f4 <strong>ffbuild\/library.mak<\/strong> \u4e0b\u9762\u8fd9\u6bb5\u4ee3\u7801\u88ab\u6267\u884c\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"prettyprint\" >all-$(CONFIG_STATIC): $(SUBDIR)$(LIBNAME)  $(SUBDIR)lib$(FULLNAME).pc\nall-$(CONFIG_SHARED): $(SUBDIR)$(SLIBNAME) $(SUBDIR)lib$(FULLNAME).pc<\/code><\/pre>\n\n\n\n<p>\u4e0a\u9762\u7684 $(CONFIG_STATIC) \u5c55\u5f00\u540e\u662f yes \u6216\u8005 no\uff0c\u5c31\u662f all-yes \uff0c\u53ef\u4ee5\u770b\u5230\uff0c\u4ed6\u540e\u9762\u6709\u4e00\u5806\u7684 prerequisites \uff0c\u8fd9\u4e00\u5806 prerequisites \u5c31\u4f1a\u5bfc\u81f4\u540e\u9762\u7ee7\u7eed\u53bb\u627e\u4f9d\u8d56\uff0c\u627e .o \u6587\u4ef6\uff0c.o \u6587\u4ef6\u6ca1\u6709\u627e\u5230\uff0c\u5c31\u4f1a\u6267\u884c cl.exe \u6216\u8005gcc.exe \u4ece C\u4ee3\u7801\u7f16\u8bd1\u51fa\u6765 .o \u6587\u4ef6\u3002\u5927\u6982\u5c31\u662f\u8fd9\u6837\u4e00\u4e2a\u903b\u8f91\u3002\u53ef\u4ee5\u7528make -n \u67e5\u770b\u5177\u4f53\u7684\u7f16\u8bd1\u547d\u4ee4\u3002<\/p>\n\n\n\n<p>\u6240\u4ee5\u8bf4 <strong>ffbuild\/library.mak<\/strong> \u662f\u6700\u91cd\u8981\u7684\u4e00\u4e2a\u6587\u4ef6<\/p>\n\n\n\n<hr class=\"wp-block-separator has-css-opacity\"\/>\n\n\n\n<p>\u5165\u53e3\u627e\u5230\u4e86\uff0c\u5176\u4ed6\u7684\u4e00\u4e9b\u7f16\u8bd1\u89c4\u5219\u81ea\u884c\u67e5\u770b\u5373\u53ef\uff0c makefile \u5206\u6790\u5b8c\u6bd5\u3002<\/p>\n\n\n\n<p><strong>\u8d44\u6e90\u4e0b\u8f7d\uff1a<\/strong><\/p>\n\n\n\n<p>1\uff0c\u5e26\u672c\u4eba\u6ce8\u91ca\u7684 Makefile \u4e0b\u8f7d\u5730\u5740\uff0c<a href=\"https:\/\/pan.baidu.com\/s\/1bBFkJU4vXLYlk6uLfVXNIA\">\u767e\u5ea6\u7f51\u76d8<\/a>\uff0c\u63d0\u53d6\u7801\uff1af5aj<\/p>\n\n\n\n<p><strong>\u76f8\u5173\u9605\u8bfb\uff1a<\/strong><\/p>\n\n\n\n<ol class=\"wp-block-list\"><li><a href=\"https:\/\/blog.csdn.net\/leixiaohua1020\/article\/details\/44556525\">\u300aFFmpeg\u6e90\u4ee3\u7801\u7b80\u5355\u5206\u6790\uff1amakefile\u300b<\/a><\/li><li><a href=\"https:\/\/seisman.github.io\/how-to-write-makefile\/invoke.html\">\u300a\u8ddf\u6211\u4e00\u8d77\u5199 makefile\u300b<\/a><\/li><li><a href=\"https:\/\/blog.csdn.net\/AS520213211314\/article\/details\/78190224\">\u300amakefile \u6253\u5370\u53d8\u91cf\u7684\u503c\u300b<\/a><\/li><\/ol>\n\n\n\n<hr class=\"wp-block-separator has-css-opacity\"\/>\n\n\n\n<p>\u7248\u6743\u6240\u5c5e\uff1a\u77e5\u8bc6\u661f\u7403\uff1a\u5f26\u5916\u4e4b\u97f3\uff0cQQ\uff1a2338195090\u3002 \u7531\u4e8e\u7b14\u8005\u7684\u6c34\u5e73\u6709\u9650\uff0c \u52a0\u4e4b\u7f16\u5199\u7684\u540c\u65f6\u8fd8\u8981\u53c2\u4e0e\u5f00\u53d1\u5de5\u4f5c\uff0c\u6587\u4e2d\u96be\u514d\u4f1a\u51fa\u73b0\u4e00\u4e9b\u9519\u8bef\u6216\u8005\u4e0d\u51c6\u786e\u7684\u5730\u65b9\uff0c\u6073\u8bf7\u8bfb\u8005\u6279\u8bc4\u6307\u6b63\u3002\u5982\u679c\u8bfb\u8005\u6709\u4efb\u4f55\u5b9d\u8d35\u610f\u89c1\uff0c\u53ef\u4ee5\u52a0\u6211\u5fae\u4fe1 Loken1\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u672c\u6587\u4ee5 ffmpeg-n4.4.1 \u7684\u7248\u672c\u4e3a\u51c6\uff0c\u4e3b\u8981\u5206\u6790 ffmpeg \u9879\u76ee\u4e2d Makefile \u7684\u903b\u8f91\u3002 \u6211 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6],"tags":[],"class_list":["post-566","post","type-post","status-publish","format-standard","hentry","category-ffmpeg-env-build"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v18.2 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>ffmpeg-makefile\u7f16\u8bd1\u5206\u6790 - \u5f26\u5916\u4e4b\u97f3<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.xianwaizhiyin.net\/?p=566\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"ffmpeg-makefile\u7f16\u8bd1\u5206\u6790 - \u5f26\u5916\u4e4b\u97f3\" \/>\n<meta property=\"og:description\" content=\"\u672c\u6587\u4ee5 ffmpeg-n4.4.1 \u7684\u7248\u672c\u4e3a\u51c6\uff0c\u4e3b\u8981\u5206\u6790 ffmpeg \u9879\u76ee\u4e2d Makefile \u7684\u903b\u8f91\u3002 \u6211 [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.xianwaizhiyin.net\/?p=566\" \/>\n<meta property=\"og:site_name\" content=\"\u5f26\u5916\u4e4b\u97f3\" \/>\n<meta property=\"article:published_time\" content=\"2022-02-08T09:40:13+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2022-06-10T18:57:31+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.xianwaizhiyin.net\/wp-content\/uploads\/2022\/02\/mf-1-1.png\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"loken\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.xianwaizhiyin.net\/#website\",\"url\":\"https:\/\/www.xianwaizhiyin.net\/\",\"name\":\"\u5f26\u5916\u4e4b\u97f3\",\"description\":\"FFmpeg\u3001WebRTC\uff0cSRS \u97f3\u89c6\u9891\u3001\u6d41\u5a92\u4f53\u6280\u672f\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.xianwaizhiyin.net\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"ImageObject\",\"@id\":\"https:\/\/www.xianwaizhiyin.net\/?p=566#primaryimage\",\"inLanguage\":\"zh-Hans\",\"url\":\"\/wp-content\/uploads\/2022\/02\/mf-1-1.png\",\"contentUrl\":\"\/wp-content\/uploads\/2022\/02\/mf-1-1.png\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.xianwaizhiyin.net\/?p=566#webpage\",\"url\":\"https:\/\/www.xianwaizhiyin.net\/?p=566\",\"name\":\"ffmpeg-makefile\u7f16\u8bd1\u5206\u6790 - \u5f26\u5916\u4e4b\u97f3\",\"isPartOf\":{\"@id\":\"https:\/\/www.xianwaizhiyin.net\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.xianwaizhiyin.net\/?p=566#primaryimage\"},\"datePublished\":\"2022-02-08T09:40:13+00:00\",\"dateModified\":\"2022-06-10T18:57:31+00:00\",\"author\":{\"@id\":\"https:\/\/www.xianwaizhiyin.net\/#\/schema\/person\/6605a70af752697df6b62f77c53298a3\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.xianwaizhiyin.net\/?p=566#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.xianwaizhiyin.net\/?p=566\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.xianwaizhiyin.net\/?p=566#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.xianwaizhiyin.net\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"ffmpeg-makefile\u7f16\u8bd1\u5206\u6790\"}]},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.xianwaizhiyin.net\/#\/schema\/person\/6605a70af752697df6b62f77c53298a3\",\"name\":\"loken\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\/\/www.xianwaizhiyin.net\/#personlogo\",\"inLanguage\":\"zh-Hans\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/f6320b5256dc36ef4243e0acf26144b8ac2668b478302ad154e95ce3202bc421?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/f6320b5256dc36ef4243e0acf26144b8ac2668b478302ad154e95ce3202bc421?s=96&d=mm&r=g\",\"caption\":\"loken\"},\"sameAs\":[\"https:\/\/www.xianwaizhiyin.net\/\"],\"url\":\"https:\/\/www.xianwaizhiyin.net\/?author=1\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"ffmpeg-makefile\u7f16\u8bd1\u5206\u6790 - \u5f26\u5916\u4e4b\u97f3","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.xianwaizhiyin.net\/?p=566","og_locale":"zh_CN","og_type":"article","og_title":"ffmpeg-makefile\u7f16\u8bd1\u5206\u6790 - \u5f26\u5916\u4e4b\u97f3","og_description":"\u672c\u6587\u4ee5 ffmpeg-n4.4.1 \u7684\u7248\u672c\u4e3a\u51c6\uff0c\u4e3b\u8981\u5206\u6790 ffmpeg \u9879\u76ee\u4e2d Makefile \u7684\u903b\u8f91\u3002 \u6211 [&hellip;]","og_url":"https:\/\/www.xianwaizhiyin.net\/?p=566","og_site_name":"\u5f26\u5916\u4e4b\u97f3","article_published_time":"2022-02-08T09:40:13+00:00","article_modified_time":"2022-06-10T18:57:31+00:00","og_image":[{"url":"https:\/\/www.xianwaizhiyin.net\/wp-content\/uploads\/2022\/02\/mf-1-1.png"}],"twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"loken","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"4 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebSite","@id":"https:\/\/www.xianwaizhiyin.net\/#website","url":"https:\/\/www.xianwaizhiyin.net\/","name":"\u5f26\u5916\u4e4b\u97f3","description":"FFmpeg\u3001WebRTC\uff0cSRS \u97f3\u89c6\u9891\u3001\u6d41\u5a92\u4f53\u6280\u672f","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.xianwaizhiyin.net\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"ImageObject","@id":"https:\/\/www.xianwaizhiyin.net\/?p=566#primaryimage","inLanguage":"zh-Hans","url":"\/wp-content\/uploads\/2022\/02\/mf-1-1.png","contentUrl":"\/wp-content\/uploads\/2022\/02\/mf-1-1.png"},{"@type":"WebPage","@id":"https:\/\/www.xianwaizhiyin.net\/?p=566#webpage","url":"https:\/\/www.xianwaizhiyin.net\/?p=566","name":"ffmpeg-makefile\u7f16\u8bd1\u5206\u6790 - \u5f26\u5916\u4e4b\u97f3","isPartOf":{"@id":"https:\/\/www.xianwaizhiyin.net\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.xianwaizhiyin.net\/?p=566#primaryimage"},"datePublished":"2022-02-08T09:40:13+00:00","dateModified":"2022-06-10T18:57:31+00:00","author":{"@id":"https:\/\/www.xianwaizhiyin.net\/#\/schema\/person\/6605a70af752697df6b62f77c53298a3"},"breadcrumb":{"@id":"https:\/\/www.xianwaizhiyin.net\/?p=566#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.xianwaizhiyin.net\/?p=566"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.xianwaizhiyin.net\/?p=566#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.xianwaizhiyin.net\/"},{"@type":"ListItem","position":2,"name":"ffmpeg-makefile\u7f16\u8bd1\u5206\u6790"}]},{"@type":"Person","@id":"https:\/\/www.xianwaizhiyin.net\/#\/schema\/person\/6605a70af752697df6b62f77c53298a3","name":"loken","image":{"@type":"ImageObject","@id":"https:\/\/www.xianwaizhiyin.net\/#personlogo","inLanguage":"zh-Hans","url":"https:\/\/secure.gravatar.com\/avatar\/f6320b5256dc36ef4243e0acf26144b8ac2668b478302ad154e95ce3202bc421?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/f6320b5256dc36ef4243e0acf26144b8ac2668b478302ad154e95ce3202bc421?s=96&d=mm&r=g","caption":"loken"},"sameAs":["https:\/\/www.xianwaizhiyin.net\/"],"url":"https:\/\/www.xianwaizhiyin.net\/?author=1"}]}},"_links":{"self":[{"href":"https:\/\/www.xianwaizhiyin.net\/index.php?rest_route=\/wp\/v2\/posts\/566","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.xianwaizhiyin.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.xianwaizhiyin.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.xianwaizhiyin.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.xianwaizhiyin.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=566"}],"version-history":[{"count":6,"href":"https:\/\/www.xianwaizhiyin.net\/index.php?rest_route=\/wp\/v2\/posts\/566\/revisions"}],"predecessor-version":[{"id":2664,"href":"https:\/\/www.xianwaizhiyin.net\/index.php?rest_route=\/wp\/v2\/posts\/566\/revisions\/2664"}],"wp:attachment":[{"href":"https:\/\/www.xianwaizhiyin.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=566"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.xianwaizhiyin.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=566"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.xianwaizhiyin.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=566"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}