Statistics
| Revision:

root / trunk / code / projects / colonet / robot / joystick / simple_slave / Makefile @ 866

History | View | Annotate | Download (13.7 KB)

1 687 gtress
########Update This Section########
2 687 gtress
#
3 687 gtress
#
4 687 gtress
5 687 gtress
# Relative path to the root directory (containing lib directory)
6 687 gtress
ifndef COLONYROOT
7 866 gtress
COLONYROOT = ../../../../../..
8 687 gtress
endif
9 687 gtress
10 687 gtress
# Target file name (without extension).
11 687 gtress
TARGET = slave
12 687 gtress
13 687 gtress
# Uncomment this to use the wireless library
14 687 gtress
 USE_WIRELESS = 1
15 687 gtress
16 687 gtress
# com1 = serial port. Use lpt1 to connect to parallel port.
17 687 gtress
AVRDUDE_PORT = /dev/ttyUSB0
18 687 gtress
#
19 687 gtress
#
20 687 gtress
###################################
21 687 gtress
22 687 gtress
# Hey Emacs, this is a -*- makefile -*-
23 687 gtress
#----------------------------------------------------------------------------
24 687 gtress
# WinAVR Makefile Template written by Eric B. Weddington, Jörg Wunsch, et al.
25 687 gtress
#
26 687 gtress
# Released to the Public Domain
27 687 gtress
#
28 687 gtress
# Additional material for this makefile was written by:
29 687 gtress
# Peter Fleury
30 687 gtress
# Tim Henigan
31 687 gtress
# Colin O'Flynn
32 687 gtress
# Reiner Patommel
33 687 gtress
# Markus Pfaff
34 687 gtress
# Sander Pool
35 687 gtress
# Frederik Rouleau
36 687 gtress
#
37 687 gtress
#----------------------------------------------------------------------------
38 687 gtress
# On command line:
39 687 gtress
#
40 687 gtress
# make all = Make software.
41 687 gtress
#
42 687 gtress
# make clean = Clean out built project files.
43 687 gtress
#
44 687 gtress
# make coff = Convert ELF to AVR COFF.
45 687 gtress
#
46 687 gtress
# make extcoff = Convert ELF to AVR Extended COFF.
47 687 gtress
#
48 687 gtress
# make program = Download the hex file to the device, using avrdude.
49 687 gtress
#                Please customize the avrdude settings below first!
50 687 gtress
#
51 687 gtress
# make debug = Start either simulavr or avarice as specified for debugging,
52 687 gtress
#              with avr-gdb or avr-insight as the front end for debugging.
53 687 gtress
#
54 687 gtress
# make filename.s = Just compile filename.c into the assembler code only.
55 687 gtress
#
56 687 gtress
# make filename.i = Create a preprocessed source file for use in submitting
57 687 gtress
#                   bug reports to the GCC project.
58 687 gtress
#
59 687 gtress
# To rebuild project do "make clean" then "make all".
60 687 gtress
#----------------------------------------------------------------------------
61 687 gtress
62 687 gtress
#if you want your code to work on the Firefly++ and not Firefly+
63 687 gtress
#then add the -DFFPP line to CDEFS
64 687 gtress
CDEFS =
65 687 gtress
#-DFFPP
66 687 gtress
67 687 gtress
# MCU name
68 687 gtress
MCU = atmega128
69 687 gtress
70 687 gtress
# Processor frequency.
71 687 gtress
#     This will define a symbol, F_CPU, in all source code files equal to the
72 687 gtress
#     processor frequency. You can then use this symbol in your source code to
73 687 gtress
#     calculate timings. Do NOT tack on a 'UL' at the end, this will be done
74 687 gtress
#     automatically to create a 32-bit value in your source code.
75 687 gtress
F_CPU = 8000000
76 687 gtress
77 687 gtress
# Output format. (can be srec, ihex, binary)
78 687 gtress
FORMAT = ihex
79 687 gtress
80 687 gtress
# List C source files here. (C dependencies are automatically generated.)
81 687 gtress
SRC = $(wildcard *.c)
82 687 gtress
83 687 gtress
# List Assembler source files here.
84 687 gtress
#     Make them always end in a capital .S.  Files ending in a lowercase .s
85 687 gtress
#     will not be considered source files but generated files (assembler
86 687 gtress
#     output from the compiler), and will be deleted upon "make clean"!
87 687 gtress
#     Even though the DOS/Win* filesystem matches both .s and .S the same,
88 687 gtress
#     it will preserve the spelling of the filenames, and gcc itself does
89 687 gtress
#     care about how the name is spelled on its command-line.
90 687 gtress
ASRC =
91 687 gtress
92 687 gtress
# Optimization level, can be [0, 1, 2, 3, s].
93 687 gtress
#     0 = turn off optimization. s = optimize for size.
94 687 gtress
#     (Note: 3 is not always the best optimization level. See avr-libc FAQ.)
95 687 gtress
OPT = s
96 687 gtress
97 687 gtress
# Debugging format.
98 687 gtress
#     Native formats for AVR-GCC's -g are dwarf-2 [default] or stabs.
99 687 gtress
#     AVR Studio 4.10 requires dwarf-2.
100 687 gtress
#     AVR [Extended] COFF format requires stabs, plus an avr-objcopy run.
101 687 gtress
DEBUG =
102 687 gtress
103 687 gtress
# Compiler flag to set the C Standard level.
104 687 gtress
#     c89   = "ANSI" C
105 687 gtress
#     gnu89 = c89 plus GCC extensions
106 687 gtress
#     c99   = ISO C99 standard (not yet fully implemented)
107 687 gtress
#     gnu99 = c99 plus GCC extensions
108 687 gtress
CSTANDARD = -std=gnu99
109 687 gtress
110 687 gtress
# Place -D or -U options here
111 687 gtress
CDEFS += -DF_CPU=$(F_CPU)UL
112 687 gtress
CDEFS += -DFFP
113 687 gtress
# for wireless library
114 687 gtress
ifdef USE_WIRELESS
115 687 gtress
	CDEFS += -DROBOT
