Linux/Unix環¾³ÏµÄmakeºÍmakefile詳½â
無論ÊÇÔÚLinux還ÊÇÔÚUnix環¾³ÖУ¬make¶¼ÊÇÒ»個·Ç³£ÖØÒªµÄ編譯Ö¸Áî¡£
²»¹ÜÊÇ×Ô¼º進ÐÐ項Ä¿開發還ÊÇ°²裝應ÓÃ軟體£¬ÎÒ們¶¼經³£ÒªÓõ½make»òmake install¡£ÀûÓÃmake¹¤¾ß£¬ÎÒ們¿ÉÒÔ將´óÐ͵Ä開發項Ä¿·Ö½â³É為¶à個¸üÒ×춹ÜÀíµÄÄ£組£¬對ì¶Ò»個°üÀ¨幾°Ù個Ô´ÎļþµÄ應ÓóÌʽ£¬Ê¹ÓÃmakeºÍmakefile¹¤¾ß¾Í¿ÉÒÔ簡潔Ã÷¿ìµØÀí順¸÷個Ô´ÎļþÖ®間紛·±複雜µÄÏ໥關係¡£
¶øÇÒÈç´Ë¶àµÄÔ´Îļþ£¬Èç¹ûÿ´Î ¶¼Òª°´鍵輸ÈëgccÖ¸Áî進ÐÐ編譯µÄ話£¬ÄÇ對³ÌÐò員來說簡Ö±¾ÍÊÇÒ»場災難¡£¶ømake¹¤¾ß則¿É×Ô動Íê³É編譯¹¤×÷£¬並ÇÒ¿ÉÒÔÖ»對³ÌÐò員ÔÚÉÏ´Î編譯ááÐÞ¸Ä過µÄ²¿·Ö進ÐÐ編譯¡£
Òò´Ë£¬ÓÐЧµÄÀûÓÃmakeºÍmakefile¹¤¾ß¿ÉÒÔ´ó´óÌá¸ß項Ä¿開發µÄЧÂÊ¡£
ͬ時ÕÆÎÕmak eºÍmakefileÖ®áᣬÄúÒ²²»會ÔÙÃæ對ÖøLinuxϵÄ應ÓÃ軟體ÊÖ×ã無´ëÁË¡£
¡¡¡¡µ«ÁîÈË遺º¶µÄÊÇ£¬ÔÚ許¶à講ÊöLinuxÌ×ÓõÄ書¼®É϶¼沒ÓÐ詳細½é紹這個¹¦ÄÜ強´óµ«Óַdz£複雜µÄ編譯¹¤¾ß¡£ÔÚ這裡ÎÒ¾ÍÏò´ó¼Ò詳細½é紹Ò»ÏÂmake¼°ÆäÃèÊöÎļþmakefile¡£
MakefileÎļþ
¡¡¡¡Make¹¤¾ß×îÖ÷ÒªÒ²ÊÇ×î»ù±¾µÄ¹¦ÄܾÍÊÇͨ過makefileÎļþ來ÃèÊöÔ´³ÌÐòÖ®間µÄÏ໥關係並×Ô動維護編譯¹¤×÷¡£¶ømakefile ÎļþÐèÒª°´ÕÕij種語·¨進ÐÐ編寫£¬ÎļþÖÐÐèÒª說Ã÷ÈçºÎ編譯¸÷個Ô´Îļþ並連½Ó產Éú¿É執ÐÐÎļþ£¬並ÒªÇó¶¨義Ô´ÎļþÖ®間µÄÒÀ賴關係¡£
makefile ÎļþÊÇ許¶à編譯Æ÷--°üÀ¨ Windows NT ϵÄ編譯Æ÷--維護編譯資訊µÄ³£Ó÷½·¨£¬Ö»ÊÇÔÚÕûºÏ開發
Ïà¹ØÎĵµ£º
2009 Äê 4 ÔÂ 23 ÈÕ
±¾ÎÄÖÐÎÒÃÇÕë¶Ô Linux É϶àÏ̱߳à³ÌµÄÖ÷ÒªÌØÐÔ×ܽá³ö 5 Ìõ¾Ñ飬ÓÃÒÔ¸ÄÉÆ Linux ¶àÏ̱߳à³ÌµÄÏ°¹ßºÍ±ÜÃâÆäÖеĿª·¢ÏÝÚå¡£ÔÚ±¾ÎÄÖУ¬ÎÒÃÇ´©²åһЩ Windows µÄ±à³ÌÓÃÀýÓÃÒÔ¶Ô±È Linux ÌØÐÔ£¬ÒÔ¼ÓÉî¶ÁÕßÓ¡Ïó¡£
±³¾°
Linux ƽ̨ÉϵĶàÏ̳߳ÌÐò¿ª·¢Ïà¶ÔÓ¦ÆäËûƽ̨£¨±ÈÈç Windows£©µÄ¶àÏß³Ì API ÓÐһЩϸ΢ ......
ÔÚÍøÉÏ¿´µ½ÓÐÈË×ܽáµÃ²»´í
1£®¿ª»úÆô¶¯Ê±×Ô¶¯ÔËÐгÌÐò
Linux
¼ÓÔغó, Ëü½«³õʼ»¯Ó²¼þºÍÉ豸Çý¶¯, È»ºóÔËÐеÚÒ»¸ö½ø³Ìinit¡£init¸ù¾ÝÅäÖÃÎļþ¼ÌÐøÒýµ¼¹ý³Ì£¬Æô¶¯ÆäËü½ø³Ì¡£Í¨³£Çé¿öÏ£¬Ð޸ķÅÖÃ
ÔÚ /etc/rc»ò /etc/rc.d »ò /etc/rc?.d Ŀ¼ÏµĽű¾Îļþ£¬¿ÉÒÔʹinit×Ô¶¯Æô¶¯Æ ......
1£®top
topÃüÁî¿ÉʵʱµØÏÔʾLinuxϵͳµÄ½ø³Ì¡¢CPU¡¢ÄÚ´æ¡¢¸ºÔصȵÄÐÅÏ¢¡£ËüÊÇÎÒÃÇÁ˽âϵͳÕûÌå״̬×îºÃµÄ¹¤¾ß¡£
topÃüÁîµÄÔËÐÐ״̬ÊÇÒ»¸öʵʱµÄÏÔʾ¹ý³Ì£¬ÎÒÃÇ¿ÉÔÚÕâ¸ö½çÃæ¼à¿ØϵͳÔËÐÐÇé¿ö¡£ÎÒÃÇ¿Éͨ¹ý¼¸¸ö°´¼üÀ´¿ØÖÆtopÃüÁÈç°´q¿ÉÍ˳ötopÃüÁî״̬£¬°´s¿ÉÊäÈëÐÅÏ¢µÄ¸üÐÂƵÂʵȡ£ÕâЩÃüÁî¿É°´h°ïÖú¼ü²éѯ¡£
2£®Ps ......
Name
times - get process times
Synopsis
#include <sys/times.h>
clock_t times(struct tms *buf);
Description
times() stores the current process times in the
struct tms that buf points to. The struct tms is as defined
in <sys/times.h>
:
struct tms {
clock_t tms_utime; /* us ......
·Ò룺·É¸ç (
http://hi.baidu.com/imlidapeng
)
°æȨËùÓУ¬×ðÖØËûÈËÀͶ¯³É¹û£¬×ªÔØʱÇë×¢Ã÷×÷ÕߺÍÔʼ³ö´¦¼°±¾ÉùÃ÷¡£
ÔÎÄÃû³Æ£º¡¶Linux Performance and Tuning Guidelines¡·
ÔÎĵØÖ·£ºhttp://www.redbooks.ibm.com/abstracts/redp4285.html
----------------------------------------------------------------- ......