<meter id="pryje"><nav id="pryje"><delect id="pryje"></delect></nav></meter>
          <label id="pryje"></label>

          新聞中心

          EEPW首頁 > 嵌入式系統(tǒng) > 設(shè)計應(yīng)用 > linux kernel 1.0 網(wǎng)絡(luò)模塊代碼分析――目錄及Makefile

          linux kernel 1.0 網(wǎng)絡(luò)模塊代碼分析――目錄及Makefile

          作者: 時間:2018-09-05 來源:網(wǎng)絡(luò) 收藏

          在linux kernel 1.0的net目錄下查看子目錄及文件結(jié)構(gòu):

          本文引用地址:http://www.ex-cimer.com/article/201809/388515.htm

          [root@localhost net]# ls -R

          .:

          ddi.c inet Makefile socket.c Space.c unix

          ./inet:

          arp.c datagram.c dev.h eth.h icmp.h ip.c loopback.c packet.c protocol.c raw.c README route.h skbuff.h sock.h tcp.h udp.c utils.c

          arp.h dev.c eth.c icmp.c inet.h ip.h Makefile proc.c protocol.h raw.h route.c skbuff.c sock.c tcp.c timer.c udp.h

          ./unix:

          Makefile proc.c sock.c unix.h

          可以看到net由ddi.c,socket.c和Space.c三個文件,inet和unix兩個目錄,還有Makefile組成。

          暫時不理睬inet和unix目錄下的文件,看看Makefile的內(nèi)容:

          # Note! Dependencies are done automagically by 'make dep', which also

          # removes any old dependencies. DON'T put your own dependencies here

          # unless it's something special (ie not a .c file).

          #

          # Note 2! The CFLAGS definition is now in the main makefile...

          # only these two lines should need to be changed to remove inet sockets.

          # (and the inet/tcpip.o in net.o)

          SUBDIRS := unix inet

          SUBOBJS := $(foreach f,$(SUBDIRS),$f/$f.o)

          #SUBOBJS的值為 unix/unix.o inet/inet.o

          .c.o:

          $(CC) $(CFLAGS) -c $

          .s.o:

          $(AS) -o $*.o $

          .c.s:

          $(CC) $(CFLAGS) -S $

          #老式makefile中的隱式規(guī)則定義

          #如果編譯目標(biāo)為xx.o:xx.c則自動引用第一個規(guī)則,依此類推

          OBJS = Space.o ddi.o socket.o

          all: subdirs net.o

          net.o: $(OBJS) network.a

          $(LD) -r -o net.o $(OBJS) network.a

          #將Space.o,ddi.o,socket.o和netowrk.a編譯成net.o,net.o再編譯進內(nèi)核中。

          network.a: $(SUBOBJS)

          rm -f $@

          ar rc $@ $(SUBOBJS)

          ranlib $@

          #將unix/unix.o和inet/inet.o打包成network.a

          subdirs: dummy

          set -e; for i in $(SUBDIRS); do $(MAKE) -C $$i; done

          #進入各個子目錄分別編譯unix.o和inet.o

          dep:

          $(CPP) -M *.c > .depend

          set -e; for i in $(SUBDIRS); do $(MAKE) -C $$i dep; done

          dummy:

          #假的target

          #

          # include a dependency file if one exists

          #

          ifeq (.depend,$(wildcard .depend))

          include .depend

          endif

          Makefile 51L, 1023C



          關(guān)鍵詞:

          評論


          相關(guān)推薦

          技術(shù)專區(qū)

          關(guān)閉
          看屁屁www成人影院,亚洲人妻成人图片,亚洲精品成人午夜在线,日韩在线 欧美成人 (function(){ var bp = document.createElement('script'); var curProtocol = window.location.protocol.split(':')[0]; if (curProtocol === 'https') { bp.src = 'https://zz.bdstatic.com/linksubmit/push.js'; } else { bp.src = 'http://push.zhanzhang.baidu.com/push.js'; } var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(bp, s); })();