116 687 gtress
endif
117 687 gtress
118 687 gtress
# Place -I, -L options here
119 687 gtress
CINCS = -I$(COLONYROOT)/code/lib/include/libdragonfly
120 687 gtress
CINCS += -L$(COLONYROOT)/code/lib/bin
121 687 gtress
ifdef USE_WIRELESS
122 687 gtress
	CINCS += -I$(COLONYROOT)/code/lib/include/libwireless
123 687 gtress
endif
124 687 gtress
125 687 gtress
#---------------- Compiler Options ----------------
126 687 gtress
#  -g*:          generate debugging information
127 687 gtress
#  -O*:          optimization level
128 687 gtress
#  -f...:        tuning, see GCC manual and avr-libc documentation
129 687 gtress
#  -Wall...:     warning level
130 687 gtress
#  -Wa,...:      tell GCC to pass this to the assembler.
131 687 gtress
#    -adhlns...: create assembler listing
132 687 gtress
CFLAGS =
133 687 gtress
# CFLAGS = -g$(DEBUG)
134 687 gtress
CFLAGS += $(CDEFS) $(CINCS)
135 687 gtress
CFLAGS += -O$(OPT)
136 687 gtress
CFLAGS += -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums
137 687 gtress
CFLAGS += -Wall -Wstrict-prototypes
138 687 gtress
CFLAGS += -Wa,-adhlns=$(<:.c=.lst)
139 687 gtress
CFLAGS += $(CSTANDARD)
140 687 gtress
141 687 gtress
#---------------- Assembler Options ----------------
142 687 gtress
#  -Wa,...:   tell GCC to pass this to the assembler.
143 687 gtress
#  -ahlms:    create listing
144 687 gtress
#  -gstabs:   have the assembler create line number information; note that
145 687 gtress
#             for use in COFF files, additional information about filenames
146 687 gtress
#             and function names needs to be present in the assembler source
147 687 gtress
#             files -- see avr-libc docs [FIXME: not yet described there]
148 687 gtress
ASFLAGS = -Wa,-adhlns=$(<:.S=.lst),-gstabs
149 687 gtress
150 687 gtress
151 687 gtress
#---------------- Library Options ----------------
152 687 gtress
# Minimalistic printf version
153 687 gtress
PRINTF_LIB_MIN = -Wl,-u,vfprintf -lprintf_min
154 687 gtress
155 687 gtress
# Floating point printf version (requires MATH_LIB = -lm below)
156 687 gtress
PRINTF_LIB_FLOAT = -Wl,-u,vfprintf -lprintf_flt
157 687 gtress
158 687 gtress
# If this is left blank, then it will use the Standard printf version.
159 687 gtress
PRINTF_LIB =
160 687 gtress
#PRINTF_LIB = $(PRINTF_LIB_MIN)
161 687 gtress
#PRINTF_LIB = $(PRINTF_LIB_FLOAT)
162 687 gtress
163 687 gtress
164 687 gtress
# Minimalistic scanf version
165 687 gtress
SCANF_LIB_MIN = -Wl,-u,vfscanf -lscanf_min
166 687 gtress
167 687 gtress
# Floating point + %[ scanf version (requires MATH_LIB = -lm below)
168 687 gtress
SCANF_LIB_FLOAT = -Wl,-u,vfscanf -lscanf_flt
169 687 gtress
170 687 gtress
# If this is left blank, then it will use the Standard scanf version.
171 687 gtress
SCANF_LIB =
172 687 gtress
#SCANF_LIB = $(SCANF_LIB_MIN)
173 687 gtress
#SCANF_LIB = $(SCANF_LIB_FLOAT)
174 687 gtress
175 687 gtress
MATH_LIB = -lm
176 687 gtress
177 687 gtress
#---------------- External Memory Options ----------------
178 687 gtress
179 687 gtress
# 64 KB of external RAM, starting after internal RAM (ATmega128!),
180 687 gtress
# used for variables (.data/.bss) and heap (malloc()).
181 687 gtress
#EXTMEMOPTS = -Wl,-Tdata=0x801100,--defsym=__heap_end=0x80ffff
182 687 gtress
183 687 gtress
# 64 KB of external RAM, starting after internal RAM (ATmega128!),
184 687 gtress
# only used for heap (malloc()).
185 687 gtress
#EXTMEMOPTS = -Wl,--defsym=__heap_start=0x801100,--defsym=__heap_end=0x80ffff
186 687 gtress
187 687 gtress
EXTMEMOPTS =
188 687 gtress
189 687 gtress
#---------------- Linker Options ----------------
190 687 gtress
#  -Wl,...:     tell GCC to pass this to linker.
191 687 gtress
#    -Map:      create map file
192 687 gtress
#    --cref:    add cross reference to  map file
193 687 gtress
LDFLAGS = -Wl,-Map=$(TARGET).map,--cref
194 687 gtress
LDFLAGS += $(EXTMEMOPTS)
195 687 gtress
LDFLAGS += $(PRINTF_LIB) $(SCANF_LIB) $(MATH_LIB)
196 687 gtress
ifdef USE_WIRELESS
197 687 gtress
	LDFLAGS += -lwireless
