{"id":982,"date":"2023-03-12T00:16:19","date_gmt":"2023-03-11T16:16:19","guid":{"rendered":"https:\/\/www.appblog.cn\/?p=982"},"modified":"2023-04-29T13:24:33","modified_gmt":"2023-04-29T05:24:33","slug":"makefile-anti-filter-function-filter-out","status":"publish","type":"post","link":"https:\/\/www.appblog.cn\/index.php\/2023\/03\/12\/makefile-anti-filter-function-filter-out\/","title":{"rendered":"Makefile\u53cd\u8fc7\u6ee4\u51fd\u6570filter-out"},"content":{"rendered":"<pre><code>$(filter-out PATTERN...,TEXT)<\/code><\/pre>\n<p>\u51fd\u6570\u540d\u79f0\uff1a\u53cd\u8fc7\u6ee4\u51fd\u6570 <code>filter-out<\/code><br \/>\n\u51fd\u6570\u529f\u80fd\uff1a\u548c <code>filter<\/code> \u51fd\u6570\u5b9e\u73b0\u7684\u529f\u80fd\u76f8\u53cd\u3002\u8fc7\u6ee4\u6389\u5b57\u4e32\u201cTEXT\u201d\u4e2d\u6240\u6709\u7b26\u5408\u6a21\u5f0f\u201cPATTERN\u201d\u7684\u5355\u8bcd\uff0c\u4fdd\u7559\u6240\u6709\u4e0d\u7b26\u5408\u6b64\u6a21\u5f0f\u7684\u5355\u8bcd\u3002\u53ef\u4ee5\u6709\u591a\u4e2a\u6a21\u5f0f\u3002\u5b58\u5728\u591a\u4e2a\u6a21\u5f0f\u65f6\uff0c\u6a21\u5f0f\u8868\u8fbe\u5f0f\u4e4b\u95f4\u4f7f\u7528\u7a7a\u683c\u5206\u5272<br \/>\n\u8fd4\u56de\u503c\uff1a\u7a7a\u683c\u5206\u5272\u7684\u201cTEXT\u201d\u5b57\u4e32\u4e2d\u6240\u6709\u4e0d\u7b26\u5408\u6a21\u5f0f\u201cPATTERN\u201d\u7684\u5b57\u4e32<br \/>\n\u51fd\u6570\u8bf4\u660e\uff1a<code>filter-out<\/code> \u51fd\u6570\u4e5f\u53ef\u4ee5\u7528\u6765\u53bb\u9664\u4e00\u4e2a\u53d8\u91cf\u4e2d\u7684\u67d0\u4e9b\u5b57\u7b26\u4e32\uff08\u5b9e\u73b0\u548c<code>filter<\/code> \u51fd\u6570\u76f8\u53cd\uff09<\/p>\n<p><!-- more --><\/p>\n<h4>\u666e\u901a\u793a\u4f8b<\/h4>\n<pre><code>objects=main1.o foo.o main2.o bar.o\nmains=main1.o main2.o\n\n$(filter-out $(mains),$(objects))<\/code><\/pre>\n<p>\u5b9e\u73b0\u53bb\u9664\u53d8\u91cf<code>objects<\/code>\u4e2d<code>mains<\/code>\u5b9a\u4e49\u7684\u5b57\u4e32\uff08\u6587\u4ef6\u540d\uff09\u529f\u80fd\u3002\u8fd4\u56de\u503c\u4e3a<code>foo.o bar.o<\/code><\/p>\n<h4>Android.mk\u4f7f\u7528<\/h4>\n<pre><code>LOCAL_PATH := $(call my-dir)\n\nALL_SRC_FILES := $(subst $(LOCAL_PATH)\/,,$(wildcard $(LOCAL_PATH)\/*.c))\nEXCLUDE_SRC_FILES := cjpeg.c djpeg.c example.c jmemansi.c jmemdos.c jmemmac.c jmemname.c jpegtran.c rdjpgcom.c wrjpgcom.c\nJPEG_SRC_FILES := $(filter-out $(EXCLUDE_SRC_FILES),$(ALL_SRC_FILES))\n\ninclude $(CLEAR_VARS)\nLOCAL_MODULE     := libjpeg\nLOCAL_C_INCLUDES := .\nLOCAL_SRC_FILES  := $(JPEG_SRC_FILES)<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>$(filter-out PATTERN&#8230;,TEXT) \u51fd\u6570\u540d\u79f0\uff1a\u53cd\u8fc7\u6ee4\u51fd\u6570 filter-out \u51fd\u6570\u529f [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[11],"tags":[270],"class_list":["post-982","post","type-post","status-publish","format-standard","hentry","category-android-ndk","tag-makefile"],"_links":{"self":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts\/982","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/comments?post=982"}],"version-history":[{"count":0,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts\/982\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/media?parent=982"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/categories?post=982"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/tags?post=982"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}