Chinaunix首页 | 论坛 | 博客
  • 博客访问: 723661
  • 博文数量: 124
  • 博客积分: 3156
  • 博客等级: 中校
  • 技术积分: 1584
  • 用 户 组: 普通用户
  • 注册时间: 2008-08-02 10:29
文章分类

全部博文(124)

文章存档

2012年(3)

2011年(2)

2010年(61)

2009年(34)

2008年(24)

我的朋友

分类: LINUX

2008-11-28 17:37:04

# -Wall
#    $(CC) -o start -nostdinc  -I./include -nostdlib -Bstatic  src/ubl.c src/uart.c  src/util.c -Wl,-T./src/ubl_davinci.lds  \
#     -Wl,--start-group /home/reny/workdir/app/ubl2/lib/libc.a /home/reny/workdir/app/ubl2/net/libnet.a  -Wl,--end-group
CC=arm-linux-gcc
LD=arm-linux-ld
CFLAGS=  -c   -nostdinc  -I./include     
LDFLAGS= -nostdlib  -Bstatic  -T./src/ubl_davinci.lds

        
OBJECTS=  ubl.o uart.o  util.o  lib/libc.a net/libnet.a 

         
all: boot.bin
 
boot.bin: $(OBJECTS)
    $(LD)  -o start  -nostdlib -static   -T./src/ubl_davinci.lds  ubl.o uart.o  util.o  \
    --start-group  /home/reny/workdir/app/ubl2/lib/libc.a /home/reny/workdir/app/ubl2/net/libnet.a --end-group
    #$(LD) $(LDFLAGS) $(OBJECTS)    -o start   

    arm-linux-objcopy -O binary start boot.bin
    @echo -n "The entry point of the binary is 0x"
    @arm-linux-objdump -t start | grep -E '[0-9a-f]{8}*[0-9a-f]{8} nmain' | sed  's/^\([0-9a-f]\{8\}\)\([0-9a-f]\{4\}\).*/\2/'
       
uart.o:src/uart.c
    $(CC) $(CFLAGS) src/uart.c
ubl.o:src/ubl.c
    $(CC) $(CFLAGS) src/ubl.c
util.o:src/util.c
    $(CC) $(CFLAGS) src/util.c
   
.PHONY : lib/libc.a
lib/libc.a:
    cd lib; make libc.a; cd ..
.PHONY : net/libnet.a
net/libnet.a:
    cd net; make libnet.a; cd ..


clean:
    @rm *.o
    @touch 1.bin
    cd lib; make clean; cd ..
    cd net; make clean; cd ..
    @rm *.bin
    @touch 1.bak
    @rm *.bak
    @rm start
阅读(835) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~