198 687 gtress
endif
199 687 gtress
LDFLAGS += -ldragonfly
200 687 gtress
201 687 gtress
202 687 gtress
203 687 gtress
#---------------- Programming Options (avrdude) ----------------
204 687 gtress
205 687 gtress
# Programming hardware: alf avr910 avrisp bascom bsd
206 687 gtress
# dt006 pavr picoweb pony-stk200 sp12 stk200 stk500
207 687 gtress
#
208 687 gtress
# Type: avrdude -c ?
209 687 gtress
# to get a full listing.
210 687 gtress
#
211 687 gtress
AVRDUDE_PROGRAMMER = avrisp
212 687 gtress
213 687 gtress
# programmer connected to serial device
214 687 gtress
215 687 gtress
AVRDUDE_WRITE_FLASH = -b 57600 -U flash:w:$(TARGET).hex
216 687 gtress
#AVRDUDE_WRITE_EEPROM = -U eeprom:w:$(TARGET).eep
217 687 gtress
218 687 gtress
219 687 gtress
# Uncomment the following if you want avrdude's erase cycle counter.
220 687 gtress
# Note that this counter needs to be initialized first using -Yn,
221 687 gtress
# see avrdude manual.
222 687 gtress
#AVRDUDE_ERASE_COUNTER = -y
223 687 gtress
224 687 gtress
# Uncomment the following if you do /not/ wish a verification to be
225 687 gtress
# performed after programming the device.
226 687 gtress
#AVRDUDE_NO_VERIFY = -V
227 687 gtress
228 687 gtress
# Increase verbosity level.  Please use this when submitting bug
229 687 gtress
# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
230 687 gtress
# to submit bug reports.
231 687 gtress
#AVRDUDE_VERBOSE = -v -v
232 687 gtress
233 687 gtress
AVRDUDE_FLAGS = -p $(MCU) -P $(AVRDUDE_PORT) -c $(AVRDUDE_PROGRAMMER)
234 687 gtress
AVRDUDE_FLAGS += $(AVRDUDE_NO_VERIFY)
235 687 gtress
AVRDUDE_FLAGS += $(AVRDUDE_VERBOSE)
236 687 gtress
AVRDUDE_FLAGS += $(AVRDUDE_ERASE_COUNTER)
237 687 gtress
238 687 gtress
#don't check for device signature
239 687 gtress
AVRDUDE_FLAGS += -F
240 687 gtress
241 687 gtress
242 687 gtress
243 687 gtress
#---------------- Debugging Options ----------------
244 687 gtress
245 687 gtress
# For simulavr only - target MCU frequency.
246 687 gtress
DEBUG_MFREQ = $(F_CPU)
247 687 gtress
248 687 gtress
# Set the DEBUG_UI to either gdb or insight.
249 687 gtress
# DEBUG_UI = gdb
250 687 gtress
DEBUG_UI = insight
251 687 gtress
252 687 gtress
# Set the debugging back-end to either avarice, simulavr.
253 687 gtress
DEBUG_BACKEND = avarice
254 687 gtress
#DEBUG_BACKEND = simulavr
255 687 gtress
256 687 gtress
# GDB Init Filename.
257 687 gtress
GDBINIT_FILE = __avr_gdbinit
258 687 gtress
259 687 gtress
# When using avarice settings for the JTAG
260 687 gtress
JTAG_DEV = /dev/com1
261 687 gtress
262 687 gtress
# Debugging port used to communicate between GDB / avarice / simulavr.
263 687 gtress
DEBUG_PORT = 4242
264 687 gtress
265 687 gtress
# Debugging host used to communicate between GDB / avarice / simulavr, normally
266 687 gtress
#     just set to localhost unless doing some sort of crazy debugging when
267 687 gtress
#     avarice is running on a different computer.
268 687 gtress
DEBUG_HOST = localhost
269 687 gtress
270 687 gtress
271 687 gtress
272 687 gtress
#============================================================================
273 687 gtress
274 687 gtress
275 687 gtress
# Define programs and commands.
276 687 gtress
SHELL = sh
277 687 gtress
CC = avr-gcc
278 687 gtress
OBJCOPY = avr-objcopy
279 687 gtress
OBJDUMP = avr-objdump
280 687 gtress
SIZE = avr-size
281 687 gtress
NM = avr-nm
282 687 gtress
AVRDUDE = avrdude
283 687 gtress
REMOVE = rm -f
284 687 gtress
REMOVEDIR = rm -rf
285 687 gtress
COPY = cp
286 687 gtress
WINSHELL = cmd
287 687 gtress
288 687 gtress
289 687 gtress
# Define Messages
290 687 gtress
# English
291 687 gtress
MSG_ERRORS_NONE = Errors: none
292 687 gtress
MSG_BEGIN = -------- begin --------
293 687 gtress
MSG_END = --------  end  --------
294 687 gtress
MSG_SIZE_BEFORE = Size before:
295 687 gtress
MSG_SIZE_AFTER = Size after:
296 687 gtress
MSG_COFF = Converting to AVR COFF:
297 687 gtress
MSG_EXTENDED_COFF = Converting to AVR Extended COFF:
298 687 gtress
MSG_FLASH = Creating load file for Flash:
299 687 gtress
MSG_EEPROM = Creating load file for EEPROM:
300 687 gtress
MSG_EXTENDED_LISTING = Creating Extended Listing:
301 687 gtress
MSG_SYMBOL_TABLE = Creating Symbol Table:
302 687 gtress
MSG_LINKING = Linking:
303 687 gtress
MSG_COMPILING = Compiling:
304 687 gtress
MSG_ASSEMBLING = Assembling:
305 687 gtress
MSG_CLEANING = Cleaning project:
306 687 gtress
307 687 gtress
308 687 gtress
309 687 gtress
310 687 gtress
# Define all object files.
311 687 gtress
OBJ = $(SRC:.c=.o) $(ASRC:.S=.o)
312 687 gtress
313 687 gtress
# Define all listing files.
314 687 gtress
LST = $(SRC:.c=.lst) $(ASRC:.S=.lst)
315 687 gtress
316 687 gtress
317 687 gtress
# Compiler flags to generate dependency files.
318 687 gtress
GENDEPFLAGS = -MD -MP -MF .dep/$(@F).d
319 687 gtress
320 687 gtress
321 687 gtress
# Combine all necessary flags and optional flags.
322 687 gtress
# Add target processor to flags.
323 687 gtress
ALL_CFLAGS = -mmcu=$(MCU) -I. $(CFLAGS) $(GENDEPFLAGS)
324 687 gtress
ALL_ASFLAGS = -mmcu=$(MCU) -I. -x assembler-with-cpp $(ASFLAGS)
325 687 gtress
326 687 gtress
327 687 gtress
328 687 gtress
329 687 gtress
330 687 gtress
# Default target.
331 687 gtress
all: begin gccversion sizebefore build sizeafter end
332 687 gtress
333 687 gtress
build: elf hex eep lss sym
334 687 gtress
335 687 gtress
elf: $(TARGET).elf
336 687 gtress
hex: $(TARGET).hex
337 687 gtress
eep: $(TARGET).eep
338 687 gtress
lss: $(TARGET).lss
339 687 gtress
sym: $(TARGET).sym
340 687 gtress
341 687 gtress
342 687 gtress
343 687 gtress
# Eye candy.
344 687 gtress
# AVR Studio 3.x does not check make's exit code but relies on
345 687 gtress
# the following magic strings to be generated by the compile job.
346 687 gtress
begin:
347 687 gtress
	@echo
