Note: this article is actually about the @executable_path
, @load_path
and @rpath
install paths used by the linker on Mac OS X; wiki titles can't include underscores, however, because they are ambiguous with spaces.
Useful for frameworks installed in shared locations. Example:
/Library/Frameworks/Foo.framework/Versions/A/Foo
@executable_path
Useful for frameworks embedded inside applications, because it allows you to specify the location of the framework relative to the application's executable:
@executable_path/../Frameworks/Foo.framework/Versions/A/Foo
/Applications/Foo.app
/Applications/Foo.app/Contents/MacOS
/Applications/Foo.app/Contents/Frameworks/Foo.framework
/Applications/Foo.app/Contents/MacOS/../Frameworks/Foo.framework/Versions/A/Foo
Available from Mac OS X 10.4 Tiger onwards; useful for frameworks embedded inside plug-ins, because it allows you to specify the location of the framework relative to the plug-in's code (remember, plug-ins may not actually know where they are going to be installed, relative to the application, so knowing @executable_path
doesn't help us in this case):
@loader_path/../Frameworks/Foo.framework/Versions/A/Foo
/Applications/Foo.app
/Library/Application Support/Foo/Plug-Ins/Bar.bundle
/Applications/Foo.app/Contents/MacOS
/Library/Application Support/Foo/Plug-Ins/Bar.bundle/Contents/MacOS
/Library/Application Support/Foo/Plug-Ins/Bar.bundle/Contents/Frameworks/Foo.framework
/Library/Application Support/Foo/Plug-Ins/Bar.bundle/Contents/MacOS/../Frameworks/Foo.framework/Versions/A/Foo
Note that if the "loader" is an application rather than a plug-in, the @loader_path
ends up being equivalent to @executable_path
.
@rpath
New in Mac OS X 10.5 Leopard is @rpath
. Key points:
@rpath
instructs the dynamic linker to search a list of paths in order to locate the framework@rpath/Foo.framework/Versions/A/Foo
can be made to work in a number of different ways; that is, you are effectively no longer limited by the choice of specifying your "install path" using either @executable_path
or @loader_path
-rpath @executable_path/../Frameworks
or /Library/Frameworks
; note that specifying both will cause the dynamic linker to try looking in both locations) 瀹炰緥錛?br />鍦?hello/鐩綍涓嬪垱寤轟竴涓猦ello.c鏂囦歡錛屽茍緙栬瘧榪愯瀹冿細 #cd /hello/ (1) 緙栧啓婧愭枃浠秇ello.c錛?/p> #include<stdio.h> [litao@vm0000131 hello]$ ll 涓銆乤utoscan [litao@vm0000131 hello]$ autoscan 宸茬粡鐢熸垚浜哻onfigure.scan錛宎utoscan.log鏂囦歡 灝哻onfigure.scan 淇敼涓?configure.in錛屾渶鍚庝慨鏀圭殑鍐呭濡備笅錛?/p> [litao@vm0000131 hello]$ mv configure.scan configure.in # -*- Autoconf -*- 浜屻乤cloacl [litao@vm0000131 hello]$ aclocal 鐢熸垚 aclocal.m4 鍜?autom4te.cache (鐢熸垚aclocal.m4鐨勮繃紼嬩腑娑夊強鍒癱onfigure.in) [litao@vm0000131 hello]$ ll 涓夈乤ntoconf 鐢熸垚 configure (鏍規嵁 configure.in, 鍜? aclocal.m4) [litao@vm0000131 hello]$ ll total 168 -rw-rw-r-- 1 litao litao 31120 Aug 12 12:08 aclocal.m4 drwxr-xr-x 2 litao litao 4096 Aug 12 12:11 autom4te.cache -rw-rw-r-- 1 litao litao 0 Aug 12 12:03 autoscan.log -rwxrwxr-x 1 litao litao 122297 Aug 12 12:11 configure -rw-rw-r-- 1 litao litao 496 Aug 12 12:08 configure.in -rw-rw-r-- 1 litao litao 68 Aug 12 12:02 hello.c 鍥涖佺紪鍐橫akefile.am錛? AUTOMAKE_OPTIONS= foreign 鐢熸垚 Makefile.in錛?depcomp錛?install-sh錛?鍜?missing (鏍規嵁 Makefile.am, 鍜? aclocal.m4) [litao@vm0000131 hello]$ automake 鍏乧onfigure |
浠嶭inux鍐呮牳2.6寮濮嬶紝Linux鍐呮牳鐨勭紪璇戦噰鐢↘build緋葷粺錛岃繖鍚岃繃鍘葷殑緙栬瘧緋葷粺鏈夊緢澶х殑涓嶅悓錛屽挨鍏跺浜嶭inux鍐呮牳妯″潡鐨勭紪璇戙?font color="#0000ff" style="word-wrap: break-word; line-height: normal; ">鍦ㄦ柊鐨勭郴緇熶笅錛孡inux緙栬瘧緋葷粺浼氫袱嬈℃壂鎻廘inux鐨凪akefile錛氶鍏堢紪璇戠郴緇熶細璇誨彇Linux鍐呮牳欏跺眰鐨凪akefile錛岀劧鍚庢牴鎹鍒扮殑鍐呭絎簩嬈¤鍙朘build鐨凪akefile鏉ョ紪璇慙inux鍐呮牳銆?/font> Linux鍐呮牳Makefile鍒嗙被 · Kernel Makefile Kernel Makefile浣嶄簬Linux鍐呮牳婧愪唬鐮佺殑欏跺眰鐩綍錛屼篃鍙?Top Makefile銆傚畠涓昏鐢ㄤ簬鎸囧畾緙栬瘧Linux Kernel鐩爣鏂囦歡錛坴mlinux錛夊拰妯″潡錛坢odule錛夈傝繖緙栬瘧鍐呮牳鎴栨ā鍧楁槸錛岃繖涓枃浠朵細琚鍏堣鍙栵紝騫舵牴鎹鍒扮殑鍐呭閰嶇疆緙栬瘧鐜鍙橀噺銆傚浜庡唴鏍告垨椹卞姩寮鍙?/span>浜哄憳鏉ヨ錛岃繖涓枃浠跺嚑涔庝笉鐢ㄤ換浣曚慨鏀廣?br style="word-wrap: break-word; line-height: normal; " />· Kbuild Makefile Kbuild緋葷粺浣跨敤Kbuild Makefile鏉ョ紪璇戝唴鏍告垨妯″潡銆傚綋Kernel Makefile琚В鏋愬畬鎴愬悗錛孠build浼氳鍙栫浉鍏崇殑Kbuild Makefile榪涜鍐呮牳鎴栨ā鍧楃殑緙栬瘧銆侹build Makefile鏈夌壒瀹氱殑璇硶鎸囧畾鍝簺緙栬瘧榪涘唴鏍鎬腑銆佸摢浜涚紪璇戜負妯″潡銆佸強瀵瑰簲鐨勬簮鏂囦歡鏄粈涔堢瓑銆傚唴鏍稿強椹卞姩寮鍙戜漢鍛橀渶瑕佺紪鍐欒繖涓狵build Makefile鏂囦歡銆?br style="word-wrap: break-word; line-height: normal; " />· ARCH Makefile ARCH Makefile浣嶄簬ARCH/$(ARCH)/Makefile錛屾槸緋葷粺瀵瑰簲騫沖彴鐨凪akefile銆侹ernel Top Makefile浼氬寘鍚繖涓枃浠舵潵鎸囧畾騫沖彴鐩稿叧淇℃伅銆傚彧鏈夊鉤鍙板紑鍙戜漢鍛樹細鍏沖績榪欎釜鏂囦歡銆?br style="word-wrap: break-word; line-height: normal; " />Kbuild Makefile Kbuild Makefile鐨勬枃浠跺悕涓嶄竴瀹氭槸Makefile錛屽敖綆℃帹鑽愪嬌鐢∕akefile榪欎釜鍚嶅瓧銆傚ぇ澶氱殑Kbuild鏂囦歡鐨勫悕瀛楅兘鏄疢akefile銆備負浜嗕笌鍏朵粬Makefile鏂囦歡鐩稿尯鍒紝浣犱篃鍙互鎸囧畾Kbuild Makefile鐨勫悕瀛椾負Kbuild銆傝屼笖濡傛灉“Makefile”鍜?#8220;Kbuild”鏂囦歡鍚屾椂瀛樺湪錛屽垯Kbuild緋葷粺浼氫嬌鐢?#8220;Kbuild”鏂囦歡銆?br style="word-wrap: break-word; line-height: normal; " />· 鐩爣瀹氫箟 Kbuild Makefile鐨勪竴涓渶涓昏鍔熻兘灝辨槸鎸囧畾緙栬瘧浠涔堬紝榪欎釜鍔熻兘鏄氳繃涓嬮潰涓や釜瀵硅薄鎸囧畾鐨刼bj-?鍜寈xx-objs錛?br style="word-wrap: break-word; line-height: normal; " />· obj-? obj-?鎸囧畾緙栬瘧浠涔堬紝鎬庝箞緙栬瘧錛熷叾涓殑“?”鍙兘鏄?#8220;y”鎴?#8220;m”錛?#8220;y”鎸囧畾鎶婂璞$紪璇戣繘鍐呮牳涓紝“m”鎸囧畾鎶婂璞$紪璇戜負妯″潡銆傝娉曞涓? obj-? = $(target).o target涓虹紪璇戝璞$殑鍚嶅瓧銆傚鏋滄病鏈夋寚瀹歺xx-objs錛岃繖緙栬瘧榪欎釜瀵硅薄闇瑕佺殑婧愭枃浠跺氨鏄?(target).c鎴?(target).s銆傚鏋滄寚瀹氫簡$(target)-objs錛屽垯緙栬瘧榪欎釜瀵硅薄闇瑕佺殑婧愭枃浠剁敱$(target)-objs鎸囧畾錛屽茍涓斾笉鑳芥湁$(target).c鎴?(target).s鏂囦歡銆?br style="word-wrap: break-word; line-height: normal; " />· xxx-objs xxx-objs鎸囧畾浜嗙紪璇戝璞¢渶瑕佺殑鏂囦歡錛屼竴鑸彧鏈夊湪婧愭枃浠舵槸澶氫釜鏃舵墠闇瑕佸畠銆?br style="word-wrap: break-word; line-height: normal; " />鍙鍖呭惈浜嗚繖涓よ錛孠build Makefile灝卞簲璇ュ彲浠ュ伐浣滀簡銆?br style="word-wrap: break-word; line-height: normal; " />· 宓屽緙栬瘧 鏈夋椂涓涓璞″彲鑳藉祵鍏ュ埌鍙︿竴涓璞$殑鐩綍涓嬶紝閭d釜濡備綍緙栬瘧瀛愮洰褰曚笅鐨勫璞″憿?鍏跺疄寰堢畝鍗曪紝鍙鎸囧畾obj_?鐨勫璞′負瀛愮洰褰曠殑鍚嶅瓧灝卞彲浠ヤ簡錛?br style="word-wrap: break-word; line-height: normal; " />obj-? = $(sub_target)/ 鍏朵腑“?”鍙互鏄?#8220;y”鎴?#8220;m”錛?(sub_target)鏄瓙鐩綍鍚嶅瓧銆?br style="word-wrap: break-word; line-height: normal; " />· 緙栬瘧鍣ㄩ夐」 灝界鍦ㄥぇ澶氭暟鎯呭喌涓嬩笉闇瑕佹寚瀹氱紪璇戝櫒閫夐」錛屾湁鏃舵垜浠繕鏄渶瑕佹寚瀹氫竴浜涚紪璇戦夐」鐨勩?br style="word-wrap: break-word; line-height: normal; " />· ccflags-y, asflags-y and ldflags-y 榪欎簺緙栬瘧閫夐」鐢ㄤ簬鎸囧畾cc銆乤s鍜宭d鐨勭紪璇戦夐」 緙栬瘧澶栭儴妯″潡 鏈夋椂鍊欐垜浠渶瑕佸湪鍐呮牳婧愪唬鐮佹暟鐨勫闈㈢紪璇戝唴鏍告ā鍧楋紝緙栬瘧鐨勫熀鏈懡浠ゆ槸錛?br style="word-wrap: break-word; line-height: normal; " /> make -C $(KERNEL_DIR) M=`pwd` modules 鎴戜滑鍙互鎶婅繖涓懡浠ら泦鎴愬埌Makefile閲岋紝榪欐牱鎴戜滑灝卞彲浠ュ彧杈撳叆“make”鍛戒護灝卞彲浠ヤ簡銆傚洖鎯充笂涓绔犵殑閭d釜Makefile錛屽畠鎶奛ormal Makefile 鍜孠build Makefile闆嗘垚鍒頒竴涓枃浠朵腑浜嗐備負浜嗗尯鍒獽build Makefile 鍜孨ormal Makefile錛岃繖鏍鋒垜浠敼鍐橫akefile涓哄涓嬪艦寮忥紝騫朵笖娣誨姞Kbuild Makefile - “Kbuild”銆?br style="word-wrap: break-word; line-height: normal; " />##Makefile ifneq ($(KERNELRELEASE),) include "Kbuild" else KERNEL_DIR = /lib/modules/`uname -r`/build MODULEDIR := $(shell pwd) .PHONY: modules default: modules modules: make -C $(KERNEL_DIR) M=$(MODULEDIR) modules clean distclean: rm -f *.o *.mod.c .*.*.cmd *.ko rm -rf .tmp_versions endif ## Kbuild MODULE_NAME = helloworld $(MODULE_NAME)-objs := hello.o obj-m := $(MODULE_NAME).o 涓鑸笉闇瑕佸湪Makefile閲屽寘鍚涓嬩唬鐮?榪欐牱鍐欏畬鍏ㄦ槸涓轟簡鍏煎鑰佺増鏈殑Kbuild緋葷粺銆侹ERNELRELEASE鍙橀噺鍦↘ernel Makefile閲屽畾涔夌殑錛屽洜姝ゅ彧鏈夊湪絎簩嬈$敱Kbuild璇誨彇榪欎釜Makefile鏂囦歡鏃舵墠浼氳В鏋愬埌Kbuild鐨勫唴瀹廣?nbsp; ifneq ($(KERNELRELEASE),) include "Kbuild" else ... endif 澶栭儴澶存枃浠?/strong> 鏈夋椂闇瑕佽繛鎺ュ唴鏍告簮浠g爜澶栭儴鐨勭郴緇熷ご鏂囦歡錛屼絾Kbuild緋葷粺榛樿鐨勭郴緇熷ご鏂囦歡閮藉湪鍐呮牳婧愪唬鐮佸唴閮紝濡備綍浣跨敤澶栭儴鐨勫ご鏂囦歡鍛紵榪欎釜鍙互鍊熷姪浜嶬build緋葷粺鐨勭壒孌婅鍒? · EXTRA_CFLAGS EXTRA_CFLAGS鍙互緇橩build緋葷粺娣誨姞澶栭儴緋葷粺澶存枃浠訛紝 EXTRA_CFLAGS += $(ext_include_path) 涓鑸閮ㄥご鏂囦歡鍙兘浣嶄簬澶栭儴妯″潡婧愭枃浠剁殑鐩綍鍐咃紝濡備綍鎸囧畾鍛紵榪欏彲浠ュ熷姪$(src)鎴?(obj) · $(src)/$(obj) $(src)鏄竴涓浉瀵硅礬寰勶紝瀹冨氨鏄疢akefile/Kbuild鏂囦歡鎵鍦ㄧ殑璺緞銆傚悓鏍?(obj)灝辨槸緙栬瘧鐩爣淇濆瓨鐨勮礬寰勶紝榛樿灝辨槸婧愪唬鐮佹墍鍦ㄨ礬寰勩?br style="word-wrap: break-word; line-height: normal; " />鍥犳錛屾垜浠慨鏀筀build鏂囦歡娣誨姞 EXTRA_CFLAGS 鏉ュ寘鍚閮ㄥご鏂囦歡灝界鍦ㄨ繖涓┍鍔ㄩ噷娌℃湁寮曠敤澶栭儴緋葷粺澶存枃浠訛細 ## Kbuild MODULE_NAME = helloworld $(MODULE_NAME)-objs := hello.o EXTRA_CFLAGS := -I$(src)/include obj-m := $(MODULE_NAME).o · Goal definitions Example: obj-y += foo.o 鍛婅瘔kbuild錛屽湪鏂囦歡澶逛腑鍙堜竴涓彨鍋歠oo.o鐨刼bject銆俧oo.o灝嗕細琚粠foo.c鎴栬協oo.S琚瀯寤恒?br style="word-wrap: break-word; line-height: normal; " /> 濡傛灉foo.o琚瀯寤烘垚涓涓?strong style="word-wrap: break-word; text-align: left; font-style: normal; line-height: normal; font-weight: bold; ">妯″潡錛屽垯灝嗕嬌鐢ㄥ彉閲?strong style="word-wrap: break-word; text-align: left; font-style: normal; line-height: normal; font-weight: bold; ">obj-m銆?strong style="word-wrap: break-word; text-align: left; font-style: normal; line-height: normal; font-weight: bold; ">Example: obj-$(CONFIG_FOO) += foo.o $(CONFIG_FOO)瑕佷箞鏄痽(built-in)瑕佷箞鏄痬(module)銆傚鏋淐ONFIG_FOO鏃笉鏄痽涔熶笉鏄痬錛岄偅涔堟枃浠跺皢涓嶄細琚紪璇戜篃涓嶄細琚繛鎺ャ?br style="word-wrap: break-word; line-height: normal; " />· Built-in object goals - obj-y kbuild Makefiles鍦?strong style="word-wrap: break-word; text-align: left; font-style: normal; line-height: normal; font-weight: bold; ">$(obj-y)鍒楄〃涓負vmlinux鎸囨槑object鏂囦歡銆傝繖涓垪琛ㄤ緷闈犲唴鏍哥殑閰嶇疆銆?br style="word-wrap: break-word; line-height: normal; " />鍦?strong style="word-wrap: break-word; text-align: left; font-style: normal; line-height: normal; font-weight: bold; ">$(obj-y)涓殑鏂囦歡鐨勯『搴忔槸闈炲父閲嶈鐨勩傚垪琛ㄤ腑鍏佽涓や釜鐩稿悓鐨勬枃浠訛細絎竴涓?/strong>瀹炰綋灝嗚榪炴帴鍒癰uilt-in.o錛屽悗闈㈢殑瀹炰綋灝嗕細琚拷鐣ャ?/strong> 榪炴帴鐨勯『搴忎篃寰堥噸瑕侊紝鍥犱負鍦╞oot榪囩▼涓煇浜涘嚱鏁?module_init()/_initcall)灝嗕細鎸夐『搴忓嚭鐜般?/strong>鍥犳錛屽鏋滄敼鍙樹簡榪炴帴欏哄簭錛屽皢浼氭敼鍙樹綘鐨凷CSI鎺у埗鍣ㄧ殑媯嫻嬮『搴忥紝浣犵殑紓佺洏涔熷悓鏃惰閲嶆柊緙栧彿浜嗐?br style="word-wrap: break-word; line-height: normal; " />Example: #drivers/isdn/i4l/Makefile # Makefile for the kernel ISDN subsystem and device drivers. # Each configuration option enables a list of files. obj-$(CONFIG_ISDN) += isdn.o obj-$(CONFIG_ISDN_PPP_BSDCOMP) += isdn_bsdcomp.o · Loadable module goals - obj-m $(obj-m)鎸囨槑object鏂囦歡浣滀負鍙杞界殑鍐呮牳妯″潡琚瀯寤恒備竴涓ā鍧楀彲鑳戒粠涓涓垨鑰呭涓簮鏂囦歡琚瀯寤恒俴build maefile鍙槸綆鍗曠殑灝嗘簮鏂囦歡鍔犲埌%(obj-m) Example: #drivers/isdn/i4l/Makefile obj-$(CONFIG_ISDN_PPP_BSDCOMP) += isdn_bsdcomp.o 娉ㄦ剰榪欓噷$(CONFIG_ISDN_PPP_BSDCOMP)鏄痬. Note: In this example $(CONFIG_ISDN_PPP_BSDCOMP) evaluates to 'm'銆?br style="word-wrap: break-word; line-height: normal; " />濡傛灉涓涓唴鏍告ā鍧椾粠澶氫釜婧愭枃浠舵瀯寤猴紝KBuild灝卞繀欏昏鐭ラ亾浣犳兂浠庡摢浜涢儴鍒嗘瀯寤烘ā鍧椼傚洜姝わ紝浣犱笉寰椾笉璁劇疆$(-objs)鍙橀噺鏉ュ憡璇塊Build銆?br style="word-wrap: break-word; line-height: normal; " />Example: #drivers/isdn/i4l/Makefile obj-$(CONFIG_ISDN) += isdn.o isdn-objs := isdn_net_lib.o isdn_v110.o isdn_common.o 鍦ㄨ繖涓緥瀛愪腑錛屾ā鍧楀悕鏄痠sdn.o,Kbuild灝嗕細緙栬瘧鍒楀湪$(isdn-objs)鐨?/strong>object鏂囦歡錛岀劧鍚庡湪榪欎簺鏂囦歡鐨勫垪琛ㄤ腑璋冪敤"$(LD) -r"鏉ヤ駭鐢焛sdn.o銆?br style="word-wrap: break-word; line-height: normal; " />Kbuild浣跨敤鍚庣紑-objs,-y鏉ヨ瘑鍒販鍚堢殑object鏂囦歡銆傝繖鍏佽Makefiles浣跨敤鍙橀噺CONFIG_sambol鏉ュ喅瀹氫竴涓猳bject鏄惁鏄販鍚坥bject鐨勭殑涓閮ㄥ垎銆?br style="word-wrap: break-word; line-height: normal; " />Example: #fs/ext2/Makefile obj-$(CONFIG_EXT2_FS) += ext2.o ext2-y := balloc.o bitmap.o ext2-$(CONFIG_EXT2_FS_XATTR) += xattr.o 鍦ㄨ繖涓緥瀛愪腑錛屽鏋?(CONFIG_EXT2_FS_XATTR)鏄痽錛屽垯xattr.o鍙槸娣峰悎object鏂囦歡ext2.o鐨勪竴閮ㄥ垎銆?br style="word-wrap: break-word; line-height: normal; " />娉ㄦ剰錛屽綋浣犳瀯閫犱竴涓猳bjects鍒板唴鏍鎬腑鏃訛紝涓婇潰鐨勮娉曞綋鐒朵篃鑳藉宸ヤ綔銆傚洜姝わ紝濡傛灉浣犺CONFIG_EXT2=Y,KBuild灝嗕細涓轟綘鏋勫緩涓涓嫭绔嬬殑ext2.o鏂囦歡錛屽茍涓旇繛鎺ュ埌built-in.o銆?br style="word-wrap: break-word; line-height: normal; " />· Library file goals - lib-y 鐢?strong style="word-wrap: break-word; text-align: left; font-style: normal; line-height: normal; font-weight: bold; ">obj-*榪炴帴鐨凮bjects鍦ㄦ寚鏄庣殑鏂囦歡澶逛腑琚敤浣滄ā鍧楁垨鑰呯患鍚堣繘built-in.o銆備篃鍙堝彲鑳借鍒楀嚭鐨刼bjects灝嗕細琚寘鍚繘涓涓簱,lib.a銆傛墍鏈夌敤lib-y鍒楀嚭鐨刼bjects鍦ㄩ偅涓枃浠跺す涓緇煎悎榪涘崟鐙殑涓涓簱銆傚垪鍦╫bj-y鍜岄檮鍔犲垪鍦╨ib-y涓殑Objects灝嗕笉浼氳鍖呭惈鍦ㄥ簱涓紝鍥犱負浠栦滑灝嗕細琚換鎰忕殑瀛樺彇銆傚浜庤榪炴帴鍦╨ib-m涓紝榪炵畫鐨刼bjects灝嗕細琚寘鍚湪lib.a涓傚煎緱娉ㄦ剰鐨勬槸kbuild makefile鍙兘鍒楀嚭鏂囦歡鐢ㄤ綔built-in錛屽茍涓斾綔涓哄簱鐨勪竴閮ㄥ垎銆傚洜姝わ紝鍚屼竴涓枃浠跺す鍙兘鍖呭惈涓涓猙uilt-in.o鍜宭ib.a鏂囦歡銆?br style="word-wrap: break-word; line-height: normal; " />Example: #arch/i386/lib/Makefile lib-y := checksum.o delay.o 榪欓噷璁蹭細鍒涘緩涓涓熀浜巆hecksum.o鍜宒elay.o鐨勫簱鏂囦歡銆傚浜巏build錛岃瘑鍒竴涓猯ib.a姝e湪琚瀯寤猴紝榪欎釜鏂囦歡澶瑰簲璇ヨ鍒楀湪libs-y涓?strong style="word-wrap: break-word; text-align: left; font-style: normal; line-height: normal; font-weight: bold; ">lib-y鐨勪嬌鐢ㄦ柟娉曢氬父琚檺鍒跺湪lib/鍜宎rc/*/lib涓?br style="word-wrap: break-word; line-height: normal; " />· Descending down in directories 涓涓狹akefile鍙礋璐e湪浠栬嚜宸辯殑鏂囦歡澶逛腑鏋勫緩objects銆?鍦ㄥ瓙鏂囦歡澶逛腑鐨勬枃浠跺簲璇ョ敱瀛愭枃浠跺す涓殑Makefiles鏉ョ収欏俱傚鏋滀綘鐭ラ亾浠栦滑錛宐uild緋葷粺灝嗕細鑷姩閫掑綊鍦扮敤鍦ㄥ瓙鏂囦歡澶逛腑鐨刴ake銆?br style="word-wrap: break-word; line-height: normal; " />鍦ㄨ繖縐嶆儏鍐典笅obj-y鍜?strong style="word-wrap: break-word; text-align: left; font-style: normal; line-height: normal; font-weight: bold; ">obj-m灝辮浣跨敤浜嗐俥xt2瀛樺湪浜庝笉鍚岀殑鏂囦歡澶逛腑錛孧akefile鍑虹幇鍦╢s/錛屽垯鍛婅瘔kbuild浠庡悗闈㈢殑鍙傛暟涓嬫潵銆?br style="word-wrap: break-word; line-height: normal; " />Example: #fs/Makefile obj-$(CONFIG_EXT2_FS) += ext2/ 濡傛灉CONFIG_EXT2_FS琚緗垚y(built-in)鎴栬卪(modular)錛岀浉搴旂殑obj-鍙橀噺灝嗕細琚緗紝騫朵笖kbuild灝嗕細浠巈xt2鏂囦歡澶圭戶鎵夸笅鏉ャ侹build鍙細浣跨敤榪欎簺淇℃伅鏉ュ喅瀹氬畠闇瑕佽闂繖浜涙枃浠跺す錛岃屽湪瀛愭枃浠跺す涓殑Makefile鏉ユ寚鏄庡摢浜涙槸modules鍝簺鏄痓uilt-in銆?br style="word-wrap: break-word; line-height: normal; " />褰撹祴鍊兼枃浠跺す鍚嶅瓧鐨勬椂鍊欙紝浣跨敤CONFIG_variable鏄緢濂界殑閫夋嫨銆傝繖鍏佽kbuild瀹屽叏鐨勮煩榪囨枃浠跺す錛岃屼笉綆ONFIG_option鏄惁鏄痽鎴栬卪銆?br style="word-wrap: break-word; line-height: normal; " />· Compilation flags EXTRA_CFLAGS, EXTRA_AFLAGS, EXTRA_LDFLAGS, EXTRA_ARFLAGS銆?br style="word-wrap: break-word; line-height: normal; " />鎵鏈夌殑EXTRA_ variables鍙?span href="tag.php?name=%D3%A6%D3%C3" class="t_tag" style="word-wrap: break-word; line-height: normal; cursor: pointer; border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: #ff0000; white-space: nowrap; ">搴旂敤鍦╧build涓紝浠栦滑琚祴鍊肩殑鍦版柟銆侲XTRA_variables搴旂敤鍦╧build makefile涓墍鏈夌殑鍙墽琛岀殑鍛戒護銆?strong style="word-wrap: break-word; text-align: left; font-style: normal; line-height: normal; font-weight: bold; ">$(EXTRA_CFLAGS) 鎸囨槑鐢?(CC)緙栬瘧C鏂囦歡鐨勬椂鍊欑殑閫夐」銆?br style="word-wrap: break-word; line-height: normal; " />Example: # drivers/sound/emu10k1/Makefile EXTRA_CFLAGS += -I$(obj) ifdef DEBUG EXTRA_CFLAGS += -DEMU10K1_DEBUG endif 榪欓噷鐨勫彉閲忔槸蹇呴』鐨勶紝鍥犱負欏跺眰鐨凪akefile鎷ユ湁鍙橀噺$(CFLAGS)騫朵笖鐢ㄥ畠鏉ヤ綔涓烘暣涓爲鐨勭紪璇戞爣蹇楀綋緙栬瘧姹囩紪婧愭枃浠剁殑鏃跺?strong style="word-wrap: break-word; text-align: left; font-style: normal; line-height: normal; font-weight: bold; ">$(EXTRA_AFLAGS)錛屽拰姣忎釜鏂囦歡澶圭殑閫夐」鏄浉浼肩殑銆?br style="word-wrap: break-word; line-height: normal; " />Example: #arch/x86_64/kernel/Makefile EXTRA_AFLAGS := -traditional $(EXTRA_LDFLAGS)鍜?strong style="word-wrap: break-word; text-align: left; font-style: normal; line-height: normal; font-weight: bold; ">$(EXTRA_ARFLAGS) 瀵逛簬姣忎釜鏂囦歡澶圭殑$(LD)鍜?(AR)閫夐」鏄被浼肩殑銆?br style="word-wrap: break-word; line-height: normal; " />Example: #arch/m68k/fpsp040/Makefile EXTRA_LDFLAGS := -x CFLAGS_$@, AFLAGS_$@ CFLAGS_$@鍜?strong style="word-wrap: break-word; text-align: left; font-style: normal; line-height: normal; font-weight: bold; ">AFLAGS_$@鍙簲鐢ㄥ埌褰撳墠kbuild makefile鐨勫懡浠ゃ?br style="word-wrap: break-word; line-height: normal; " />$(CFLAGS_$@) 涓烘瘡涓枃浠剁殑$(CC)鎸囨槑閫夐」銆?strong style="word-wrap: break-word; text-align: left; font-style: normal; line-height: normal; font-weight: bold; ">$@ 閮ㄥ垎鏈変竴涓瓧闈笂鐨勫鹼紝鎸囨槑瀹冩槸涓洪偅涓枃浠躲?br style="word-wrap: break-word; line-height: normal; " />Example: # drivers/scsi/Makefile CFLAGS_aha152x.o = -DAHA152X_STAT -DAUTOCONF CFLAGS_gdth.o = # -DDEBUG_GDTH=2 -D__SERIAL__ -D__COM2__ \ -DGDTH_STATISTICS CFLAGS_seagate.o = -DARBITRATE -DPARITY -DSEAGATE_USE_ASM These three lines specify compilation flags for aha152x.o, gdth.o, and seagate.o $(AFLAGS_$@) is a similar feature for source files in assembly languages. Example: # arch/arm/kernel/Makefile AFLAGS_head-armv.o := -DTEXTADDR=$(TEXTADDR) -traditional AFLAGS_head-armo.o := -DTEXTADDR=$(TEXTADDR) -traditional |
VirtualBox 瀹e竷浜?4.0.8 鐗堟湰錛岃鐗堟湰鏀硅繘浜嗗 Gnome 3 鐨?3D 鏀寔銆傚悓鏃惰繕淇浜嗕笉灝慴ug錛屽寘鎷敼鍙?guest 紿椾綋澶у皬鏃跺彲鑳藉鑷寸▼搴忓穿婧冪殑闂浠ュ強 Ubuntu 11.04 浠ュ強 Fedora 15 涓?Gnome 3 鐨勬覆鏌撻棶棰樸?/p>
VirtualBox 鏄竴嬈懼姛鑳藉己澶х殑 x86 铏氭嫙鏈鴻蔣浠訛紝瀹冧笉浠呭叿鏈変赴瀵岀殑鐗硅壊錛岃屼笖鎬ц兘涔熷緢浼樺紓銆?/p>
鏇村鍏充簬VirtualBox鐨勮緇嗕俊鎭紝鎴栬呬笅杞藉湴鍧璇風偣榪欓噷