首页 > 其他 > 详细

makefile

时间:2018-04-23 23:35:38      阅读:202      评论:0      收藏:0      [点我收藏+]
  1 #
  2 #
  3 #all:
  4 #       arm-linux-gcc main.c -c -o main.o -I./include
  5 #       arm-linux-gcc hardware.c -c -o hardware.o -I./include
  6 #       arm-linux-as start.S -o start.o
  7 #       
  8 #       arm-linux-ld start.o main.o hardware.o -o arm -Ttext 0x50000000
  9 #       
 10 #       arm-linux-objcopy -O binary arm arm.bin
 11 TARGET                  :=arm
 12 BIN                     :=$(TARGET).bin
 13 LD_ADDR                 :=0x50000000
 14 START_OBJ               :=start.o
 15 OBJS                    :=main.o hardware.o
 16 
 17 CROSS_COMPILE           :=arm-linux-
 18 CC                      :=$(CROSS_COMPILE)gcc
 19 LD                      :=$(CROSS_COMPILE)ld
 20 AS                      :=$(CROSS_COMPILE)as
 21 OBJCOPY         :=$(CROSS_COMPILE)objcopy -O binary
 22 OBJDUMP                 :=$(CROSS_COMPILE)objdump -D
 23 NM                      :=$(CROSS_COMPILE)nm
 24 
 25 CFLAGS                  :=-I./include
 26 LDFLAGS                 :=
 27 RM                      :=rm -rf
 28 
 29 all:$(TARGET)
 30         $(OBJCOPY) $< $(BIN)
 31         $(OBJDUMP) $< > bin.s
 32         $(NM) $< > System.map
 33         $(RM) $<        
 34 $(TARGET):$(START_OBJ) $(OBJS)
 35         $(LD) $^ -o $@ -Ttext $(LD_ADDR)
 36 %.o:%.s
 37         $(AS) $< -o $@
 38 clean:
 39         $(RM) *.o $(TARGET) $(BIN)  System.map bin.s

 

makefile

原文:https://www.cnblogs.com/axjlxy/p/8922597.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!