gcc/g++ 鍦ㄦ墽琛岀紪璇戞椂錛岄渶瑕?姝?/p>
銆銆1.棰勫鐞?鐢熸垚.i鐨勬枃浠禰浣跨敤-E鍙傛暟]
銆銆2.灝嗛澶勭悊鍚庣殑鏂囦歡涓嶈漿鎹㈡垚姹囩紪璇█,鐢熸垚鏂囦歡.s[浣跨敤-S鍙傛暟]
銆銆3.鏈夋眹緙栧彉涓虹洰鏍囦唬鐮?鏈哄櫒浠g爜)鐢熸垚.o鐨勬枃浠禰浣跨敤-c鍙傛暟]
銆銆4.榪炴帴鐩爣浠g爜,鐢熸垚鍙墽琛岀▼搴廩浣跨敤-o鍙傛暟]
-x language filename
銆銆璁懼畾鏂囦歡鎵浣跨敤鐨勮璦,浣垮悗緙鍚嶆棤鏁?瀵逛互鍚庣殑澶氫釜鏈夋晥.涔熷氨鏄牴鎹害瀹欳璇█鐨勫悗緙鍚嶇О鏄?c鐨勶紝鑰?a class="channel_keylink" target="_blank">C++鐨勫悗緙鍚嶆槸.C鎴栬?cpp,濡傛灉浣犲緢涓э紝鍐沖畾浣犵殑C浠g爜鏂囦歡鐨勫悗緙鍚嶆槸.pig 鍝堝搱錛岄偅浣犲氨瑕佺敤榪欎釜鍙傛暟,榪欎釜鍙傛暟瀵逛粬鍚庨潰鐨勬枃浠跺悕閮借搗浣滅敤錛岄櫎闈炲埌浜嗕笅涓涓弬鏁扮殑浣跨敤銆?/p>
-ansi
銆銆鍏抽棴gnu c涓笌ansi c涓嶅吋瀹圭殑鐗規(guī)?嬋媧籥nsi c鐨勪笓鏈夌壒鎬?鍖呮嫭紱佹涓浜沘sm inline typeof鍏抽敭瀛?浠ュ強(qiáng)UNIX,vax絳夐澶勭悊瀹?
-fno-asm
銆銆姝ら夐」瀹炵幇ansi閫夐」鐨勫姛鑳界殑涓閮ㄥ垎錛屽畠紱佹灝哸sm,inline鍜宼ypeof鐢ㄤ綔鍏抽敭瀛椼?/p>
-fno-strict-prototype
銆銆鍙g++璧蜂綔鐢?浣跨敤榪欎釜閫夐」,g++灝嗗涓嶅甫鍙傛暟鐨勫嚱鏁?閮借涓烘槸娌℃湁鏄懼紡鐨勫鍙傛暟鐨勪釜鏁板拰綾誨瀷璇存槑,鑰屼笉鏄病鏈夊弬鏁?鑰実cc鏃犺鏄惁浣跨敤榪欎釜鍙傛暟,閮藉皢瀵規(guī)病鏈夊甫鍙傛暟鐨勫嚱鏁?璁や負(fù)鍩庢病鏈夋樉寮忚鏄庣殑綾誨瀷
-fthis-is-varialble
銆銆灝辨槸鍚戜紶緇焎++鐪嬮綈,鍙互浣跨敤this褰撲竴鑸彉閲忎嬌鐢?
-fcond-mismatch
銆銆鍏佽鏉′歡琛ㄨ揪寮忕殑絎簩鍜岀涓夊弬鏁扮被鍨嬩笉鍖歸厤,琛ㄨ揪寮忕殑鍊煎皢涓簐oid綾誨瀷
銆銆-funsigned-char
銆銆-fno-signed-char
銆銆-fsigned-char
銆銆-fno-unsigned-char
銆銆榪欏洓涓弬鏁版槸瀵筩har綾誨瀷榪涜璁劇疆,鍐沖畾灝哻har綾誨瀷璁劇疆鎴恥nsigned char(鍓嶄袱涓弬鏁?鎴栬?signed char(鍚庝袱涓弬鏁?
-include file
銆銆鍖呭惈鏌愪釜浠g爜,綆鍗曟潵璇?灝辨槸渚夸互鏌愪釜鏂囦歡,闇瑕佸彟涓涓枃浠剁殑鏃跺?灝卞彲浠ョ敤瀹冭瀹?鍔熻兘灝辯浉褰撲簬鍦ㄤ唬鐮佷腑浣?include<filename>
銆銆渚嬪瓙鐢ㄦ硶:
銆銆gcc hello.c -include /root/pianopan.h
銆銆-imacros file
銆銆灝唂ile鏂囦歡鐨勫畯,鎵╁睍鍒癵cc/g++鐨勮緭鍏ユ枃浠?瀹忓畾涔夋湰韜茍涓嶅嚭鐜板湪杈撳叆鏂囦歡涓?/p>
銆銆-Dmacro
銆銆鐩稿綋浜嶤璇█涓殑#define macro
銆銆-Dmacro=defn
銆銆鐩稿綋浜嶤璇█涓殑#define macro=defn
銆銆-Umacro
銆銆鐩稿綋浜嶤璇█涓殑#undef macro
銆銆-undef
銆銆鍙栨秷瀵逛換浣曢潪鏍囧噯瀹忕殑瀹氫箟
銆銆-Idir
銆銆鍦ㄤ綘鏄敤#include"file"鐨勬椂鍊?gcc/g++浼?xì)鍏堝湪褰撳墠鐩綍鏌ユ壘浣犳墍鍒跺畾鐨勫ご鏂囦歡,濡傛灉娌℃湁鎵懼埌,浠栧洖鍒扮己鐪佺殑澶存枃浠剁洰褰曟壘,濡傛灉浣跨敤-I鍒跺畾浜嗙洰褰?浠栧洖鍏堝湪浣犳墍鍒跺畾鐨勭洰褰曟煡鎵?鐒跺悗鍐嶆寜甯歌鐨勯『搴忓幓鎵?瀵逛簬#include<file>,gcc/g++浼?xì)鍒?I鍒跺畾鐨勭洰褰曟煡鎵?鏌ユ壘涓嶅埌,鐒跺悗灝嗗埌緋葷粺鐨勭己鐪佺殑澶存枃浠剁洰褰曟煡鎵?/p>
銆銆-I-
銆銆灝辨槸鍙栨秷鍓嶄竴涓弬鏁扮殑鍔熻兘,鎵浠ヤ竴鑸湪-Idir涔嬪悗浣跨敤
銆銆-idirafter dir
銆銆鍦?I鐨勭洰褰曢噷闈㈡煡鎵懼け璐?璁插埌榪欎釜鐩綍閲岄潰鏌ユ壘.
銆銆-iprefix prefix
銆銆-iwithprefix dir
銆銆涓鑸竴璧蜂嬌鐢?褰?I鐨勭洰褰曟煡鎵懼け璐?浼?xì)鍒皃refix+dir涓嬫煡鎵?/p>
銆銆-nostdinc
銆銆浣跨紪璇戝櫒涓嶅啀緋葷粺緙虹渷鐨勫ご鏂囦歡鐩綍閲岄潰鎵懼ご鏂囦歡,涓鑸拰-I鑱斿悎浣跨敤,鏄庣‘闄愬畾澶存枃浠剁殑浣嶇疆
銆銆-nostdin C++
銆銆瑙勫畾涓嶅湪g++鎸囧畾鐨勬爣鍑嗚礬緇忎腑鎼滅儲,浣嗕粛鍦ㄥ叾浠栬礬寰勪腑鎼滅儲,.姝ら夐」鍦ㄥ垱寤簂ibg++搴撲嬌鐢?/p>
銆銆-C
銆銆鍦ㄩ澶勭悊鐨勬椂鍊?涓嶅垹闄ゆ敞閲婁俊鎭?涓鑸拰-E浣跨敤,鏈夋椂鍊欏垎鏋愮▼搴忥紝鐢ㄨ繖涓緢鏂逛究鐨?/p>
銆銆-M
銆銆鐢熸垚鏂囦歡鍏寵仈鐨勪俊鎭傚寘鍚洰鏍囨枃浠舵墍渚濊禆鐨勬墍鏈夋簮浠g爜
銆銆浣犲彲浠ョ敤gcc -M hello.c鏉?a class="channel_keylink" target="_blank">嫻嬭瘯涓涓嬶紝寰堢畝鍗曘?/p>
銆銆-MM
銆銆鍜屼笂闈㈢殑閭d釜涓鏍鳳紝浣嗘槸瀹冨皢蹇界暐鐢?include<file>閫犳垚鐨勪緷璧栧叧緋匯?/p>
銆銆-MD
銆銆鍜?M鐩稿悓錛屼絾鏄緭鍑哄皢瀵煎叆鍒?d鐨勬枃浠墮噷闈?/p>
銆銆-MMD
銆銆鍜?MM鐩稿悓錛屼絾鏄緭鍑哄皢瀵煎叆鍒?d鐨勬枃浠墮噷闈?/p>
銆銆-Wa,option
銆銆姝ら夐」浼犻抩ption緇欐眹緙栫▼搴?濡傛灉option涓棿鏈夐楀彿,灝卞皢option鍒嗘垚澶氫釜閫夐」,鐒跺悗浼犻掔粰浼?xì)姹嚲~栫▼搴?/p>
銆銆-Wl.option
銆銆姝ら夐」浼犻抩ption緇欒繛鎺ョ▼搴?濡傛灉option涓棿鏈夐楀彿,灝卞皢option鍒嗘垚澶氫釜閫夐」,鐒跺悗浼犻掔粰浼?xì)杩炴帴绋嬪?
銆銆-llibrary
銆銆鍒跺畾緙栬瘧鐨勬椂鍊欎嬌鐢ㄧ殑搴?/p>
銆銆渚嬪瓙鐢ㄦ硶
銆銆gcc -lcurses hello.c
銆銆浣跨敤ncurses搴撶紪璇戠▼搴?/p>
銆銆-Ldir
銆銆鍒跺畾緙栬瘧鐨勬椂鍊欙紝鎼滅儲搴撶殑璺緞銆傛瘮濡備綘鑷繁鐨勫簱錛屽彲浠ョ敤瀹冨埗瀹氱洰褰曪紝涓嶇劧緙栬瘧鍣ㄥ皢鍙湪鏍囧噯搴撶殑鐩綍鎵俱傝繖涓猟ir灝辨槸鐩綍鐨勫悕縐般?/p>
銆銆-O0
銆銆-O1
銆銆-O2
銆銆-O3
銆銆緙栬瘧鍣ㄧ殑浼樺寲閫夐」鐨?涓駭鍒紝-O0琛ㄧず娌℃湁浼樺寲,-O1涓虹己鐪佸鹼紝-O3浼樺寲綰у埆鏈楂?/p>
銆銆-g
銆銆鍙槸緙栬瘧鍣紝鍦ㄧ紪璇戠殑鏃跺欙紝浜х敓鏉℃槸淇℃伅銆?/p>
銆銆-gstabs
銆銆姝ら夐」浠tabs鏍煎紡澹扮О璋冭瘯淇℃伅,浣嗘槸涓嶅寘鎷琯db璋冭瘯淇℃伅.
銆銆-gstabs+
銆銆姝ら夐」浠tabs鏍煎紡澹扮О璋冭瘯淇℃伅,騫朵笖鍖呭惈浠呬緵gdb浣跨敤鐨勯澶栬皟璇曚俊鎭?
銆銆-ggdb
銆銆姝ら夐」灝嗗敖鍙兘鐨勭敓鎴恎db鐨勫彲浠ヤ嬌鐢ㄧ殑璋冭瘯淇℃伅.
銆銆-static
銆銆姝ら夐」灝嗙姝嬌鐢ㄥ姩鎬佸簱錛屾墍浠ワ紝緙栬瘧鍑烘潵鐨勪笢瑗匡紝涓鑸兘寰堝ぇ錛屼篃涓嶉渶瑕佷粈涔堝姩鎬佽繛鎺ュ簱錛屽氨鍙互榪愯.
銆銆-share
銆銆姝ら夐」灝嗗敖閲忎嬌鐢ㄥ姩鎬佸簱錛屾墍浠ョ敓鎴愭枃浠舵瘮杈冨皬錛屼絾鏄渶瑕佺郴緇熺敱鍔ㄦ佸簱.
銆銆-traditional
銆銆璇曞浘璁╃紪璇戝櫒鏀寔浼犵粺鐨凜璇█鐗規(guī)?/p>
from錛?br>http://c.chinaitlab.com/ccjq/803616_2.html
1.autoscan (autoconf): 鎵弿婧愪唬鐮佷互鎼滃鏅氱殑鍙Щ妞嶆ч棶棰橈紝姣斿媯鏌ョ紪璇戝櫒錛屽簱錛屽ご鏂囦歡絳夛紝鐢熸垚鏂囦歡configure.scan,瀹冩槸configure.ac鐨勪竴涓洀褰€?/p>
your source files --> [autoscan*] --> [configure.scan] --> configure.ac
2.aclocal (automake):鏍規(guī)嵁宸茬粡瀹夎鐨勫畯錛岀敤鎴峰畾涔夊畯鍜宎cinclude.m4鏂囦歡涓殑瀹忓皢configure.ac鏂囦歡鎵闇瑕佺殑瀹忛泦涓畾涔夊埌鏂囦歡 aclocal.m4涓俛clocal鏄竴涓猵erl 鑴氭湰紼嬪簭錛屽畠鐨勫畾涔夋槸錛?#8220;aclocal - create aclocal.m4 by scanning configure.ac”user input files optional input process output files
================ ============== ======= ============
acinclude.m4 - - - - -.
V
.-------,
configure.ac ------------------------>|aclocal|
{user macro files} ->| |------> aclocal.m4
`-------'
3.autoheader(autoconf): 鏍規(guī)嵁configure.ac涓殑鏌愪簺瀹忥紝姣斿cpp瀹忓畾涔夛紝榪愯m4錛屽0縐癱onfig.h.in
user input files optional input process output files
================ ============== ======= ============
aclocal.m4 - - - - - - - .
|
V
.----------,
configure.ac ----------------------->|autoheader|----> autoconfig.h.in
`----------'
4.automake: automake灝哅akefile.am涓畾涔夌殑緇撴瀯寤虹珛Makefile.in錛岀劧鍚巆onfigure鑴氭湰灝嗙敓鎴愮殑Makefile.in鏂囦歡杞崲 涓篗akefile銆傚鏋滃湪configure.ac涓畾涔変簡涓浜涚壒孌婄殑瀹忥紝姣斿AC_PROG_LIBTOOL錛屽畠浼?xì)璋冪敤libtoolize錛屽惁鍒欏畠 浼?xì)鑷纷凂旂敓config.guess鍜宑onfig.sub
user input files optional input processes output files
================ ============== ========= ============
.--------,
| | - - -> COPYING
| | - - -> INSTALL
| |------> install-sh
| |------> missing
|automake|------> mkinstalldirs
configure.ac ----------------------->| |
Makefile.am ----------------------->| |------> Makefile.in
| |------> stamp-h.in
.---+ | - - -> config.guess
| | | - - -> config.sub
| `------+-'
| | - - - -> config.guess
|libtoolize| - - - -> config.sub
| |--------> ltmain.sh
| |--------> ltconfig
`----------'
5.autoconf:灝哻onfigure.ac涓殑瀹忓睍寮錛岀敓鎴恈onfigure鑴氭湰銆傝繖涓繃紼嬪彲鑳借鐢ㄥ埌aclocal.m4涓畾涔夌殑瀹忋?/p>
user input files optional input processes output files
================ ============== ========= ============
aclocal.m4 ,autoconfig.h.in - - - - - - -.
V
.--------,
configure.ac ----------------------->|autoconf|------> configure
6. ./configure鐨勮繃紼?/pre>
.-------------> [config.cache]
configure* --------------------------+-------------> config.log
|
[config.h.in] -. v .--> [autoconfig.h]
+-------> config.status* -+
Makefile.in ---' `--> Makefile7. make榪囩▼[autoconfig.h] -.
+--> make* ---> 紼嬪簭
Makefile ---'.---------,瀹炰緥錛?br style="FONT: 12px song, Verdana">鍦?hello/鐩綍涓嬪垱寤轟竴涓猦ello.c鏂囦歡錛屽茍緙栬瘧榪愯瀹冿細(xì)
config.site - - ->| |
config.cache - - ->|configure| - - -> config.cache
| +-,
`-+-------' |
| |----> config.status
config.h.in ------->|config- |----> config.h
Makefile.in ------->| .status|----> Makefile
| |----> stamp-h
| +--,
.-+ | |
| `------+--' |
ltmain.sh ------->|ltconfig|-------> libtool
| | |
`-+------' |
|config.guess|
| config.sub |
`------------'
.--------,
Makefile ------>| |
config.h ------>| make |
{project sources} ---------------->| |--------> {project targets}
.-+ +--,
| `--------' |
| libtool |
| missing |
| install-sh |
|mkinstalldirs|
`-------------'#cd /hello/
(1) 緙栧啓婧愭枃浠秇ello.c錛?/p>
#include<stdio.h>
int main(int argc, char** argv)
{
printf("Hello, GNU!n");
return 0;
}[litao@vm0000131 hello]$ ll
total 4
-rw-rw-r-- 1 litao litao 68 Aug 12 12:02 hello.c涓銆乤utoscan
[litao@vm0000131 hello]$ autoscan
autom4te: configure.ac: no such file or directory
autoscan: /usr/bin/autom4te failed with exit status: 1
[litao@vm0000131 hello]$ ll
total 8
-rw-rw-r-- 1 litao litao 0 Aug 12 12:03 autoscan.log
-rw-rw-r-- 1 litao litao 457 Aug 12 12:03 configure.scan
-rw-rw-r-- 1 litao litao 68 Aug 12 12:02 hello.c宸茬粡鐢熸垚浜哻onfigure.scan錛宎utoscan.log鏂囦歡
灝哻onfigure.scan 淇敼涓?nbsp;configure.in錛屾渶鍚庝慨鏀圭殑鍐呭濡備笅錛?/span>
[litao@vm0000131 hello]$ mv configure.scan configure.in
[litao@vm0000131 hello]$ vim configure.in# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
AC_PREREQ(2.59)
AC_INIT(FULL-PACKAGE-NAME, VERSION, BUG-REPORT-ADDRESS)
AC_CONFIG_SRCDIR([hello.c])
#AC_CONFIG_HEADER([config.h])
AM_INIT_AUTOMAKE(hello, 1.0)
# Checks for programs.
AC_PROG_CC
# Checks for libraries.
# Checks for header files.
# Checks for typedefs, structures, and compiler characteristics.
# Checks for library functions.
AC_OUTPUT(Makefile)浜屻乤cloacl
[litao@vm0000131 hello]$ aclocal
鐢熸垚 aclocal.m4 鍜?autom4te.cache (鐢熸垚aclocal.m4鐨勮繃紼嬩腑娑夊強(qiáng)鍒癱onfigure.in)
[litao@vm0000131 hello]$ ll
total 44
-rw-rw-r-- 1 litao litao 31120 Aug 12 12:08 aclocal.m4
drwxr-xr-x 2 litao litao 4096 Aug 12 12:08 autom4te.cache
-rw-rw-r-- 1 litao litao 0 Aug 12 12:03 autoscan.log
-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涓夈乤ntoconf
[litao@vm0000131 hello]$ autoconf
鐢熸垚 configure (鏍規(guī)嵁 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
浜斻乤utomake
bin_PROGRAMS= hello
hello_SOURCES= hello.c鐢熸垚 Makefile.in錛?depcomp錛?install-sh錛?鍜?missing (鏍規(guī)嵁 Makefile.am, 鍜?aclocal.m4)
[litao@vm0000131 hello]$ automake
configure.in: required file `./install-sh' not found
configure.in: required file `./missing' not found
Makefile.am: required file `./depcomp' not found
[litao@vm0000131 hello]$ automake --add-missing
configure.in: installing `./install-sh'
configure.in: installing `./missing'
Makefile.am: installing `./depcomp'
[litao@vm0000131 hello]$ ll
total 192
-rw-rw-r-- 1 litao litao 31120 Aug 12 12:08 aclocal.m4
drwxr-xr-x 2 litao litao 4096 Aug 12 12:14 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
lrwxrwxrwx 1 litao litao 31 Aug 12 12:16 depcomp -> /usr/share/automake-1.9/depcomp
-rw-rw-r-- 1 litao litao 68 Aug 12 12:02 hello.c
lrwxrwxrwx 1 litao litao 34 Aug 12 12:16 install-sh -> /usr/share/automake-1.9/install-sh
-rw-rw-r-- 1 litao litao 69 Aug 12 12:15 Makefile.am
-rw-rw-r-- 1 litao litao 16561 Aug 12 12:16 Makefile.in
lrwxrwxrwx 1 litao litao 31 Aug 12 12:16 missing -> /usr/share/automake-1.9/missing鍏乧onfigure
鐢熸垚 Makefile錛?config.log錛?鍜?config.status鐢熸垚makefile鏁翠釜榪囩▼
configure.in 錛?br style="FONT: 12px song, Verdana">configure.in鏂囦歡鍐呭鏄竴緋誨垪GNU m4 鐨勫畯錛岃繖浜涘畯緇廰utoconf澶勭悊鍚庝細(xì)鍙樻垚媯鏌ョ郴緇熺壒鎬х殑shell scripts銆?configure.in 鍐呭畯鐨勯『搴忓茍娌℃湁鐗瑰埆鐨勮瀹氾紝浣嗘槸姣忎竴涓猚onfigure.in 鏂囦歡蹇呴爤鍦ㄦ墍鏈夊畯鍓嶅姞鍏?AC_INIT 瀹忥紝鐒跺悗鍦ㄦ墍鏈夊畯鐨勬渶鍚庡姞涓?AC_OUTPUT瀹忋傚彲鍏堢敤 autoscan 鎵弿鍘熷鏂囦歡浠ヤ駭鐢熶竴涓?configure.scan 鏂囦歡錛屽啀瀵?configure.scan 鍋氫簺淇敼鎴?configure.in 鏂囦歡銆?/span>鍦ㄨ寖渚嬩腑鎵鐢ㄥ埌鐨勫畯濡備笅錛?br style="FONT: 12px song, Verdana">
dnl
榪欎釜瀹忓悗闈㈢殑瀛椾笉浼?xì)琚鐞嗗Q屽彲浠ヨ涓烘敞閲?nbsp;
AC_INIT(FILE)
璇ュ畯鐢ㄦ潵媯鏌ユ簮浠g爜鎵鍦ㄨ礬寰勶紝autoscan 浼?xì)鑷姩漶旂敓锛屼竴鑸棤欏諱慨鏀瑰畠銆?nbsp;
AM_INIT_AUTOMAKE(PACKAGE,VERSION)
榪欎釜鏄嬌鐢?Automake 鎵蹇呭鐨勫畯錛孭ACKAGE 鏄墍瑕佷駭鐢熻蔣浠跺浠剁殑鍚嶇О錛孷ERSION 鏄増鏈紪鍙楓?nbsp;
AC_PROG_CC
媯鏌ョ郴緇熷彲鐢ㄧ殑C緙栬瘧鍣紝鑻ユ簮浠g爜鏄敤C鍐欑殑灝遍渶瑕佽繖涓畯銆?nbsp;
AC_OUTPUT(FILE)
璁劇疆 configure 鎵瑕佷駭鐢熺殑鏂囦歡錛岃嫢鏄?/span>Makefile 錛宑onfigure 渚夸細(xì)鎶婂畠媯鏌ュ嚭鏉ョ殑緇撴灉甯﹀叆 Makefile.in 鏂囦歡鍚庝駭鐢熷悎閫傜殑 Makefile銆?nbsp;
瀹為檯涓婏紝榪欓噷浣跨敤 Automake 鏃訛紝榪橀渶瑕佷竴浜涘叾浠栫殑瀹忥紝榪欎簺棰濆鐨勫畯鎴戜滑鐢?aclocal鏉ュ府鍔╀駭鐢熴傚煼琛?aclocal浼?xì)漶旂敓aclocal.m4 鏂囦歡錛屽鏋滄棤鐗瑰埆鐨勭敤閫旓紝鍙互涓嶉渶瑕佷慨鏀瑰畠錛岀敤 aclocal 鎵浜х敓鐨勫畯浼?xì)鍛婅?Automake濡備綍鍔ㄤ綔銆?nbsp;
鏈変簡 configure.in 鍙?aclocal.m4涓や釜鏂囦歡浠ュ悗錛屼究鍙互鎵ц autoconf鏉ヤ駭鐢?configure 鏂囦歡浜嗐?br style="FONT: 12px song, Verdana">
Makefile.am
Automake 浼?xì)鏍规?configure.in 涓殑瀹忔妸Makefile.am 杞垚 Makefile.in 鏂囦歡銆?Makefile.am 鏂囦歡瀹氫箟鎵瑕佷駭鐢熺殑鐩爣錛?nbsp;
AUTOMAKE_OPTIONS
璁劇疆 automake 鐨勯夐」銆?br style="FONT: 12px song, Verdana">Automake 涓昏鏄府鍔╁紑鍙?GNU 杞歡鐨勪漢鍛樻潵緇存姢杞歡錛屾墍浠ュ湪鎵ц automake 鏃訛紝浼?xì)妫鏌ョ洰褰曚笅鏄惁瀛樺湪鏍囧噯 GNU 杞歡涓簲鍏峰鐨勬枃浠訛紝渚嬪 'NEWS'銆?AUTHOR'銆?ChangeLog' 絳夋枃浠躲?/span>璁劇疆 foreign 鏃訛紝automake 浼?xì)鏀圭敤涓鑸蔣浠剁殑鏍囧噯鏉ユ鏌ャ?nbsp;
bin_PROGRAMS
瀹氫箟瑕佷駭鐢熺殑鎵ц鏂囦歡鍚嶃傚鏋滆浜х敓澶氫釜鎵ц鏂囦歡錛屾瘡涓枃浠跺悕鐢ㄧ┖鐧界闅斿紑銆?nbsp;
hello_SOURCES
瀹氫箟 'hello' 榪欎釜鎵ц紼嬪簭鎵闇瑕佺殑鍘熷鏂囦歡銆傚鏋?'hello'榪欎釜紼嬪簭鏄敱澶氫釜鍘熷鏂囦歡鎵浜х敓錛屽繀闋堟妸瀹冩墍鐢ㄥ埌鐨勬墍鏈夊師濮嬫枃浠墮兘鍒楀嚭鏉ワ紝浠ョ┖鐧界闅斿紑銆傚亣璁?'hello' 榪橀渶瑕?'hello.c'銆?main.c'銆?hello.h' 涓変釜鏂囦歡鐨勮瘽錛屽垯瀹氫箟
hello_SOURCES= hello.c main.c hello.h
濡傛灉瀹氫箟澶氫釜鎵ц鏂囦歡錛屽垯瀵規(guī)瘡涓墽琛岀▼搴忛兘瑕佸畾涔夌浉瀵圭殑filename_SOURCES銆?nbsp;
緙栬緫濂?Makefile.am 鏂囦歡錛屽氨鍙互鐢?/span> automake --add-missing鏉ヤ駭鐢?Makefile.in銆傚姞涓?--add-missing 閫夐」鏉ュ憡璇?automake欏轟究鍋囧鍖呰涓涓蔣浠舵墍蹇呴』鐨勬枃浠躲侫utomake浜х敓鐢熷嚭渚嗙殑 Makefile.in 鏂囦歡鏄畬鍏ㄧ鍚?GNU Makefile 鐨勬儻渚嬶紝鍙鎵ц configure榪欎釜shell script 渚垮彲浠ヤ駭鐢熷悎閫傜殑 Makefile 鏂囦歡浜嗐?nbsp;
杞嚜錛?br>http://blog.chinaunix.net/u2/76292/showart.php?id=2099939
]]>