Keyboard firmwares for Atmel AVR and Cortex-M
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Makefile.vusb 16KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619
  1. #----------------------------------------------------------------------------
  2. # On command line:
  3. #
  4. # make all = Make software.
  5. #
  6. # make clean = Clean out built project files.
  7. #
  8. # make coff = Convert ELF to AVR COFF.
  9. #
  10. # make extcoff = Convert ELF to AVR Extended COFF.
  11. #
  12. # make program = Download the hex file to the device, using avrdude.
  13. # Please customize the avrdude settings below first!
  14. #
  15. # make debug = Start either simulavr or avarice as specified for debugging,
  16. # with avr-gdb or avr-insight as the front end for debugging.
  17. #
  18. # make filename.s = Just compile filename.c into the assembler code only.
  19. #
  20. # make filename.i = Create a preprocessed source file for use in submitting
  21. # bug reports to the GCC project.
  22. #
  23. # To rebuild project do "make clean" then "make all".
  24. #----------------------------------------------------------------------------
  25. # Following variables need to be set in <target>/Makefile:
  26. # TARGET
  27. # COMMON_DIR
  28. # TARGET_DIR
  29. # TARGET_SRC
  30. # MCU
  31. # F_CPU
  32. # List C source files here. (C dependencies are automatically generated.)
  33. SRC = usbdrv.c \
  34. usbdrvasm.S \
  35. oddebug.c
  36. SRC += $(TARGET_SRC)
  37. # Option modules
  38. ifdef $(or MOUSEKEY_ENABLE, PS2_MOUSE_ENABLE)
  39. SRC += usb_mouse.c
  40. endif
  41. ifdef MOUSEKEY_ENABLE
  42. SRC += mousekey.c
  43. endif
  44. ifdef PS2_MOUSE_ENABLE
  45. SRC += ps2.c \
  46. ps2_mouse.c
  47. endif
  48. ifdef USB_EXTRA_ENABLE
  49. SRC += usb_extra.c
  50. endif
  51. # C source file search path
  52. VPATH = $(TARGET_DIR):$(COMMON_DIR):$(COMMON_DIR)/usbdrv
  53. # Output format. (can be srec, ihex, binary)
  54. FORMAT = ihex
  55. # Object files directory
  56. # To put object files in current directory, use a dot (.), do NOT make
  57. # this an empty or blank macro!
  58. OBJDIR = obj
  59. # Optimization level, can be [0, 1, 2, 3, s].
  60. # 0 = turn off optimization. s = optimize for size.
  61. # (Note: 3 is not always the best optimization level. See avr-libc FAQ.)
  62. OPT = s
  63. # Debugging format.
  64. # Native formats for AVR-GCC's -g are dwarf-2 [default] or stabs.
  65. # AVR Studio 4.10 requires dwarf-2.
  66. # AVR [Extended] COFF format requires stabs, plus an avr-objcopy run.
  67. DEBUG = dwarf-2
  68. # List any extra directories to look for include files here.
  69. # Each directory must be seperated by a space.
  70. # Use forward slashes for directory separators.
  71. # For a directory that has spaces, enclose it in quotes.
  72. #EXTRAINCDIRS = $(TARGET_DIR) $(COMMON_DIR)
  73. EXTRAINCDIRS = $(subst :, ,$(VPATH))
  74. # Compiler flag to set the C Standard level.
  75. # c89 = "ANSI" C
  76. # gnu89 = c89 plus GCC extensions
  77. # c99 = ISO C99 standard (not yet fully implemented)
  78. # gnu99 = c99 plus GCC extensions
  79. CSTANDARD = -std=gnu99
  80. #OPT_DEFS =
  81. ifdef MOUSEKEY_ENABLE
  82. OPT_DEFS += -DMOUSEKEY_ENABLE
  83. endif
  84. ifdef PS2_MOUSE_ENABLE
  85. OPT_DEFS += -DPS2_MOUSE_ENABLE
  86. endif
  87. ifdef USB_EXTRA_ENABLE
  88. OPT_DEFS += -DUSB_EXTRA_ENABLE
  89. endif
  90. ifdef USB_NKRO_ENABLE
  91. OPT_DEFS += -DUSB_NKRO_ENABLE
  92. endif
  93. ifdef $(or MOUSEKEY_ENABLE, PS2_MOUSE_ENABLE)
  94. OPT_DEFS += -DUSB_MOUSE_ENABLE
  95. endif
  96. # Place -D or -U options here for C sources
  97. CDEFS = -DF_CPU=$(F_CPU)UL
  98. CDEFS += $(OPT_DEFS)
  99. # Place -D or -U options here for ASM sources
  100. ADEFS = -DF_CPU=$(F_CPU)
  101. ADEFS += $(OPT_DEFS)
  102. # Place -D or -U options here for C++ sources
  103. CPPDEFS = -DF_CPU=$(F_CPU)UL
  104. #CPPDEFS += -D__STDC_LIMIT_MACROS
  105. #CPPDEFS += -D__STDC_CONSTANT_MACROS
  106. CPPDEFS += $(OPT_DEFS)
  107. #---------------- Compiler Options C ----------------
  108. # -g*: generate debugging information
  109. # -O*: optimization level
  110. # -f...: tuning, see GCC manual and avr-libc documentation
  111. # -Wall...: warning level
  112. # -Wa,...: tell GCC to pass this to the assembler.
  113. # -adhlns...: create assembler listing
  114. CFLAGS = -g$(DEBUG)
  115. CFLAGS += $(CDEFS)
  116. CFLAGS += -O$(OPT)
  117. CFLAGS += -funsigned-char
  118. CFLAGS += -funsigned-bitfields
  119. CFLAGS += -ffunction-sections
  120. CFLAGS += -fpack-struct
  121. CFLAGS += -fshort-enums
  122. CFLAGS += -Wall
  123. CFLAGS += -Wstrict-prototypes
  124. #CFLAGS += -mshort-calls
  125. #CFLAGS += -fno-unit-at-a-time
  126. #CFLAGS += -Wundef
  127. #CFLAGS += -Wunreachable-code
  128. #CFLAGS += -Wsign-compare
  129. CFLAGS += -Wa,-adhlns=$(@:%.o=%.lst)
  130. CFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
  131. CFLAGS += $(CSTANDARD)
  132. CFLAGS += -include config.h
  133. #---------------- Compiler Options C++ ----------------
  134. # -g*: generate debugging information
  135. # -O*: optimization level
  136. # -f...: tuning, see GCC manual and avr-libc documentation
  137. # -Wall...: warning level
  138. # -Wa,...: tell GCC to pass this to the assembler.
  139. # -adhlns...: create assembler listing
  140. CPPFLAGS = -g$(DEBUG)
  141. CPPFLAGS += $(CPPDEFS)
  142. CPPFLAGS += -O$(OPT)
  143. CPPFLAGS += -funsigned-char
  144. CPPFLAGS += -funsigned-bitfields
  145. CPPFLAGS += -fpack-struct
  146. CPPFLAGS += -fshort-enums
  147. CPPFLAGS += -fno-exceptions
  148. CPPFLAGS += -Wall
  149. CPPFLAGS += -Wundef
  150. #CPPFLAGS += -mshort-calls
  151. #CPPFLAGS += -fno-unit-at-a-time
  152. #CPPFLAGS += -Wstrict-prototypes
  153. #CPPFLAGS += -Wunreachable-code
  154. #CPPFLAGS += -Wsign-compare
  155. CPPFLAGS += -Wa,-adhlns=$(@:%.o=%.lst)
  156. CPPFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
  157. #CPPFLAGS += $(CSTANDARD)
  158. CPPFLAGS += -include config.h
  159. #---------------- Assembler Options ----------------
  160. # -Wa,...: tell GCC to pass this to the assembler.
  161. # -adhlns: create listing
  162. # -gstabs: have the assembler create line number information; note that
  163. # for use in COFF files, additional information about filenames
  164. # and function names needs to be present in the assembler source
  165. # files -- see avr-libc docs [FIXME: not yet described there]
  166. # -listing-cont-lines: Sets the maximum number of continuation lines of hex
  167. # dump that will be displayed for a given single line of source input.
  168. ASFLAGS = $(ADEFS) -Wa,-adhlns=$(@:%.o=%.lst),-gstabs,--listing-cont-lines=100
  169. ASFLAGS += -include config.h
  170. #---------------- Library Options ----------------
  171. # Minimalistic printf version
  172. PRINTF_LIB_MIN = -Wl,-u,vfprintf -lprintf_min
  173. # Floating point printf version (requires MATH_LIB = -lm below)
  174. PRINTF_LIB_FLOAT = -Wl,-u,vfprintf -lprintf_flt
  175. # If this is left blank, then it will use the Standard printf version.
  176. PRINTF_LIB =
  177. #PRINTF_LIB = $(PRINTF_LIB_MIN)
  178. #PRINTF_LIB = $(PRINTF_LIB_FLOAT)
  179. # Minimalistic scanf version
  180. SCANF_LIB_MIN = -Wl,-u,vfscanf -lscanf_min
  181. # Floating point + %[ scanf version (requires MATH_LIB = -lm below)
  182. SCANF_LIB_FLOAT = -Wl,-u,vfscanf -lscanf_flt
  183. # If this is left blank, then it will use the Standard scanf version.
  184. SCANF_LIB =
  185. #SCANF_LIB = $(SCANF_LIB_MIN)
  186. #SCANF_LIB = $(SCANF_LIB_FLOAT)
  187. MATH_LIB = -lm
  188. # List any extra directories to look for libraries here.
  189. # Each directory must be seperated by a space.
  190. # Use forward slashes for directory separators.
  191. # For a directory that has spaces, enclose it in quotes.
  192. EXTRALIBDIRS =
  193. #---------------- External Memory Options ----------------
  194. # 64 KB of external RAM, starting after internal RAM (ATmega128!),
  195. # used for variables (.data/.bss) and heap (malloc()).
  196. #EXTMEMOPTS = -Wl,-Tdata=0x801100,--defsym=__heap_end=0x80ffff
  197. # 64 KB of external RAM, starting after internal RAM (ATmega128!),
  198. # only used for heap (malloc()).
  199. #EXTMEMOPTS = -Wl,--section-start,.data=0x801100,--defsym=__heap_end=0x80ffff
  200. EXTMEMOPTS =
  201. #---------------- Linker Options ----------------
  202. # -Wl,...: tell GCC to pass this to linker.
  203. # -Map: create map file
  204. # --cref: add cross reference to map file
  205. #
  206. # Comennt out "--relax" option to avoid a error such:
  207. # (.vectors+0x30): relocation truncated to fit: R_AVR_13_PCREL against symbol `__vector_12'
  208. #
  209. LDFLAGS = -Wl,-Map=$(TARGET).map,--cref
  210. LDFLAGS += -Wl,--relax
  211. LDFLAGS += -Wl,--gc-sections
  212. LDFLAGS += $(EXTMEMOPTS)
  213. LDFLAGS += $(patsubst %,-L%,$(EXTRALIBDIRS))
  214. LDFLAGS += $(PRINTF_LIB) $(SCANF_LIB) $(MATH_LIB)
  215. #LDFLAGS += -T linker_script.x
  216. #---------------- Programming Options (avrdude) ----------------
  217. # Programming hardware
  218. # Type: avrdude -c ?
  219. # to get a full listing.
  220. #
  221. AVRDUDE_PROGRAMMER = stk500v2
  222. # com1 = serial port. Use lpt1 to connect to parallel port.
  223. AVRDUDE_PORT = com1 # programmer connected to serial device
  224. AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex
  225. #AVRDUDE_WRITE_EEPROM = -U eeprom:w:$(TARGET).eep
  226. # Uncomment the following if you want avrdude's erase cycle counter.
  227. # Note that this counter needs to be initialized first using -Yn,
  228. # see avrdude manual.
  229. #AVRDUDE_ERASE_COUNTER = -y
  230. # Uncomment the following if you do /not/ wish a verification to be
  231. # performed after programming the device.
  232. #AVRDUDE_NO_VERIFY = -V
  233. # Increase verbosity level. Please use this when submitting bug
  234. # reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
  235. # to submit bug reports.
  236. #AVRDUDE_VERBOSE = -v -v
  237. AVRDUDE_FLAGS = -p $(MCU) -P $(AVRDUDE_PORT) -c $(AVRDUDE_PROGRAMMER)
  238. AVRDUDE_FLAGS += $(AVRDUDE_NO_VERIFY)
  239. AVRDUDE_FLAGS += $(AVRDUDE_VERBOSE)
  240. AVRDUDE_FLAGS += $(AVRDUDE_ERASE_COUNTER)
  241. #---------------- Debugging Options ----------------
  242. # For simulavr only - target MCU frequency.
  243. DEBUG_MFREQ = $(F_CPU)
  244. # Set the DEBUG_UI to either gdb or insight.
  245. # DEBUG_UI = gdb
  246. DEBUG_UI = insight
  247. # Set the debugging back-end to either avarice, simulavr.
  248. DEBUG_BACKEND = avarice
  249. #DEBUG_BACKEND = simulavr
  250. # GDB Init Filename.
  251. GDBINIT_FILE = __avr_gdbinit
  252. # When using avarice settings for the JTAG
  253. JTAG_DEV = /dev/com1
  254. # Debugging port used to communicate between GDB / avarice / simulavr.
  255. DEBUG_PORT = 4242
  256. # Debugging host used to communicate between GDB / avarice / simulavr, normally
  257. # just set to localhost unless doing some sort of crazy debugging when
  258. # avarice is running on a different computer.
  259. DEBUG_HOST = localhost
  260. #============================================================================
  261. # Define programs and commands.
  262. SHELL = sh
  263. CC = avr-gcc
  264. OBJCOPY = avr-objcopy
  265. OBJDUMP = avr-objdump
  266. SIZE = avr-size
  267. AR = avr-ar rcs
  268. NM = avr-nm
  269. AVRDUDE = avrdude
  270. REMOVE = rm -f
  271. REMOVEDIR = rmdir
  272. COPY = cp
  273. WINSHELL = cmd
  274. # Define Messages
  275. # English
  276. MSG_ERRORS_NONE = Errors: none
  277. MSG_BEGIN = -------- begin --------
  278. MSG_END = -------- end --------
  279. MSG_SIZE_BEFORE = Size before:
  280. MSG_SIZE_AFTER = Size after:
  281. MSG_COFF = Converting to AVR COFF:
  282. MSG_EXTENDED_COFF = Converting to AVR Extended COFF:
  283. MSG_FLASH = Creating load file for Flash:
  284. MSG_EEPROM = Creating load file for EEPROM:
  285. MSG_EXTENDED_LISTING = Creating Extended Listing:
  286. MSG_SYMBOL_TABLE = Creating Symbol Table:
  287. MSG_LINKING = Linking:
  288. MSG_COMPILING = Compiling C:
  289. MSG_COMPILING_CPP = Compiling C++:
  290. MSG_ASSEMBLING = Assembling:
  291. MSG_CLEANING = Cleaning project:
  292. MSG_CREATING_LIBRARY = Creating library:
  293. # Define all object files.
  294. OBJ = $(patsubst %.c,$(OBJDIR)/%.o,$(patsubst %.cpp,$(OBJDIR)/%.o,$(patsubst %.S,$(OBJDIR)/%.o,$(SRC))))
  295. # Define all listing files.
  296. LST = $(patsubst %.c,$(OBJDIR)/%.lst,$(patsubst %.cpp,$(OBJDIR)/%.lst,$(patsubst %.S,$(OBJDIR)/%.lst,$(SRC))))
  297. # Compiler flags to generate dependency files.
  298. GENDEPFLAGS = -MMD -MP -MF .dep/$(@F).d
  299. # Combine all necessary flags and optional flags.
  300. # Add target processor to flags.
  301. ALL_CFLAGS = -mmcu=$(MCU) -I. $(CFLAGS) $(GENDEPFLAGS)
  302. ALL_CPPFLAGS = -mmcu=$(MCU) -I. -x c++ $(CPPFLAGS) $(GENDEPFLAGS)
  303. ALL_ASFLAGS = -mmcu=$(MCU) -I. -x assembler-with-cpp $(ASFLAGS)
  304. # Default target.
  305. all: begin gccversion sizebefore build sizeafter end
  306. # Change the build target to build a HEX file or a library.
  307. build: elf hex eep lss sym
  308. #build: lib
  309. elf: $(TARGET).elf
  310. hex: $(TARGET).hex
  311. eep: $(TARGET).eep
  312. lss: $(TARGET).lss
  313. sym: $(TARGET).sym
  314. LIBNAME=lib$(TARGET).a
  315. lib: $(LIBNAME)
  316. # Eye candy.
  317. # AVR Studio 3.x does not check make's exit code but relies on
  318. # the following magic strings to be generated by the compile job.
  319. begin:
  320. @echo
  321. @echo $(MSG_BEGIN)
  322. end:
  323. @echo $(MSG_END)
  324. @echo
  325. # Display size of file.
  326. HEXSIZE = $(SIZE) --target=$(FORMAT) $(TARGET).hex
  327. #ELFSIZE = $(SIZE) --mcu=$(MCU) --format=avr $(TARGET).elf
  328. ELFSIZE = $(SIZE) $(TARGET).elf
  329. sizebefore:
  330. @if test -f $(TARGET).elf; then echo; echo $(MSG_SIZE_BEFORE); $(ELFSIZE); \
  331. 2>/dev/null; echo; fi
  332. sizeafter:
  333. @if test -f $(TARGET).elf; then echo; echo $(MSG_SIZE_AFTER); $(ELFSIZE); \
  334. 2>/dev/null; echo; fi
  335. # Display compiler version information.
  336. gccversion :
  337. @$(CC) --version
  338. # Program the device.
  339. program: $(TARGET).hex $(TARGET).eep
  340. $(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM)
  341. # Generate avr-gdb config/init file which does the following:
  342. # define the reset signal, load the target file, connect to target, and set
  343. # a breakpoint at main().
  344. gdb-config:
  345. @$(REMOVE) $(GDBINIT_FILE)
  346. @echo define reset >> $(GDBINIT_FILE)
  347. @echo SIGNAL SIGHUP >> $(GDBINIT_FILE)
  348. @echo end >> $(GDBINIT_FILE)
  349. @echo file $(TARGET).elf >> $(GDBINIT_FILE)
  350. @echo target remote $(DEBUG_HOST):$(DEBUG_PORT) >> $(GDBINIT_FILE)
  351. ifeq ($(DEBUG_BACKEND),simulavr)
  352. @echo load >> $(GDBINIT_FILE)
  353. endif
  354. @echo break main >> $(GDBINIT_FILE)
  355. debug: gdb-config $(TARGET).elf
  356. ifeq ($(DEBUG_BACKEND), avarice)
  357. @echo Starting AVaRICE - Press enter when "waiting to connect" message displays.
  358. @$(WINSHELL) /c start avarice --jtag $(JTAG_DEV) --erase --program --file \
  359. $(TARGET).elf $(DEBUG_HOST):$(DEBUG_PORT)
  360. @$(WINSHELL) /c pause
  361. else
  362. @$(WINSHELL) /c start simulavr --gdbserver --device $(MCU) --clock-freq \
  363. $(DEBUG_MFREQ) --port $(DEBUG_PORT)
  364. endif
  365. @$(WINSHELL) /c start avr-$(DEBUG_UI) --command=$(GDBINIT_FILE)
  366. # Convert ELF to COFF for use in debugging / simulating in AVR Studio or VMLAB.
  367. COFFCONVERT = $(OBJCOPY) --debugging
  368. COFFCONVERT += --change-section-address .data-0x800000
  369. COFFCONVERT += --change-section-address .bss-0x800000
  370. COFFCONVERT += --change-section-address .noinit-0x800000
  371. COFFCONVERT += --change-section-address .eeprom-0x810000
  372. coff: $(TARGET).elf
  373. @echo
  374. @echo $(MSG_COFF) $(TARGET).cof
  375. $(COFFCONVERT) -O coff-avr $< $(TARGET).cof
  376. extcoff: $(TARGET).elf
  377. @echo
  378. @echo $(MSG_EXTENDED_COFF) $(TARGET).cof
  379. $(COFFCONVERT) -O coff-ext-avr $< $(TARGET).cof
  380. # Create final output files (.hex, .eep) from ELF output file.
  381. %.hex: %.elf
  382. @echo
  383. @echo $(MSG_FLASH) $@
  384. $(OBJCOPY) -O $(FORMAT) -R .eeprom -R .fuse -R .lock -R .signature $< $@
  385. %.eep: %.elf
  386. @echo
  387. @echo $(MSG_EEPROM) $@
  388. -$(OBJCOPY) -j .eeprom --set-section-flags=.eeprom="alloc,load" \
  389. --change-section-lma .eeprom=0 --no-change-warnings -O $(FORMAT) $< $@ || exit 0
  390. # Create extended listing file from ELF output file.
  391. %.lss: %.elf
  392. @echo
  393. @echo $(MSG_EXTENDED_LISTING) $@
  394. $(OBJDUMP) -h -S -z $< > $@
  395. # Create a symbol table from ELF output file.
  396. %.sym: %.elf
  397. @echo
  398. @echo $(MSG_SYMBOL_TABLE) $@
  399. $(NM) -n $< > $@
  400. # Create library from object files.
  401. .SECONDARY : $(TARGET).a
  402. .PRECIOUS : $(OBJ)
  403. %.a: $(OBJ)
  404. @echo
  405. @echo $(MSG_CREATING_LIBRARY) $@
  406. $(AR) $@ $(OBJ)
  407. # Link: create ELF output file from object files.
  408. .SECONDARY : $(TARGET).elf
  409. .PRECIOUS : $(OBJ)
  410. %.elf: $(OBJ)
  411. @echo
  412. @echo $(MSG_LINKING) $@
  413. $(CC) $(ALL_CFLAGS) $^ --output $@ $(LDFLAGS)
  414. # Compile: create object files from C source files.
  415. $(OBJDIR)/%.o : %.c
  416. @echo
  417. @echo $(MSG_COMPILING) $<
  418. $(CC) -c $(ALL_CFLAGS) $< -o $@
  419. # Compile: create object files from C++ source files.
  420. $(OBJDIR)/%.o : %.cpp
  421. @echo
  422. @echo $(MSG_COMPILING_CPP) $<
  423. $(CC) -c $(ALL_CPPFLAGS) $< -o $@
  424. # Compile: create assembler files from C source files.
  425. %.s : %.c
  426. $(CC) -S $(ALL_CFLAGS) $< -o $@
  427. # Compile: create assembler files from C++ source files.
  428. %.s : %.cpp
  429. $(CC) -S $(ALL_CPPFLAGS) $< -o $@
  430. # Assemble: create object files from assembler source files.
  431. $(OBJDIR)/%.o : %.S
  432. @echo
  433. @echo $(MSG_ASSEMBLING) $<
  434. $(CC) -c $(ALL_ASFLAGS) $< -o $@
  435. # Create preprocessed source for use in sending a bug report.
  436. %.i : %.c
  437. $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@
  438. # Target: clean project.
  439. clean: begin clean_list end
  440. clean_list :
  441. @echo
  442. $(REMOVE) $(TARGET).hex
  443. $(REMOVE) $(TARGET).eep
  444. $(REMOVE) $(TARGET).cof
  445. $(REMOVE) $(TARGET).elf
  446. $(REMOVE) $(TARGET).map
  447. $(REMOVE) $(TARGET).sym
  448. $(REMOVE) $(TARGET).lss
  449. $(REMOVE) $(OBJ)
  450. $(REMOVE) $(LST)
  451. $(REMOVE) $(OBJ:.o=.s)
  452. $(REMOVE) $(OBJ:.o=.i)
  453. $(REMOVE) -r .dep
  454. $(REMOVEDIR) $(OBJDIR)
  455. # Create object files directory
  456. $(shell mkdir $(OBJDIR) 2>/dev/null)
  457. # Include the dependency files.
  458. -include $(shell mkdir .dep 2>/dev/null) $(wildcard .dep/*)
  459. # Listing of phony targets.
  460. .PHONY : all begin finish end sizebefore sizeafter gccversion \
  461. build elf hex eep lss sym coff extcoff \
  462. clean clean_list program debug gdb-config