348 687 gtress
	@echo $(MSG_BEGIN)
349 687 gtress
350 687 gtress
end:
351 687 gtress
	@echo $(MSG_END)
352 687 gtress
	@echo
353 687 gtress
354 687 gtress
355 687 gtress
# Display size of file.
356 687 gtress
HEXSIZE = $(SIZE) --target=$(FORMAT) $(TARGET).hex
357 687 gtress
ELFSIZE = $(SIZE) -A $(TARGET).elf
358 687 gtress
AVRMEM = avr-mem.sh $(TARGET).elf $(MCU)
359 687 gtress
360 687 gtress
sizebefore:
361 687 gtress
	@if test -f $(TARGET).elf; then echo; echo $(MSG_SIZE_BEFORE); $(ELFSIZE); \
362 687 gtress
	$(AVRMEM) 2>/dev/null; echo; fi
363 687 gtress
364 687 gtress
sizeafter:
365 687 gtress
	@if test -f $(TARGET).elf; then echo; echo $(MSG_SIZE_AFTER); $(ELFSIZE); \
366 687 gtress
	$(AVRMEM) 2>/dev/null; echo; fi
367 687 gtress
368 687 gtress
369 687 gtress
370 687 gtress
# Display compiler version information.
371 687 gtress
gccversion :
372 687 gtress
	@$(CC) --version
