Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
1 | ingob | 1 | #-------------------------------------------------------------------- |
2 | # MCU name |
||
1097 | killagreg | 3 | MCU = atmega644p |
1 | ingob | 4 | F_CPU = 20000000 |
5 | #------------------------------------------------------------------- |
||
1078 | killagreg | 6 | VERSION_MAJOR = 0 |
1222 | killagreg | 7 | VERSION_MINOR = 73 |
8 | VERSION_PATCH = 3 |
||
297 | holgerb | 9 | |
1078 | killagreg | 10 | VERSION_SERIAL_MAJOR = 10 # Serial Protocol Major Version |
1222 | killagreg | 11 | VERSION_SERIAL_MINOR = 1 # Serial Protocol Minor Version |
12 | NC_SPI_COMPATIBLE = 6 # SPI Protocol Version |
||
1078 | killagreg | 13 | |
1 | ingob | 14 | #------------------------------------------------------------------- |
886 | killagreg | 15 | #OPTIONS |
1180 | killagreg | 16 | |
908 | killagreg | 17 | # Use one of the extensions for a gps solution |
1200 | killagreg | 18 | #EXT = KILLAGREG |
19 | EXT = NAVICTRL |
||
1187 | killagreg | 20 | #EXT = MK3MAG |
1180 | killagreg | 21 | |
1199 | killagreg | 22 | # Use optional one the RCs if EXT = NAVICTRL has been used |
1200 | killagreg | 23 | RC = DSL |
1199 | killagreg | 24 | #RC = SPECTRUM |
25 | |||
886 | killagreg | 26 | #------------------------------------------------------------------- |
961 | killagreg | 27 | # get SVN revision |
28 | REV := $(shell sh -c "cat .svn/entries | sed -n '4p'") |
||
1 | ingob | 29 | |
30 | ifeq ($(MCU), atmega644) |
||
1180 | killagreg | 31 | FUSE_SETTINGS = -u -U lfuse:w:0xff:m -U hfuse:w:0xdf:m |
1222 | killagreg | 32 | HEX_NAME = MEGA644_$(EXT)_$(RC) |
595 | hbuss | 33 | endif |
1 | ingob | 34 | |
595 | hbuss | 35 | ifeq ($(MCU), atmega644p) |
36 | FUSE_SETTINGS = -u -U lfuse:w:0xff:m -U hfuse:w:0xdf:m |
||
1222 | killagreg | 37 | HEX_NAME = MEGA644p_$(EXT)_$(RC) |
1 | ingob | 38 | endif |
39 | |||
595 | hbuss | 40 | |
1 | ingob | 41 | ifeq ($(F_CPU), 16000000) |
42 | QUARZ = 16MHZ |
||
43 | endif |
||
44 | |||
45 | ifeq ($(F_CPU), 20000000) |
||
46 | QUARZ = 20MHZ |
||
47 | endif |
||
48 | |||
49 | |||
50 | # Output format. (can be srec, ihex, binary) |
||
51 | FORMAT = ihex |
||
52 | |||
53 | # Target file name (without extension). |
||
54 | |||
1078 | killagreg | 55 | ifeq ($(VERSION_PATCH), 0) |
56 | TARGET = Flight-Ctrl_$(HEX_NAME)_V$(VERSION_MAJOR)_$(VERSION_MINOR)a_SVN$(REV) |
||
297 | holgerb | 57 | endif |
1078 | killagreg | 58 | ifeq ($(VERSION_PATCH), 1) |
59 | TARGET = Flight-Ctrl_$(HEX_NAME)_V$(VERSION_MAJOR)_$(VERSION_MINOR)b_SVN$(REV) |
||
297 | holgerb | 60 | endif |
1078 | killagreg | 61 | ifeq ($(VERSION_PATCH), 2) |
62 | TARGET = Flight-Ctrl_$(HEX_NAME)_V$(VERSION_MAJOR)_$(VERSION_MINOR)c_SVN$(REV) |
||
297 | holgerb | 63 | endif |
1078 | killagreg | 64 | ifeq ($(VERSION_PATCH), 3) |
65 | TARGET = Flight-Ctrl_$(HEX_NAME)_V$(VERSION_MAJOR)_$(VERSION_MINOR)d_SVN$(REV) |
||
297 | holgerb | 66 | endif |
1078 | killagreg | 67 | ifeq ($(VERSION_PATCH), 4) |
68 | TARGET = Flight-Ctrl_$(HEX_NAME)_V$(VERSION_MAJOR)_$(VERSION_MINOR)e_SVN$(REV) |
||
297 | holgerb | 69 | endif |
1078 | killagreg | 70 | ifeq ($(VERSION_PATCH), 5) |
71 | TARGET = Flight-Ctrl_$(HEX_NAME)_V$(VERSION_MAJOR)_$(VERSION_MINOR)f_SVN$(REV) |
||
297 | holgerb | 72 | endif |
1078 | killagreg | 73 | ifeq ($(VERSION_PATCH), 6) |
74 | TARGET = Flight-Ctrl_$(HEX_NAME)_V$(VERSION_MAJOR)_$(VERSION_MINOR)g_SVN$(REV) |
||
469 | hbuss | 75 | endif |
1078 | killagreg | 76 | ifeq ($(VERSION_PATCH), 7) |
77 | TARGET = Flight-Ctrl_$(HEX_NAME)_V$(VERSION_MAJOR)_$(VERSION_MINOR)h_SVN$(REV) |
||
469 | hbuss | 78 | endif |
1078 | killagreg | 79 | ifeq ($(VERSION_PATCH), 8) |
80 | TARGET = Flight-Ctrl_$(HEX_NAME)_V$(VERSION_MAJOR)_$(VERSION_MINOR)i_SVN$(REV) |
||
855 | hbuss | 81 | endif |
1078 | killagreg | 82 | ifeq ($(VERSION_PATCH), 9) |
83 | TARGET = Flight-Ctrl_$(HEX_NAME)_V$(VERSION_MAJOR)_$(VERSION_MINOR)j_SVN$(REV) |
||
855 | hbuss | 84 | endif |
1078 | killagreg | 85 | ifeq ($(VERSION_PATCH), 10) |
86 | TARGET = Flight-Ctrl_$(HEX_NAME)_V$(VERSION_MAJOR)_$(VERSION_MINOR)k_SVN$(REV) |
||
882 | hbuss | 87 | endif |
1180 | killagreg | 88 | ifeq ($(VERSION_PATCH), 11) |
89 | TARGET = Flight-Ctrl_$(HEX_NAME)_V$(VERSION_MAJOR)_$(VERSION_MINOR)l_SVN$(REV) |
||
90 | endif |
||
91 | ifeq ($(VERSION_PATCH), 12) |
||
92 | TARGET = Flight-Ctrl_$(HEX_NAME)_V$(VERSION_MAJOR)_$(VERSION_MINOR)m_SVN$(REV) |
||
93 | endif |
||
94 | ifeq ($(VERSION_PATCH), 13) |
||
95 | TARGET = Flight-Ctrl_$(HEX_NAME)_V$(VERSION_MAJOR)_$(VERSION_MINOR)n_SVN$(REV) |
||
96 | endif |
||
97 | ifeq ($(VERSION_PATCH), 14) |
||
98 | TARGET = Flight-Ctrl_$(HEX_NAME)_V$(VERSION_MAJOR)_$(VERSION_MINOR)o_SVN$(REV) |
||
99 | endif |
||
100 | ifeq ($(VERSION_PATCH), 15) |
||
101 | TARGET = Flight-Ctrl_$(HEX_NAME)_V$(VERSION_MAJOR)_$(VERSION_MINOR)p_SVN$(REV) |
||
102 | endif |
||
103 | ifeq ($(VERSION_PATCH), 16) |
||
104 | TARGET = Flight-Ctrl_$(HEX_NAME)_V$(VERSION_MAJOR)_$(VERSION_MINOR)q_SVN$(REV) |
||
105 | endif |
||
106 | ifeq ($(VERSION_PATCH), 17) |
||
107 | TARGET = Flight-Ctrl_$(HEX_NAME)_V$(VERSION_MAJOR)_$(VERSION_MINOR)r_SVN$(REV) |
||
108 | endif |
||
1 | ingob | 109 | |
110 | # Optimization level, can be [0, 1, 2, 3, s]. 0 turns off optimization. |
||
111 | # (Note: 3 is not always the best optimization level. See avr-libc FAQ.) |
||
1180 | killagreg | 112 | OPT = 2 |
113 | #OPT = s |
||
1 | ingob | 114 | |
115 | ########################################################################################################## |
||
116 | # List C source files here. (C dependencies are automatically generated.) |
||
1180 | killagreg | 117 | SRC = main.c uart0.c printf_P.c timer0.c timer2.c analog.c menu.c led.c |
1199 | killagreg | 118 | SRC += twimaster.c rc.c fc.c eeprom.c uart1.c |
1180 | killagreg | 119 | |
886 | killagreg | 120 | ifeq ($(EXT), KILLAGREG) |
121 | SRC += mm3.c mymath.c gps.c ubx.c |
||
122 | endif |
||
908 | killagreg | 123 | ifeq ($(EXT), MK3MAG) |
124 | SRC += mk3mag.c mymath.c gps.c ubx.c |
||
125 | endif |
||
886 | killagreg | 126 | ifeq ($(EXT), NAVICTRL) |
127 | SRC += spi.c |
||
1199 | killagreg | 128 | ifeq ($(RC), DSL) |
129 | SRC += dsl.c |
||
886 | killagreg | 130 | endif |
1199 | killagreg | 131 | ifeq ($(RC), SPECTRUM) |
132 | SRC += spectrum.c |
||
133 | endif |
||
134 | endif |
||
1 | ingob | 135 | ########################################################################################################## |
136 | |||
137 | |||
138 | # List Assembler source files here. |
||
139 | # Make them always end in a capital .S. Files ending in a lowercase .s |
||
140 | # will not be considered source files but generated files (assembler |
||
141 | # output from the compiler), and will be deleted upon "make clean"! |
||
142 | # Even though the DOS/Win* filesystem matches both .s and .S the same, |
||
143 | # it will preserve the spelling of the filenames, and gcc itself does |
||
144 | # care about how the name is spelled on its command-line. |
||
145 | ASRC = |
||
146 | |||
147 | |||
148 | |||
149 | # List any extra directories to look for include files here. |
||
150 | # Each directory must be seperated by a space. |
||
151 | EXTRAINCDIRS = |
||
152 | |||
153 | |||
154 | # Optional compiler flags. |
||
155 | # -g: generate debugging information (for GDB, or for COFF conversion) |
||
156 | # -O*: optimization level |
||
157 | # -f...: tuning, see gcc manual and avr-libc documentation |
||
158 | # -Wall...: warning level |
||
159 | # -Wa,...: tell GCC to pass this to the assembler. |
||
160 | # -ahlms: create assembler listing |
||
161 | CFLAGS = -O$(OPT) \ |
||
162 | -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums \ |
||
163 | -Wall -Wstrict-prototypes \ |
||
164 | -Wa,-adhlns=$(<:.c=.lst) \ |
||
165 | $(patsubst %,-I%,$(EXTRAINCDIRS)) |
||
166 | |||
167 | |||
168 | # Set a "language standard" compiler flag. |
||
169 | # Unremark just one line below to set the language standard to use. |
||
170 | # gnu99 = C99 + GNU extensions. See GCC manual for more information. |
||
171 | #CFLAGS += -std=c89 |
||
172 | #CFLAGS += -std=gnu89 |
||
173 | #CFLAGS += -std=c99 |
||
174 | CFLAGS += -std=gnu99 |
||
175 | |||
1180 | killagreg | 176 | CFLAGS += -DF_CPU=$(F_CPU) -DVERSION_MAJOR=$(VERSION_MAJOR) -DVERSION_MINOR=$(VERSION_MINOR) -DVERSION_PATCH=$(VERSION_PATCH) -DVERSION_SERIAL_MAJOR=$(VERSION_SERIAL_MAJOR) -DVERSION_SERIAL_MINOR=$(VERSION_SERIAL_MINOR) -DNC_SPI_COMPATIBLE=$(NC_SPI_COMPATIBLE) |
1 | ingob | 177 | |
886 | killagreg | 178 | ifeq ($(EXT), KILLAGREG) |
179 | CFLAGS += -DUSE_KILLAGREG |
||
180 | endif |
||
908 | killagreg | 181 | ifeq ($(EXT), MK3MAG) |
182 | CFLAGS += -DUSE_MK3MAG |
||
183 | endif |
||
886 | killagreg | 184 | ifeq ($(EXT), NAVICTRL) |
185 | CFLAGS += -DUSE_NAVICTRL |
||
1199 | killagreg | 186 | ifeq ($(RC), DSL) |
187 | CFLAGS += -DUSE_RC_DSL |
||
886 | killagreg | 188 | endif |
1199 | killagreg | 189 | ifeq ($(RC), SPECTRUM) |
190 | CFLAGS += -DUSE_RC_SPECTRUM |
||
191 | endif |
||
192 | endif |
||
1 | ingob | 193 | |
1180 | killagreg | 194 | ifeq ($(SETUP), QUADRO) |
195 | CFLAGS += -DUSE_QUADRO |
||
196 | endif |
||
197 | ifeq ($(SETUP), OCTO) |
||
198 | CFLAGS += -DUSE_OCTO |
||
199 | endif |
||
200 | ifeq ($(SETUP), OCTO2) |
||
201 | CFLAGS += -DUSE_OCTO2 |
||
202 | endif |
||
203 | ifeq ($(SETUP), OCTO3) |
||
204 | CFLAGS += -DUSE_OCTO3 |
||
205 | endif |
||
886 | killagreg | 206 | |
207 | |||
208 | |||
1180 | killagreg | 209 | |
1 | ingob | 210 | # Optional assembler flags. |
211 | # -Wa,...: tell GCC to pass this to the assembler. |
||
212 | # -ahlms: create listing |
||
213 | # -gstabs: have the assembler create line number information; note that |
||
214 | # for use in COFF files, additional information about filenames |
||
215 | # and function names needs to be present in the assembler source |
||
216 | # files -- see avr-libc docs [FIXME: not yet described there] |
||
217 | ASFLAGS = -Wa,-adhlns=$(<:.S=.lst),-gstabs |
||
218 | |||
219 | |||
220 | |||
221 | # Optional linker flags. |
||
222 | # -Wl,...: tell GCC to pass this to linker. |
||
223 | # -Map: create map file |
||
224 | # --cref: add cross reference to map file |
||
225 | LDFLAGS = -Wl,-Map=$(TARGET).map,--cref |
||
226 | |||
227 | # Additional libraries |
||
228 | |||
229 | # Minimalistic printf version |
||
230 | #LDFLAGS += -Wl,-u,vfprintf -lprintf_min |
||
231 | |||
232 | # Floating point printf version (requires -lm below) |
||
233 | #LDFLAGS += -Wl,-u,vfprintf -lprintf_flt |
||
234 | |||
235 | # -lm = math library |
||
236 | LDFLAGS += -lm |
||
237 | |||
238 | |||
239 | ##LDFLAGS += -T./linkerfile/avr5.x |
||
240 | |||
241 | |||
242 | |||
243 | # Programming support using avrdude. Settings and variables. |
||
244 | |||
245 | # Programming hardware: alf avr910 avrisp bascom bsd |
||
246 | # dt006 pavr picoweb pony-stk200 sp12 stk200 stk500 |
||
247 | # |
||
248 | # Type: avrdude -c ? |
||
249 | # to get a full listing. |
||
250 | # |
||
595 | hbuss | 251 | #AVRDUDE_PROGRAMMER = dt006 |
1 | ingob | 252 | #AVRDUDE_PROGRAMMER = stk200 |
253 | #AVRDUDE_PROGRAMMER = ponyser |
||
595 | hbuss | 254 | AVRDUDE_PROGRAMMER = avrispv2 |
1 | ingob | 255 | #falls Ponyser ausgewählt wird, muss sich unsere avrdude-Configdatei im Bin-Verzeichnis des Compilers befinden |
256 | |||
595 | hbuss | 257 | #AVRDUDE_PORT = com1 # programmer connected to serial device |
258 | #AVRDUDE_PORT = lpt1 # programmer connected to parallel port |
||
259 | AVRDUDE_PORT = usb # programmer connected to USB |
||
1 | ingob | 260 | |
261 | #AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex |
||
262 | AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex $(FUSE_SETTINGS) |
||
263 | #AVRDUDE_WRITE_EEPROM = -U eeprom:w:$(TARGET).eep |
||
264 | |||
595 | hbuss | 265 | #avrdude -c avrispv2 -P usb -p m32 -U flash:w:blink.hex |
1 | ingob | 266 | AVRDUDE_FLAGS = -p $(MCU) -P $(AVRDUDE_PORT) -c $(AVRDUDE_PROGRAMMER) |
267 | |||
268 | # Uncomment the following if you want avrdude's erase cycle counter. |
||
269 | # Note that this counter needs to be initialized first using -Yn, |
||
270 | # see avrdude manual. |
||
271 | #AVRDUDE_ERASE += -y |
||
272 | |||
273 | # Uncomment the following if you do /not/ wish a verification to be |
||
274 | # performed after programming the device. |
||
275 | AVRDUDE_FLAGS += -V |
||
276 | |||
277 | # Increase verbosity level. Please use this when submitting bug |
||
278 | # reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude> |
||
279 | # to submit bug reports. |
||
280 | #AVRDUDE_FLAGS += -v -v |
||
281 | |||
282 | # --------------------------------------------------------------------------- |
||
283 | # Define directories, if needed. |
||
284 | DIRAVR = c:/winavr |
||
285 | DIRAVRBIN = $(DIRAVR)/bin |
||
286 | DIRAVRUTILS = $(DIRAVR)/utils/bin |
||
287 | DIRINC = . |
||
288 | DIRLIB = $(DIRAVR)/avr/lib |
||
289 | |||
290 | |||
291 | # Define programs and commands. |
||
292 | SHELL = sh |
||
293 | |||
294 | CC = avr-gcc |
||
295 | |||
296 | OBJCOPY = avr-objcopy |
||
297 | OBJDUMP = avr-objdump |
||
298 | SIZE = avr-size |
||
299 | |||
300 | # Programming support using avrdude. |
||
301 | AVRDUDE = avrdude |
||
302 | |||
303 | REMOVE = rm -f |
||
304 | COPY = cp |
||
305 | |||
306 | HEXSIZE = $(SIZE) --target=$(FORMAT) $(TARGET).hex |
||
307 | ELFSIZE = $(SIZE) -A $(TARGET).elf |
||
308 | |||
309 | # Define Messages |
||
310 | # English |
||
311 | MSG_ERRORS_NONE = Errors: none |
||
312 | MSG_BEGIN = -------- begin -------- |
||
313 | MSG_END = -------- end -------- |
||
314 | MSG_SIZE_BEFORE = Size before: |
||
315 | MSG_SIZE_AFTER = Size after: |
||
316 | MSG_COFF = Converting to AVR COFF: |
||
317 | MSG_EXTENDED_COFF = Converting to AVR Extended COFF: |
||
318 | MSG_FLASH = Creating load file for Flash: |
||
319 | MSG_EEPROM = Creating load file for EEPROM: |
||
320 | MSG_EXTENDED_LISTING = Creating Extended Listing: |
||
321 | MSG_SYMBOL_TABLE = Creating Symbol Table: |
||
322 | MSG_LINKING = Linking: |
||
323 | MSG_COMPILING = Compiling: |
||
324 | MSG_ASSEMBLING = Assembling: |
||
325 | MSG_CLEANING = Cleaning project: |
||
326 | |||
327 | |||
328 | # Define all object files. |
||
329 | OBJ = $(SRC:.c=.o) $(ASRC:.S=.o) |
||
330 | |||
331 | # Define all listing files. |
||
332 | LST = $(ASRC:.S=.lst) $(SRC:.c=.lst) |
||
333 | |||
334 | # Combine all necessary flags and optional flags. |
||
335 | # Add target processor to flags. |
||
336 | #ALL_CFLAGS = -mmcu=$(MCU) -DF_CPU=$(F_CPU) -I. $(CFLAGS) |
||
337 | ALL_CFLAGS = -mmcu=$(MCU) -I. $(CFLAGS) |
||
338 | ALL_ASFLAGS = -mmcu=$(MCU) -I. -x assembler-with-cpp $(ASFLAGS) |
||
339 | |||
340 | |||
341 | # Default target. |
||
342 | all: begin gccversion sizebefore $(TARGET).elf $(TARGET).hex $(TARGET).eep \ |
||
343 | $(TARGET).lss $(TARGET).sym sizeafter finished end |
||
344 | |||
345 | |||
346 | # Eye candy. |
||
347 | # AVR Studio 3.x does not check make's exit code but relies on |
||
348 | # the following magic strings to be generated by the compile job. |
||
349 | begin: |
||
350 | @echo |
||
351 | @echo $(MSG_BEGIN) |
||
352 | |||
353 | finished: |
||
354 | @echo $(MSG_ERRORS_NONE) |
||
355 | |||
356 | end: |
||
357 | @echo $(MSG_END) |
||
358 | @echo |
||
359 | |||
360 | |||
361 | # Display size of file. |
||
362 | sizebefore: |
||
363 | @if [ -f $(TARGET).elf ]; then echo; echo $(MSG_SIZE_BEFORE); $(ELFSIZE); echo; fi |
||
364 | |||
365 | sizeafter: |
||
366 | @if [ -f $(TARGET).elf ]; then echo; echo $(MSG_SIZE_AFTER); $(ELFSIZE); echo; fi |
||
367 | |||
368 | |||
369 | |||
370 | # Display compiler version information. |
||
371 | gccversion : |
||
372 | @$(CC) --version |
||
373 | |||
374 | |||
375 | # Convert ELF to COFF for use in debugging / simulating in |
||
376 | # AVR Studio or VMLAB. |
||
377 | COFFCONVERT=$(OBJCOPY) --debugging \ |
||
378 | --change-section-address .data-0x800000 \ |
||
379 | --change-section-address .bss-0x800000 \ |
||
380 | --change-section-address .noinit-0x800000 \ |
||
381 | --change-section-address .eeprom-0x810000 |
||
382 | |||
383 | |||
384 | coff: $(TARGET).elf |
||
385 | @echo |
||
386 | @echo $(MSG_COFF) $(TARGET).cof |
||
387 | $(COFFCONVERT) -O coff-avr $< $(TARGET).cof |
||
388 | |||
389 | |||
390 | extcoff: $(TARGET).elf |
||
391 | @echo |
||
392 | @echo $(MSG_EXTENDED_COFF) $(TARGET).cof |
||
393 | $(COFFCONVERT) -O coff-ext-avr $< $(TARGET).cof |
||
394 | |||
395 | |||
396 | |||
397 | |||
398 | # Program the device. |
||
399 | program: $(TARGET).hex $(TARGET).eep |
||
400 | $(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM) |
||
401 | |||
402 | |||
403 | |||
404 | |||
405 | # Create final output files (.hex, .eep) from ELF output file. |
||
406 | %.hex: %.elf |
||
407 | @echo |
||
408 | @echo $(MSG_FLASH) $@ |
||
409 | $(OBJCOPY) -O $(FORMAT) -R .eeprom $< $@ |
||
410 | |||
411 | %.eep: %.elf |
||
412 | @echo |
||
413 | @echo $(MSG_EEPROM) $@ |
||
414 | -$(OBJCOPY) -j .eeprom --set-section-flags=.eeprom="alloc,load" \ |
||
415 | --change-section-lma .eeprom=0 -O $(FORMAT) $< $@ |
||
416 | |||
417 | # Create extended listing file from ELF output file. |
||
418 | %.lss: %.elf |
||
419 | @echo |
||
420 | @echo $(MSG_EXTENDED_LISTING) $@ |
||
421 | $(OBJDUMP) -h -S $< > $@ |
||
422 | |||
423 | # Create a symbol table from ELF output file. |
||
424 | %.sym: %.elf |
||
425 | @echo |
||
426 | @echo $(MSG_SYMBOL_TABLE) $@ |
||
427 | avr-nm -n $< > $@ |
||
428 | |||
429 | |||
430 | |||
431 | # Link: create ELF output file from object files. |
||
432 | .SECONDARY : $(TARGET).elf |
||
433 | .PRECIOUS : $(OBJ) |
||
434 | %.elf: $(OBJ) |
||
435 | @echo |
||
436 | @echo $(MSG_LINKING) $@ |
||
437 | $(CC) $(ALL_CFLAGS) $(OBJ) --output $@ $(LDFLAGS) |
||
438 | |||
439 | |||
440 | # Compile: create object files from C source files. |
||
441 | %.o : %.c |
||
442 | @echo |
||
443 | @echo $(MSG_COMPILING) $< |
||
444 | $(CC) -c $(ALL_CFLAGS) $< -o $@ |
||
445 | |||
446 | |||
447 | # Compile: create assembler files from C source files. |
||
448 | %.s : %.c |
||
449 | $(CC) -S $(ALL_CFLAGS) $< -o $@ |
||
450 | |||
451 | |||
452 | # Assemble: create object files from assembler source files. |
||
453 | %.o : %.S |
||
454 | @echo |
||
455 | @echo $(MSG_ASSEMBLING) $< |
||
456 | $(CC) -c $(ALL_ASFLAGS) $< -o $@ |
||
457 | |||
458 | |||
459 | |||
460 | |||
461 | |||
462 | |||
463 | # Target: clean project. |
||
464 | clean: begin clean_list finished end |
||
465 | |||
466 | clean_list : |
||
467 | @echo |
||
468 | @echo $(MSG_CLEANING) |
||
469 | # $(REMOVE) $(TARGET).hex |
||
470 | $(REMOVE) $(TARGET).eep |
||
471 | $(REMOVE) $(TARGET).obj |
||
472 | $(REMOVE) $(TARGET).cof |
||
473 | $(REMOVE) $(TARGET).elf |
||
474 | $(REMOVE) $(TARGET).map |
||
475 | $(REMOVE) $(TARGET).obj |
||
476 | $(REMOVE) $(TARGET).a90 |
||
477 | $(REMOVE) $(TARGET).sym |
||
478 | $(REMOVE) $(TARGET).lnk |
||
479 | $(REMOVE) $(TARGET).lss |
||
480 | $(REMOVE) $(OBJ) |
||
481 | $(REMOVE) $(LST) |
||
482 | $(REMOVE) $(SRC:.c=.s) |
||
483 | $(REMOVE) $(SRC:.c=.d) |
||
484 | |||
485 | |||
486 | # Automatically generate C source code dependencies. |
||
487 | # (Code originally taken from the GNU make user manual and modified |
||
488 | # (See README.txt Credits).) |
||
489 | # |
||
490 | # Note that this will work with sh (bash) and sed that is shipped with WinAVR |
||
491 | # (see the SHELL variable defined above). |
||
492 | # This may not work with other shells or other seds. |
||
493 | # |
||
494 | %.d: %.c |
||
495 | set -e; $(CC) -MM $(ALL_CFLAGS) $< \ |
||
496 | | sed 's,\(.*\)\.o[ :]*,\1.o \1.d : ,g' > $@; \ |
||
497 | [ -s $@ ] || rm -f $@ |
||
498 | |||
499 | |||
500 | # Remove the '-' if you want to see the dependency files generated. |
||
501 | -include $(SRC:.c=.d) |
||
502 | |||
503 | |||
504 | |||
505 | # Listing of phony targets. |
||
506 | .PHONY : all begin finish end sizebefore sizeafter gccversion coff extcoff \ |
||
507 | clean clean_list program |
||
508 |