解释下Winavr中的makefile.docVIP

  • 14
  • 0
  • 约1.69万字
  • 约 19页
  • 2018-01-18 发布于河南
  • 举报
解释下Winavr中的makefile

今天有空,解释下Winavr中的makefile! 2008-10-19 16:49:21|??分类: 微控制器 |??标签: |字号大中小?订阅 ? # Hey Emacs, this is a -*- makefile -*- # # WinAVR Sample makefile written by Eric B. Weddington, J鰎g Wunsch, et al. # Released to the Public Domain # Please read the make user manual! # # Additional material for this makefile was submitted by: #? Tim Henigan #? Peter Fleury #? Reiner Patommel #? Sander Pool #? Frederik Rouleau #? Markus Pfaff # # On command line: # # make all = Make software. # # make clean = Clean out built project files. # # make coff = Convert ELF to AVR COFF (for use with AVR Studio 3.x or VMLAB). # # make extcoff = Convert ELF to AVR Extended COFF (for use with AVR Studio #??????????????? 4.07 or greater). # # make program = Download the hex file to the device, using avrdude.? Please #??????????????? customize the avrdude settings below first! # # make filename.s = Just compile filename.c into the assembler code only # # To rebuild project do make clean then make all. # ? 风城少主 于 2008年10月19日? 笔 ? E_mail : wyoujtg@163.com ? 欢迎转载和与我交流! ? 今天有空,解释下Winavr中的makefile! 注:从“/*” 到 “*/”之间的内容是我加入的 ? ? ? # MCU name MCU = atmega128 /* 在makefile文件中定义的变量,有点类似C语言中的宏,它代表了一个文本字符串;在C语言中,在编译的预处理阶段,用到宏的地方都会用宏的定义进行精确的展开,而在makefile文件执行的时候,变量也会自动按它的值展开在所使用的位置。既然称作变量,当然就是可改变的,这就是它与C语言中的宏的不同之处。 在上面定义了一个变量MCU,并赋予它的初值为atmega128。 变量的赋值,有如下三种方法: 1). MCU = atmega128????????????? //直接赋值 2). MCU := $(AVR)???????????? ???????? //直接赋值,但有限制 3). MCU+ = atmega128??????????? //追加方式 讲下第二种,这句话的意思是把变量AVR的值赋予变量MCU,使用一个变量时需要用$(),这个要记住!“=”号前有个“:”,这要求变量AVR要在变量MCU定义之前被定义,这就是限制! 前面讲到它有点类似C语言中的宏,它代表了一个文本字符串,追加方式可以理解为两个字符串连接在一起。 这个变量的作用主要是传递MCU型号给编译器,好让它选择与MCU型号对应头文件等。 */ ? # Output format. (can be srec, ihex, binary) FORMAT = ihex /* 定义一个变量FORMAT,值为ihex,作用是选择生成的烧录文件的格式,该变量可设置的值有srec, ihex, binary */ ? # Target file name (without extension). TARGET = main /* 定义一个变量TARGET,值为main,作用是告诉编译器最终目标的名字叫什么,在这里就讲下什么叫目标,请看下面: foo.o: foo.c foo.h ???????? gcc –c –g foo.c foo.o也就是目标!foo.c foo.h是foo.o目标所依赖的文件,如果foo.c与foo.h当中有一个或以上文件比f

文档评论(0)

1亿VIP精品文档

相关文档