373 687 gtress
374 687 gtress
375 687 gtress
376 687 gtress
# Program the device.
377 687 gtress
program: $(TARGET).hex $(TARGET).eep
378 687 gtress
	$(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM)
379 687 gtress
380 687 gtress
381 687 gtress
# Generate avr-gdb config/init file which does the following:
382 687 gtress
#     define the reset signal, load the target file, connect to target, and set
383 687 gtress
#     a breakpoint at main().
384 687 gtress
gdb-config:
385 687 gtress
	@$(REMOVE) $(GDBINIT_FILE)
386 687 gtress
	@echo define reset >> $(GDBINIT_FILE)
387 687 gtress
	@echo SIGNAL SIGHUP >> $(GDBINIT_FILE)
388 687 gtress
	@echo end >> $(GDBINIT_FILE)
389 687 gtress
	@echo file $(TARGET).elf >> $(GDBINIT_FILE)
390 687 gtress
	@echo target remote $(DEBUG_HOST):$(DEBUG_PORT)  >> $(GDBINIT_FILE)
391 687 gtress
ifeq ($(DEBUG_BACKEND),simulavr)
392 687 gtress
	@echo load  >> $(GDBINIT_FILE)
393 687 gtress
endif
394 687 gtress
	@echo break main >> $(GDBINIT_FILE)
