Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

Linux GCC makeÎļþµÄд·¨ ×ܽá°æ

Ŀ¼½á¹¹Îª£º
inc/hello.h
src/hello.c
main/main.c
Makefile
ÎļþÄÚÈÝΪ£º
hello.h:
void hello(char name[]);

hello.c:
#include <stdio.h>
void hello(char name[])
{
printf("Hello %s!\n", name);
}

main.c:
#include <stdio.h>
#include "hello.h"
// The second hello.h should in ""
int main()
{
hello("GCC");
printf("Haha Linux Ubuntu!\n");
return 0;
}

Makefile:
# String declaration
objects = main.o hello.o
# Command
app : $(objects)
cc -o app $(objects)
main.o : main.c hello.h stdio.h
cc -c $< -I ./inc
hello.o : hello.c stdio.h
cc -c $<
# Search paths
vpath %.h /usr/include : inc
vpath %.c main : src
# Clean the intermediate files
.PHONY : clean
clean :
rm app *~ $(objects)

Ê×ÏÈ£¬ÐèÒªÃ÷È·Ò»µã£¬ÕâÀïÃæÓÐÁ½¸öÖ´ÐгÌÐò£¬Ò»¸ömake£¬Ò»¸ögcc£¬ÔÚMakefileÀïÕâÁ½¸öµÄÓï¾äÒ²ÊÇ·Ö±ðÕ¼1Ðеġ£
ÕâÀï×îÖ÷ÒªµÄÊÇ·¾¶µÄÎÊÌ⣬ÒòΪ²»Í¬µÄÎļþÔÚ²»Í¬µÄĿ¼ÏÂÃ棬ËùÒÔÒª¸æËß³ÌÐòÎļþËùÔڵķ¾¶£¬¶øÓÖÓÐÁ½¸ö³ÌÐòÐèÒª¸æÖª£¬¶øÁ½¸ö³ÌÐò¸æÖªµÄ·½Ê½ÓÖ²»Í¬£¬ËùÒÔÕâ¸öÎÊÌâÒ»¿ªÊ¼À§ÈÅÁËÎҺþã¬ÔںöàºÃÐÄÈ˵İïÖúÏ£¬ÖÕÓÚÃ÷°×ÁËÒ»µã¡£
makeµÄËÑË÷·¾¶ÉèÖ÷½Ê½Îª£ºvpath»òVPATH£¬Õâ¸öÔÚÐí¶à×ÊÁÏÀﶼ½²¹ý£¬¶øÇÒÕâ¸öÊÇËùÓÐÎļþ¶¼¿ÉÒÔÉèÖõģ¬.c, .h»¹ÓÐÆäËüµÄ¶¼¿ÉÒÔ¡£
gccµÄËÑË÷·¾¶ÉèÖ÷½Ê½Îª£¨Õâ¸öÓ¦¸ÃÊÇÖ»ÄÜÉèÖÃÍ·ÎļþµÄËÑË÷·¾¶£¬ÒòΪÊÇinclude£©£º-I inc£¬
¶ø.cÎļþµÄËÑË÷·¾¶Ëƺõ²»ÄÜÉèÖ㬶øÖ»ÄÜÔÚcc -c path/%.cÖÐÏÔʾµÄд³ö£¬¸öÈËÕâôÀí½â¡£
¶øÓÐÒ»ÖÖ·½Ê½ÊÇ¿ÉÒÔ²»ÓÃÏÔʾµÄд³öµÄ£¬¶øÇÒÒ²²»Óðɣ¬%.cҲд³ö£¬¾ÍÊÇÓÃmakeµÄ×Ô¶¯»¯±äÁ¿¡£
“$<”ºÍ“$@”ÔòÊÇ×Ô¶¯»¯±äÁ¿£¬“$<”±íʾËùÓеÄÒÀÀµÄ¿±ê¼¯£¨%.c£©£¬“$@”±íʾĿ±ê¼¯£¨%.o£©¡£
(ÊÇmakeµÄ±äÁ¿£¬ÎļþÔÚµ±Ç°Ä¿Â¼Ã»ÓÐÕÒµ½µÄ»°£¬»á×Ô¶¯ËÑË÷vpathÖÐÉèÖõÄ·¾¶£¬Èç¹û²»ÓÃÕâ¸öÄÇôÈç¹û.cÔÚ²»ÔÚµ±Ç°Ä¿Â¼Ï£¬-cºóÃæÒªÖ¸Ã÷Ŀ¼λÖã¬ÓÃÕâ¸öºó£¬¿ÉÒÔÔÚvpathÖÐÖ¸Ã÷¼´¿É£©
ÒòΪÊÇmakeµÄ±äÁ¿£¬ËùÒÔÓÃvpathÉèÖõÄmakeµÄ·¾¶ÔÚÕâÀïÃæ¾ÍÆð×÷ÓÃÁË£¬²»ÓÃÔÙÏÔʾµÄÖ¸Ã÷.cµÄ·¾¶ÁË¡£¶øÇÒÕâÑùдÆðÀ´£¬¸ü¼ò½à¡£
×î½üÔÚ¿´¡¶ÉîÈëÀí½â¼ÆËã»úϵͳ¡·ÍøÉÏÏÂÔصĴúÂ붼ÊÇÔÚLinuxÉÏÅܵģ¬ºÇºÇ£¬ËùÒÔµÃ×Ô¼ºÐ´Makefile£¬ËùÒÔ£¬Ñо¿ÁËһϣ¬ÖÕÓÚÕûÃ÷°


Ïà¹ØÎĵµ£º

linux ×Ô¶¯¹ÒÔØÓ²ÅÌ

Ò».²é¿´ËùÓÐÓ²Å̵Äuuid
ls -all /dev/disk/by-uuid
longseakerµÄʵÀý
lrwxrwxrwx 1 root root 10 2009-09-19 08:17 05434a61-8a78-4ee5- a5db-6a49079b9e3d -> ../../sda5
lrwxrwxrwx 1 root root 10 2009-09-19 08:17 07D8-0104 -> ../../sda1
lrwxrwxrwx 1 root root 10 2009-09-19 08:17 18201249-998a-4bb1 ......

Linux²é¿´Ó²¼þÐÅÏ¢

ÔÚLINUX»·¾³¿ª·¢Çý¶¯³ÌÐò£¬Ê×ÏÈҪ̽²âµ½ÐÂÓ²¼þ£¬½ÓÏÂÀ´¾ÍÊÇ¿ª·¢Çý¶¯³ÌÐò¡£
³£ÓÃÃüÁîÕûÀíÈçÏ£º
ÓÃÓ²¼þ¼ì²â³ÌÐòkudzu̽²âÐÂÓ²¼þ£ºservice kudzu start ( or restart)
²é¿´CPUÐÅÏ¢£ºcat /proc/cpuinfo
²é¿´°å¿¨ÐÅÏ¢£ºcat /proc/pci
²é¿´PCIÐÅÏ¢£ºlspci (Ïà±Ècat /proc/pci¸üÖ±¹Û£©
²é¿´ÄÚ´æÐÅÏ¢ ......

Ubuntu8.04ϱàÒëlinuxÄÚºË

½ñÌì¿´µ½Ê¦ÐÖ¹¤Î»ÉÏÓб¾Linux Kernel In a Nutshell£¬»¹ÊÇÈ«Ó¢µÄÓ°Ó¡°æ£¬ËùÒԾͽè¹ýÀ´¿´¿´£¬·¢ÏÖÏÖÔÚ¿´Ó¢ÎĵÄÊé½¥½¥ÊÊÓ¦ÁË£¬»¹ÊDZȽÏÈÝÒ׵ģ¬ÊéÖпªÊ¼½éÉÜÈçºÎ±àÒëLinuxÄںˣ¬LinuxÄں˴óÈýµÄʱºòҲѧ¹ý±àÒë¹ý£¬µ«Êǵ±Ê±±àÒë±È½Ï¼òµ¥£¬Õâ´Î¾ö¶¨ÔÙÖØÍ·µ½Î²ºÃºÃ±àÒëһϣ¬Ê×ÏÈÏÂÔØlinux kernel£¬ÔÙÓÃsecureCRTÉÏ´«µ½Ubuntu 8. ......

linuxϵͳ³£ÓÃÃüÁî

£¨Ò»£©Îļþ¡¢Ä¿Â¼²Ù×÷ÃüÁî
1¡¢lsÃüÁî
¹¦ÄÜ£ºÏÔʾÎļþºÍĿ¼µÄÐÅÏ¢
ls¡¡ÒÔĬÈÏ·½Ê½ÏÔʾµ±Ç°Ä¿Â¼ÎļþÁбí
ls -a ÏÔʾËùÓÐÎļþ°üÀ¨Òþ²ØÎļþ
ls -l ÏÔʾÎļþÊôÐÔ£¬°üÀ¨´óС£¬ÈÕÆÚ£¬·ûºÅÁ¬½Ó£¬ÊÇ·ñ¿É¶Áд¼°ÊÇ·ñ¿ÉÖ´ÐÐ
ls -lh ÏÔʾÎļþµÄ´óС£¬ÒÔÈÝÒ×Àí½âµÄ¸ñʽӡ³öÎļþ´óС (ÀýÈç 1K 234M 2G)
ls -lt ÏÔʾÎļþ£¬°´ÕÕÐÞ¸ÄÊ ......

linuxϵͳÏÂNS 2£¨ÍøÂç·ÂÕ濪ԴÈí¼þ£©µÄ°²×°

Ò».ʲôÊÇNS 2
      NS 2ÊÇÒ»ÖÖÕë¶ÔÍøÂç¼¼ÊõµÄÔ´´úÂ빫¿ªµÄ¡¢Ãâ·ÑµÄÈí¼þÄ£Äâƽ̨£¬Ñо¿ÈËԱʹÓÃËü¿ÉÒÔºÜÈÝÒ׵ĽøÐÐÍøÂç¼¼ÊõµÄ¿ª·¢£¬¶øÇÒ·¢Õ¹µ½½ñÌ죬ËüËù°üº¬µÄÄ£¿é·Ç³£·á¸»£¬¼¸ºõÉæ¼°µ½ÁËÍøÂç¼¼ÊõµÄËùÓз½Ãæ¡£
      NS 2£¨Network Simulator, version
2£©ÊÇÒ»ÖÖÃæ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