{"id":500,"date":"2014-06-08T12:45:12","date_gmt":"2014-06-08T21:45:12","guid":{"rendered":"\/blog\/?p=500"},"modified":"2023-09-21T09:38:42","modified_gmt":"2023-09-21T00:38:42","slug":"make-%ec%a1%b0%ea%b1%b4-%eb%b6%84%ea%b8%b0","status":"publish","type":"post","link":"https:\/\/hasu0707.duckdns.org\/blog\/?p=500","title":{"rendered":"make \uc870\uac74 \ubd84\uae30"},"content":{"rendered":"\n<span style=\"font-family: monospace; font-size: 12px;\">\ucd9c\ucc98: <a href=\"http:\/\/blog.daum.net\/english_100\/11\" target=\"_blank\" rel=\"noopener\">http:\/\/blog.daum.net\/english_100\/11<\/a><br \/><br \/><strong>7. Makefile\uc758 \uc870\uac74\ubd84\uae30<\/strong><br \/><br \/><strong>7.1 \uc870\uac74 \ubd84\uae30\uc758 \uc608<\/strong><br \/><br \/>\ub2e4\uc74c \uc608\ub294 CC \ubcc0\uc218\uac00 'gcc'\uc778\uc9c0 \uc548\ub2cc\uc9c0\uc5d0 \ub530\ub77c \uc5b4\ub5a4 \ub77c\uc774\ube0c\ub7ec\ub9ac\ub97c \ub9c1\ud06c\ud560 \uac83\uc778\uac00\ub97c \uacb0\uc815\ud558\ub294 \uc870\uac74\ubb38 \uc608\uc774\ub2e4.<br \/><br \/>libs_for_gcc = -lgnu<br \/>normal_libs =<br \/>foo : $(objects)<br \/>ifeq ($(CC),gcc)<br \/>&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;$(CC) -o $(objects) $(libs_for_gcc)<br \/>else<br \/>&nbsp; &nbsp; &nbsp; &nbsp; $(CC) -o $(objects) $(normal_libs)<br \/>endif<br \/><br \/>\uc774 \uc608\uc5d0\ub294 ifeq, else, endif \ub4f1 \uc138\uac00\uc9c0 \uc9c0\uc2dc\uc790\uac00 \uc4f0\uc600\ub2e4.<br \/>ifeq \uc9c0\uc2dc\uc790\ub294 \uc870\uac74\ubb38\uc758 \uc2dc\uc791\uc73c\ub85c \uc870\uac74\uc744 \uba85\uc2dc\ud55c\ub2e4. \ub450 \uc778\uc790\uac00 \uc4f0\uc774\ub294\ub370 \ucf64\ub9c8\ub85c \uad6c\ubd84\ub418\uace0 \uc18c\uad04\ud638\ub85c \uc2f8\uc5ec\uc788\uace0, \uac01 \uc778\uc790\uc758 \uc704\uce58\uc5d0\uc11c \ubcc0\uc218 \uce58\ud658 \ubc0f \ud3bc\uce68\uc774 \uc774\ub8e8\uc5b4\uc9c4\ub2e4. \ub450 \uc778\uc790\uac00 \uc11c\ub85c \ub9e4\uce58\ub420\ub54c ifeq\ubb38\uc774 \uc2e4\ud589\ub418\uba70 \uadf8\ub807\uc9c0 \uc54a\uc73c\uba74 \ubb34\uc2dc\ub41c\ub2e4.<br \/>else \uc9c0\uc2dc\uc790\ub294 \uc870\uac74\ubb38\uc774 \uc131\ub9bd\ub418\uc9c0 \uc54a\uc558\uc744 \ub54c \uc2e4\ud589\ub420 \ubd80\ubd84\uc744 \uba85\uae30\ud558\uba70 \uc870\uac74\ubb38\uc5d0\uc11c \ud56d\uc0c1 \uc874\uc7ac\ud560 \ud544\uc694\ub294 \uc5c6\ub2e4.<br \/>endif \uc9c0\uc2dc\uc790\ub294 \uc870\uac74\ubb38\uc758 \ub05d\uc73c\ub85c\uc11c \ubaa8\ub4e0 \uc870\uac74\ubb38\uc740 \uc774 \uc9c0\uc2dc\uc790\ub85c \ub05d\ub0b4\uc57c \ud55c\ub2e4.<br \/><br \/>\uc704 \uc608\ubb38\uc740 \ub2e4\uc74c\uacfc \uac19\uc774 \uae30\uc220\ud560 \uc218\ub3c4 \uc788\ub2e4.<br \/>libs_for_gcc = -lgnu<br \/>normal_libs =<br \/>ifeq ($(CC),gcc)<br \/>&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;libs = $(libs_for_gcc)<br \/>else<br \/>&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;libs = $(normal_libs)<br \/>endif<br \/>foo : $(objects)<br \/>&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;$(CC) -o foo $(objects) $(libs)<br \/><br \/><strong>7.2 \uc870\uac74\ubb38 \ubb38\ubc95<\/strong><br \/><br \/>else \uac00 \uc5c6\ub294 \ub2e8\uc21c \uc870\uac74\ubb38 \ubb38\ubc95\uc740 \ub2e4\uc74c\uacfc \uac19\ub2e4 :<br \/>conditional-directive<br \/>text-if-true<br \/>endif<br \/><br \/>text-if-true \ub294 \uc870\uac74\ubb38\uc774 \ucc38\uc77c\ub54c \uc218\ud589\ub420 makefile\uc758 \uc5b4\ub5a4 \ud589\uc774\ub4e0 \uac00\ub2a5\ud558\ub2e4. \ud558\uc9c4\ub9cc \uc870\uac74\ubb38\uc774 \uac70\uc9d3\uc778 \uacbd\uc6b0 \uc218\ud589\ub420 \ubb38\uc7a5\uc774 \uc874\uc7ac\ud558\uc9c0 \uc54a\ub294\ub2e4.<br \/>\ubcf5\uc7a1 \uc870\uac74\ubb38\uc758 \ubb38\ubc95\uc740 \ub2e4\uc74c\uacfc \uac19\ub2e4 :<br \/><em>conditional-directive<\/em><br \/><em>text-if-true<\/em><br \/><em>else<\/em><br \/><em>test-if-false<\/em><br \/><em>endif<\/em><br \/>\ub610\ub294<br \/><br \/><em>conditional-directive<\/em><br \/><em>text-if-one-is-true<\/em><br \/><em>else conditional-directive<\/em><br \/><em>test-if-true<\/em><br \/><em>else<\/em><br \/><em>test-if-false<\/em><br \/><em>endif<\/em><br \/><br \/>conditional-directive \uc740 \ub124\uac00\uc9c0 \ud615\ud0dc\uc758 \ub2e4\ub978 \ubb38\ubc95\uc744 \uac16\ub294\ub370 \ub2e4\uc74c\uacfc \uac19\ub2e4.<br \/>ifeq <em>(arg1, arg2)<\/em><br \/>ifeq <em>'arg1' 'arg2'<\/em><br \/>ifeq <em>\"arg1\" \"arg2'<\/em><br \/>ifeq <em>\"arg1\" 'arg2'<\/em><br \/>ifeq <em>'arg1' \"arg2'<\/em><br \/><br \/>ifneq <em>(arg1, arg2)<\/em><br \/>ifneq <em>'arg1' 'arg2'<\/em><br \/>ifneq <em>\"arg1\" \"arg2'<\/em><br \/>ifneq <em>\"arg1\" 'arg2'<\/em><br \/>ifneq <em>'arg1' \"arg2'<\/em><br \/><br \/>ifdef <em>variable-name<\/em><br \/>ifdef \uc9c0\uc2dc\uc790\ub294 \ub2e8\uc9c0 \ubcc0\uc218\uac00 \uac12\uc744 \uac16\uace0\uc788\ub294\uc9c0 \uc544\ub2cc\uc9c0\ub9cc\uc744 \uac80\uc0ac\ud558\uc9c0 \ud3bc\uce68\uac12\uc774 \ube48\ubb38\uc790\uc778\uc9c0 \uc544\ub2cc\uc9c0\ub97c \uac80\uc0ac\ud558\uc9c0 \uc54a\ub294\ub2e4. \uc989 'foo =' \ud615\ud0dc\ub97c \uc81c\uc678\ud558\uace0 \ubaa8\ub4e0 \ud615\ud0dc\uc758 \ubcc0\uc218 \uc815\uc758\ub294 ifdef\uc5d0 \ub300\ud574 \ucc38\uc744 \ubc18\ud658\ud55c\ub2e4. \uc608\ub97c \ub4e4\uc5b4 :<br \/>bar =<br \/>foo = $(bar)<br \/>ifdef foo<br \/>frobozz =yes<br \/>else<br \/>frobozz = no<br \/>endfi<br \/><br \/>frobozz\uc758 \uacb0\uacfc \uac12\uc740 'yes' \uc774\uace0<br \/>foo =<br \/>ifdef foo<br \/>frobozz =yes<br \/>else<br \/>frobozz = no<br \/>endif<br \/><br \/>\uc758 \uacb0\uacfc\ub294 'no'\uc774\ub2e4.<br \/><br \/>ifndef variable-name<br \/>\ubcc0\uc218\uac00 \ube48\ubb38\uc790\uc774\uba74 \uc774 \uc9c0\uc2dc\uc790\ub294 \ucc38\uc744 \ubc18\ud658\ud55c\ub2e4.<br \/><br \/>\uc870\uac74\ubb38 \uc9c0\uc2dc\uc790\uc758 \uc55e\ucabd\uc5d0\ub294 \ud0ed\ubb38\uc790\ub97c \uc81c\uc678\ud55c \ubaa8\ub4e0 \uacf5\ubc31\ubb38\uc790\uac00 \ubb34\uc2dc\ub41c\ub2e4. \ud558\uc9c0\ub9cc \uadf8 \ub4b7\ubd80\ubd84\uc5d0\uc11c\ub294 \ud0ed\uacfc \uacf5\ubc31\ubb38\uc790\uac00 \uc790\uc720\ub85c\uc774 \uc774\uc6a9\ub420 \uc218 \uc788\ub2e4.<br \/>make\ub294 makefile\uc744 \uc77d\uc5b4\ub4e4\uc77c\ub54c \uc870\uac74\ubb38\uc744 \ud3c9\uac00\ud55c\ub2e4. \uadf8\ub7ec\ubbc0\ub85c \uc870\uac74\ubb38 \uac80\uc0ac\uc2dc\uc5d0 \uc790\ub3d9\ubcc0\uc218\ub97c \uc0ac\uc6a9\ud560 \uc218 \uc5c6\ub2e4. \uc65c\ub0d0\uba74 \uadf8\uac83\ub4e4\uc740 recipe\uac00 \uc2e4\ud589\ub418\uae30\uae4c\uc9c0\ub294 \uc815\uc758\ub418\uc9c0 \uc54a\uae30 \ub54c\ubb38\uc774\ub2e4.<br \/>\uc5c4\uccad\ub098\uac8c \ud63c\ub3c8\uc2a4\ub7f0 \uc0ac\ud0dc\ub97c \ubc29\uc9c0\ud558\uae30\uc704\ud574 \uc870\uac74\ubb38\uc774 \ud55c makefile\uc5d0\uc11c \uc2dc\uc791\ud574\uc11c \ub2e4\ub978 makefile\uc5d0\uc11c \ub05d\ub098\uac8c \ud558\ub294 \uac83\uc740 \uc6a9\uc778\ub418\uc9c0 \uc54a\ub294\ub2e4. \uadf8\ub7ec\ub098 \uc870\uac74\ubb38\uc548\uc5d0 include \uc9c0\uc2dc\uc790\ub97c \uc0ac\uc6a9\ud558\ub294\uac83\uc740 \uac00\ub2a5\ud558\ub2e4.<br \/><br \/><strong>7.3 \uba85\ub839\ubb38 \uc635\uc158\uc744 \uac80\uc0ac\ud558\ub294 \uc870\uac74\ubb38<\/strong><br \/><br \/>MAKEFLAGS \ubcc0\uc218\uc640 findstring \ud568\uc218\ub97c \uc774\uc6a9\ud574 '-t' \uac19\uc740 make\uc758 \uba85\ub839\ud589 \uc635\uc158\ub4e4\uc744 \uac80\uc0ac\ud560 \uc218\uc788\ub2e4. \uc774\ub294 touch \uba85\ub839\uc774 \ud30c\uc77c\uc744 \ucd5c\uc2e0 \uc0c1\ud0dc\ub85c \uc720\uc9c0\ud558\ub294\ub370 \ucda9\ubd84\uce58 \uc54a\uc744 \ub54c \uc720\uc6a9\ud558\ub2e4. \uc544\uce74\uc774\ube0c \ud30c\uc77c\uc744 \ucd5c\uc2e0\uc73c\ub85c \ub9cc\ub4e4\uae30 \uc704\ud574 'ranlib -t'\ub97c \uc5b4\ub5bb\uac8c \uc0ac\uc6a9\ud560 \uac83\uc778\uac00\ub97c \uacb0\uc815\ud558\ub294 \uc608\ub97c \ubcf4\uc790 :<br \/><br \/>archive.a : ...<br \/>ifneq (, $(findstring t, $(MAKEFLAGS)))<br \/>&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;+touch archive.a<br \/>&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;+ranlib -t archive.a<br \/>else<br \/>&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;ranlib archive.a<br \/>endif<br \/><br \/>'+' \uc811\ub450\ubb38\uc790\ub294 \uadf8 recipe\ub97c 'recursive'\ub85c \uc9c0\uc815\ud568\uc73c\ub85c\uc368 '-t' \ud50c\ub798\uadf8\uac00 \uc874\uc7ac\ud568\uc5d0\ub3c4 \ubd88\uad6c\ud558\uace0 recipe\ub97c \uc2e4\ud589\ud560 \uac83\uc774\ub2e4.<br \/><\/span>\n","protected":false},"excerpt":{"rendered":"<p>\ucd9c\ucc98: http:\/\/blog.daum.net\/english_100\/11 7. Makefile\uc758 \uc870\uac74\ubd84\uae30 7.1 \uc870\uac74 \ubd84\uae30\uc758 \uc608 \ub2e4\uc74c \uc608\ub294 CC \ubcc0\uc218\uac00 &#8216;gcc&#8217;\uc778\uc9c0 \uc548\ub2cc\uc9c0\uc5d0 \ub530\ub77c \uc5b4\ub5a4 \ub77c\uc774\ube0c\ub7ec\ub9ac\ub97c \ub9c1\ud06c\ud560 \uac83\uc778\uac00\ub97c \uacb0\uc815\ud558\ub294 \uc870\uac74\ubb38 \uc608\uc774\ub2e4. libs_for_gcc = -lgnunormal_libs =foo : $(objects)ifeq ($(CC),gcc)&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;$(CC) -o $(objects) $(libs_for_gcc)else&nbsp; &nbsp; &nbsp; &nbsp; $(CC) -o $(objects) $(normal_libs)endif \uc774 \uc608\uc5d0\ub294 ifeq, else, endif \ub4f1 \uc138\uac00\uc9c0 \uc9c0\uc2dc\uc790\uac00 \uc4f0\uc600\ub2e4.ifeq \uc9c0\uc2dc\uc790\ub294 \uc870\uac74\ubb38\uc758 \uc2dc\uc791\uc73c\ub85c [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_import_markdown_pro_load_document_selector":0,"_import_markdown_pro_submit_text_textarea":"","site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"categories":[17],"tags":[],"class_list":["post-500","post","type-post","status-publish","format-standard","hentry","category-development_dev_tools"],"_links":{"self":[{"href":"https:\/\/hasu0707.duckdns.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/500","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/hasu0707.duckdns.org\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/hasu0707.duckdns.org\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/hasu0707.duckdns.org\/blog\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/hasu0707.duckdns.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=500"}],"version-history":[{"count":0,"href":"https:\/\/hasu0707.duckdns.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/500\/revisions"}],"wp:attachment":[{"href":"https:\/\/hasu0707.duckdns.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=500"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/hasu0707.duckdns.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=500"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/hasu0707.duckdns.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=500"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}