395 687 gtress
396 687 gtress
debug: gdb-config $(TARGET).elf
397 687 gtress
ifeq ($(DEBUG_BACKEND), avarice)
398 687 gtress
	@echo Starting AVaRICE - Press enter when "waiting to connect" message displays.
399 687 gtress
	@$(WINSHELL) /c start avarice --jtag $(JTAG_DEV) --erase --program --file \
400 687 gtress
	$(TARGET).elf $(DEBUG_HOST):$(DEBUG_PORT)
401 687 gtress
	@$(WINSHELL) /c pause
402 687 gtress
403 687 gtress
else
404 687 gtress
	@$(WINSHELL) /c start simulavr --gdbserver --device $(MCU) --clock-freq \
405 687 gtress
	$(DEBUG_MFREQ) --port $(DEBUG_PORT)
406 687 gtress
endif
407 687 gtress
	@$(WINSHELL) /c start avr-$(DEBUG_UI) --command=$(GDBINIT_FILE)
408 687 gtress
409 687 gtress
410 687 gtress
411 687 gtress
412 687 gtress
# Convert ELF to COFF for use in debugging / simulating in AVR Studio or VMLAB.
413 687 gtress
COFFCONVERT=$(OBJCOPY) --debugging \
414 687 gtress
--change-section-address .data-0x800000 \
415 687 gtress
--change-section-address .bss-0x800000 \
416 687 gtress
--change-section-address .noinit-0x800000 \
417 687 gtress
--change-section-address .eeprom-0x810000
418 687 gtress
419 687 gtress
420 687 gtress
coff: $(TARGET).elf
421 687 gtress
	@echo
422 687 gtress
	@echo $(MSG_COFF) $(TARGET).cof
423 687 gtress
	$(COFFCONVERT) -O coff-avr $< $(TARGET).cof
424 687 gtress
425 687 gtress
426 687 gtress
extcoff: $(TARGET).elf
427 687 gtress
	@echo
428 687 gtress
	@echo $(MSG_EXTENDED_COFF) $(TARGET).cof
429 687 gtress
	$(COFFCONVERT) -O coff-ext-avr $< $(TARGET).cof
430 687 gtress
431 687 gtress
432 687 gtress
433 687 gtress
# Create final output files (.hex, .eep) from ELF output file.
434 687 gtress
%.hex: %.elf
435 687 gtress
	@echo
436 687 gtress
	@echo $(MSG_FLASH) $@
437 687 gtress
	$(OBJCOPY) -O $(FORMAT) -R .eeprom $< $@
438 687 gtress
439 687 gtress
%.eep: %.elf
440 687 gtress
	@echo
441 687 gtress
	@echo $(MSG_EEPROM) $@
442 687 gtress
	-$(OBJCOPY) -j .eeprom --set-section-flags=.eeprom="alloc,load" \
443 687 gtress
	--change-section-lma .eeprom=0 -O $(FORMAT) $< $@
444 687 gtress
445 687 gtress
# Create extended listing file from ELF output file.
446 687 gtress
%.lss: %.elf
447 687 gtress
	@echo
448 687 gtress
	@echo $(MSG_EXTENDED_LISTING) $@
449 687 gtress
	$(OBJDUMP) -h -S $< > $@
450 687 gtress
451 687 gtress
# Create a symbol table from ELF output file.
452 687 gtress
%.sym: %.elf
453 687 gtress
	@echo
454 687 gtress
	@echo $(MSG_SYMBOL_TABLE) $@
455 687 gtress
	$(NM) -n $< > $@
456 687 gtress
457 687 gtress
458 687 gtress
459 687 gtress
# Link: create ELF output file from object files.
460 687 gtress
.SECONDARY : $(TARGET).elf
461 687 gtress
.PRECIOUS : $(OBJ)
462 687 gtress
%.elf: $(OBJ)
463 687 gtress
	@echo
464 687 gtress
	@echo $(MSG_LINKING) $@
465 687 gtress
	$(CC) $(ALL_CFLAGS) $^ --output $@ $(LDFLAGS)
466 687 gtress
467 687 gtress
468 687 gtress
# Compile: create object files from C source files.
469 687 gtress
%.o : %.c
470 687 gtress
	@echo
471 687 gtress
	@echo $(MSG_COMPILING) $<
472 687 gtress
	$(CC) -c $(ALL_CFLAGS) $< -o $@
473 687 gtress
474 687 gtress
475 687 gtress
# Compile: create assembler files from C source files.
476 687 gtress
%.s : %.c
477 687 gtress
	$(CC) -S $(ALL_CFLAGS) $< -o $@
478 687 gtress
479 687 gtress
480 687 gtress
# Assemble: create object files from assembler source files.
481 687 gtress
%.o : %.S
482 687 gtress
	@echo
483 687 gtress
	@echo $(MSG_ASSEMBLING) $<
484 687 gtress
	$(CC) -c $(ALL_ASFLAGS) $< -o $@
485 687 gtress
486 687 gtress
# Create preprocessed source for use in sending a bug report.
487 687 gtress
%.i : %.c
488 687 gtress
	$(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@
489 687 gtress
490 687 gtress
491 687 gtress
# Target: clean project.
492 687 gtress
clean: begin clean_list end
493 687 gtress
494 687 gtress
clean_list :
495 687 gtress
	@echo
496 687 gtress
	@echo $(MSG_CLEANING)
497 687 gtress
	$(REMOVE) $(TARGET).hex
498 687 gtress
	$(REMOVE) $(TARGET).eep
499 687 gtress
	$(REMOVE) $(TARGET).cof
500 687 gtress
	$(REMOVE) $(TARGET).elf
501 687 gtress
	$(REMOVE) $(TARGET).map
502 687 gtress
	$(REMOVE) $(TARGET).sym
503 687 gtress
	$(REMOVE) $(TARGET).lss
504 687 gtress
	$(REMOVE) $(OBJ)
505 687 gtress
	$(REMOVE) $(LST)
506 687 gtress
	$(REMOVE) $(SRC:.c=.s)
507 687 gtress
	$(REMOVE) $(SRC:.c=.d)
508 687 gtress
	$(REMOVEDIR) .dep
509 687 gtress
510 687 gtress
511 687 gtress
512 687 gtress
# Include the dependency files.
513 687 gtress
-include $(shell mkdir .dep 2>/dev/null) $(wildcard .dep/*)
514 687 gtress
515 687 gtress
516 687 gtress
# Listing of phony targets.
517 687 gtress
.PHONY : all begin finish end sizebefore sizeafter gccversion \
518 687 gtress
build elf hex eep lss sym coff extcoff \
519 687 gtress
clean clean_list program debug gdb-config