Subversion Repositories MK3Mag

Rev

Rev 29 | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 29 Rev 31
1
#--------------------------------------------------------------------
1
#--------------------------------------------------------------------
2
# MCU name
2
# MCU name
3
MCU = atmega168
3
MCU = atmega168
4
F_CPU = 8000000
4
F_CPU = 8000000
5
#-------------------------------------------------------------------
5
#-------------------------------------------------------------------
6
BOARD = 10
6
BOARD = 10
7
#BOARD = 11
7
#BOARD = 11
8
VERSION_MAJOR    =   0
8
VERSION_MAJOR    =   0
9
VERSION_MINOR    =  16
9
VERSION_MINOR    =  17
10
 
10
 
11
VERSION_COMPATIBLE = 8  # PC-Kompatibilität
11
VERSION_COMPATIBLE = 8  # PC-Kompatibilität
12
#-------------------------------------------------------------------
12
#-------------------------------------------------------------------
13
 
13
 
14
# Output format. (can be srec, ihex, binary)
14
# Output format. (can be srec, ihex, binary)
15
FORMAT = ihex
15
FORMAT = ihex
16
 
16
 
17
# Target file name (without extension).
17
# Target file name (without extension).
18
TARGET = MK3Mag_MEGA168_V$(VERSION_MAJOR)_$(VERSION_MINOR)
18
TARGET = MK3Mag_MEGA168_V$(VERSION_MAJOR)_$(VERSION_MINOR)
19
 
19
 
20
# Optimization level, can be [0, 1, 2, 3, s]. 0 turns off optimization.
20
# Optimization level, can be [0, 1, 2, 3, s]. 0 turns off optimization.
21
# (Note: 3 is not always the best optimization level. See avr-libc FAQ.)
21
# (Note: 3 is not always the best optimization level. See avr-libc FAQ.)
22
OPT = s
22
OPT = s
23
 
23
 
24
##########################################################################################################
24
##########################################################################################################
25
# List C source files here. (C dependencies are automatically generated.)
25
# List C source files here. (C dependencies are automatically generated.)
26
SRC = main.c uart.c timer0.c analog.c twislave.c led.c
26
SRC = main.c uart.c timer0.c analog.c twislave.c led.c
27
##########################################################################################################
27
##########################################################################################################
28
 
28
 
29
 
29
 
30
# List Assembler source files here.
30
# List Assembler source files here.
31
# Make them always end in a capital .S.  Files ending in a lowercase .s
31
# Make them always end in a capital .S.  Files ending in a lowercase .s
32
# will not be considered source files but generated files (assembler
32
# will not be considered source files but generated files (assembler
33
# output from the compiler), and will be deleted upon "make clean"!
33
# output from the compiler), and will be deleted upon "make clean"!
34
# Even though the DOS/Win* filesystem matches both .s and .S the same,
34
# Even though the DOS/Win* filesystem matches both .s and .S the same,
35
# it will preserve the spelling of the filenames, and gcc itself does
35
# it will preserve the spelling of the filenames, and gcc itself does
36
# care about how the name is spelled on its command-line.
36
# care about how the name is spelled on its command-line.
37
ASRC = 
37
ASRC = 
38
 
38
 
39
 
39
 
40
# List any extra directories to look for include files here.
40
# List any extra directories to look for include files here.
41
#     Each directory must be seperated by a space.
41
#     Each directory must be seperated by a space.
42
EXTRAINCDIRS = 
42
EXTRAINCDIRS = 
43
 
43
 
44
 
44
 
45
CDEFS = -DF_CPU=$(F_CPU)UL
45
CDEFS = -DF_CPU=$(F_CPU)UL
46
 
46
 
47
# Optional compiler flags.
47
# Optional compiler flags.
48
#  -g:        generate debugging information (for GDB, or for COFF conversion)
48
#  -g:        generate debugging information (for GDB, or for COFF conversion)
49
#  -O*:       optimization level
49
#  -O*:       optimization level
50
#  -f...:     tuning, see gcc manual and avr-libc documentation
50
#  -f...:     tuning, see gcc manual and avr-libc documentation
51
#  -Wall...:  warning level
51
#  -Wall...:  warning level
52
#  -Wa,...:   tell GCC to pass this to the assembler.
52
#  -Wa,...:   tell GCC to pass this to the assembler.
53
#    -ahlms:  create assembler listing
53
#    -ahlms:  create assembler listing
54
CFLAGS = -g -O$(OPT) \
54
CFLAGS = -g -O$(OPT) \
55
-funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums \
55
-funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums \
56
-Wall -Wstrict-prototypes \
56
-Wall -Wstrict-prototypes \
57
-Wa,-adhlns=$(<:.c=.lst) \
57
-Wa,-adhlns=$(<:.c=.lst) \
58
$(patsubst %,-I%,$(EXTRAINCDIRS))
58
$(patsubst %,-I%,$(EXTRAINCDIRS))
59
 
59
 
60
 
60
 
61
# Set a "language standard" compiler flag.
61
# Set a "language standard" compiler flag.
62
#   Unremark just one line below to set the language standard to use.
62
#   Unremark just one line below to set the language standard to use.
63
#   gnu99 = C99 + GNU extensions. See GCC manual for more information.
63
#   gnu99 = C99 + GNU extensions. See GCC manual for more information.
64
#CFLAGS += -std=c89
64
#CFLAGS += -std=c89
65
#CFLAGS += -std=gnu89
65
#CFLAGS += -std=gnu89
66
#CFLAGS += -std=c99
66
#CFLAGS += -std=c99
67
CFLAGS += -std=gnu99
67
CFLAGS += -std=gnu99
68
CFLAGS += $(CDEFS)
68
CFLAGS += $(CDEFS)
69
CFLAGS += -DVERSION_MAJOR=$(VERSION_MAJOR) -DVERSION_MINOR=$(VERSION_MINOR) -DVERSION_COMPATIBLE=$(VERSION_COMPATIBLE) -DBOARD=$(BOARD)
69
CFLAGS += -DVERSION_MAJOR=$(VERSION_MAJOR) -DVERSION_MINOR=$(VERSION_MINOR) -DVERSION_COMPATIBLE=$(VERSION_COMPATIBLE) -DBOARD=$(BOARD)
70
 
70
 
71
ifeq ($(AVR_CTRL_PLATINE), 1)
71
ifeq ($(AVR_CTRL_PLATINE), 1)
72
CFLAGS += -DAVR_CTRL_PLATINE=$(AVR_CTRL_PLATINE)         
72
CFLAGS += -DAVR_CTRL_PLATINE=$(AVR_CTRL_PLATINE)         
73
endif
73
endif
74
 
74
 
75
 
75
 
76
 
76
 
77
# Optional assembler flags.
77
# Optional assembler flags.
78
#  -Wa,...:   tell GCC to pass this to the assembler.
78
#  -Wa,...:   tell GCC to pass this to the assembler.
79
#  -ahlms:    create listing
79
#  -ahlms:    create listing
80
#  -gstabs:   have the assembler create line number information; note that
80
#  -gstabs:   have the assembler create line number information; note that
81
#             for use in COFF files, additional information about filenames
81
#             for use in COFF files, additional information about filenames
82
#             and function names needs to be present in the assembler source
82
#             and function names needs to be present in the assembler source
83
#             files -- see avr-libc docs [FIXME: not yet described there]
83
#             files -- see avr-libc docs [FIXME: not yet described there]
84
ASFLAGS = -Wa,-adhlns=$(<:.S=.lst),-gstabs 
84
ASFLAGS = -Wa,-adhlns=$(<:.S=.lst),-gstabs 
85
 
85
 
86
 
86
 
87
 
87
 
88
# Optional linker flags.
88
# Optional linker flags.
89
#  -Wl,...:   tell GCC to pass this to linker.
89
#  -Wl,...:   tell GCC to pass this to linker.
90
#  -Map:      create map file
90
#  -Map:      create map file
91
#  --cref:    add cross reference to  map file
91
#  --cref:    add cross reference to  map file
92
LDFLAGS = -Wl,-Map=$(TARGET).map,--cref
92
LDFLAGS = -Wl,-Map=$(TARGET).map,--cref
93
 
93
 
94
 
94
 
95
 
95
 
96
# Additional libraries
96
# Additional libraries
97
 
97
 
98
# Minimalistic printf version
98
# Minimalistic printf version
99
#LDFLAGS += -Wl,-u,vfprintf -lprintf_min
99
#LDFLAGS += -Wl,-u,vfprintf -lprintf_min
100
 
100
 
101
# Floating point printf version (requires -lm below)
101
# Floating point printf version (requires -lm below)
102
#LDFLAGS += -Wl,-u,vfprintf -lprintf_flt
102
#LDFLAGS += -Wl,-u,vfprintf -lprintf_flt
103
 
103
 
104
# -lm = math library
104
# -lm = math library
105
LDFLAGS += -lm
105
LDFLAGS += -lm
106
 
106
 
107
 
107
 
108
 
108
 
109
 
109
 
110
# Programming support using avrdude. Settings and variables.
110
# Programming support using avrdude. Settings and variables.
111
 
111
 
112
# Programming hardware: alf avr910 avrisp bascom bsd 
112
# Programming hardware: alf avr910 avrisp bascom bsd 
113
# dt006 pavr picoweb pony-stk200 sp12 stk200 stk500
113
# dt006 pavr picoweb pony-stk200 sp12 stk200 stk500
114
#
114
#
115
# Type: avrdude -c ?
115
# Type: avrdude -c ?
116
# to get a full listing.
116
# to get a full listing.
117
#
117
#
118
 
118
 
119
AVRDUDE_PROGRAMMER = dt006
119
AVRDUDE_PROGRAMMER = dt006
120
#AVRDUDE_PROGRAMMER = stk200
120
#AVRDUDE_PROGRAMMER = stk200
121
 
121
 
122
#AVRDUDE_PORT = com1	   # programmer connected to serial device
122
#AVRDUDE_PORT = com1	   # programmer connected to serial device
123
AVRDUDE_PORT = lpt1	# programmer connected to parallel port
123
AVRDUDE_PORT = lpt1	# programmer connected to parallel port
124
 
124
 
125
AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex
125
AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex
126
#AVRDUDE_WRITE_EEPROM = -U eeprom:w:$(TARGET).eep
126
#AVRDUDE_WRITE_EEPROM = -U eeprom:w:$(TARGET).eep
127
 
127
 
128
AVRDUDE_FLAGS = -F -p $(MCU) -P $(AVRDUDE_PORT) -c $(AVRDUDE_PROGRAMMER)
128
AVRDUDE_FLAGS = -F -p $(MCU) -P $(AVRDUDE_PORT) -c $(AVRDUDE_PROGRAMMER)
129
 
129
 
130
# Uncomment the following if you want avrdude's erase cycle counter.
130
# Uncomment the following if you want avrdude's erase cycle counter.
131
# Note that this counter needs to be initialized first using -Yn,
131
# Note that this counter needs to be initialized first using -Yn,
132
# see avrdude manual.
132
# see avrdude manual.
133
#AVRDUDE_ERASE += -y
133
#AVRDUDE_ERASE += -y
134
 
134
 
135
# Uncomment the following if you do /not/ wish a verification to be
135
# Uncomment the following if you do /not/ wish a verification to be
136
# performed after programming the device.
136
# performed after programming the device.
137
#AVRDUDE_FLAGS += -V -E noreset
137
#AVRDUDE_FLAGS += -V -E noreset
138
 
138
 
139
 
139
 
140
# Increase verbosity level.  Please use this when submitting bug
140
# Increase verbosity level.  Please use this when submitting bug
141
# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude> 
141
# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude> 
142
# to submit bug reports.
142
# to submit bug reports.
143
#AVRDUDE_FLAGS += -v -v
143
#AVRDUDE_FLAGS += -v -v
144
 
144
 
145
 
145
 
146
 
146
 
147
 
147
 
148
# ---------------------------------------------------------------------------
148
# ---------------------------------------------------------------------------
149
 
149
 
150
# Define directories, if needed.
150
# Define directories, if needed.
151
DIRAVR = c:/winavr
151
DIRAVR = c:/winavr
152
DIRAVRBIN = $(DIRAVR)/bin
152
DIRAVRBIN = $(DIRAVR)/bin
153
DIRAVRUTILS = $(DIRAVR)/utils/bin
153
DIRAVRUTILS = $(DIRAVR)/utils/bin
154
DIRINC = .
154
DIRINC = .
155
DIRLIB = $(DIRAVR)/avr/lib
155
DIRLIB = $(DIRAVR)/avr/lib
156
 
156
 
157
 
157
 
158
# Define programs and commands.
158
# Define programs and commands.
159
SHELL = sh
159
SHELL = sh
160
 
160
 
161
CC = avr-gcc
161
CC = avr-gcc
162
 
162
 
163
OBJCOPY = avr-objcopy
163
OBJCOPY = avr-objcopy
164
OBJDUMP = avr-objdump
164
OBJDUMP = avr-objdump
165
SIZE = avr-size
165
SIZE = avr-size
166
 
166
 
167
 
167
 
168
# Programming support using avrdude.
168
# Programming support using avrdude.
169
AVRDUDE = avrdude
169
AVRDUDE = avrdude
170
 
170
 
171
 
171
 
172
REMOVE = rm -f
172
REMOVE = rm -f
173
COPY = cp
173
COPY = cp
174
 
174
 
175
HEXSIZE = $(SIZE) --target=$(FORMAT) $(TARGET).hex
175
HEXSIZE = $(SIZE) --target=$(FORMAT) $(TARGET).hex
176
ELFSIZE = $(SIZE) -A $(TARGET).elf
176
ELFSIZE = $(SIZE) -A $(TARGET).elf
177
 
177
 
178
 
178
 
179
 
179
 
180
# Define Messages
180
# Define Messages
181
# English
181
# English
182
MSG_ERRORS_NONE = Errors: none
182
MSG_ERRORS_NONE = Errors: none
183
MSG_BEGIN = -------- begin --------
183
MSG_BEGIN = -------- begin --------
184
MSG_END = --------  end  --------
184
MSG_END = --------  end  --------
185
MSG_SIZE_BEFORE = Size before: 
185
MSG_SIZE_BEFORE = Size before: 
186
MSG_SIZE_AFTER = Size after:
186
MSG_SIZE_AFTER = Size after:
187
MSG_COFF = Converting to AVR COFF:
187
MSG_COFF = Converting to AVR COFF:
188
MSG_EXTENDED_COFF = Converting to AVR Extended COFF:
188
MSG_EXTENDED_COFF = Converting to AVR Extended COFF:
189
MSG_FLASH = Creating load file for Flash:
189
MSG_FLASH = Creating load file for Flash:
190
MSG_EEPROM = Creating load file for EEPROM:
190
MSG_EEPROM = Creating load file for EEPROM:
191
MSG_EXTENDED_LISTING = Creating Extended Listing:
191
MSG_EXTENDED_LISTING = Creating Extended Listing:
192
MSG_SYMBOL_TABLE = Creating Symbol Table:
192
MSG_SYMBOL_TABLE = Creating Symbol Table:
193
MSG_LINKING = Linking:
193
MSG_LINKING = Linking:
194
MSG_COMPILING = Compiling:
194
MSG_COMPILING = Compiling:
195
MSG_ASSEMBLING = Assembling:
195
MSG_ASSEMBLING = Assembling:
196
MSG_CLEANING = Cleaning project:
196
MSG_CLEANING = Cleaning project:
197
 
197
 
198
 
198
 
199
 
199
 
200
 
200
 
201
# Define all object files.
201
# Define all object files.
202
OBJ = $(SRC:.c=.o) $(ASRC:.S=.o) 
202
OBJ = $(SRC:.c=.o) $(ASRC:.S=.o) 
203
 
203
 
204
# Define all listing files.
204
# Define all listing files.
205
LST = $(ASRC:.S=.lst) $(SRC:.c=.lst)
205
LST = $(ASRC:.S=.lst) $(SRC:.c=.lst)
206
 
206
 
207
# Combine all necessary flags and optional flags.
207
# Combine all necessary flags and optional flags.
208
# Add target processor to flags.
208
# Add target processor to flags.
209
ALL_CFLAGS = -mmcu=$(MCU) -I. $(CFLAGS)
209
ALL_CFLAGS = -mmcu=$(MCU) -I. $(CFLAGS)
210
ALL_ASFLAGS = -mmcu=$(MCU) -I. -x assembler-with-cpp $(ASFLAGS)
210
ALL_ASFLAGS = -mmcu=$(MCU) -I. -x assembler-with-cpp $(ASFLAGS)
211
 
211
 
212
 
212
 
213
 
213
 
214
# Default target.
214
# Default target.
215
all: begin gccversion sizebefore $(TARGET).elf $(TARGET).hex $(TARGET).eep \
215
all: begin gccversion sizebefore $(TARGET).elf $(TARGET).hex $(TARGET).eep \
216
	$(TARGET).lss $(TARGET).sym sizeafter finished end
216
	$(TARGET).lss $(TARGET).sym sizeafter finished end
217
 
217
 
218
 
218
 
219
# Eye candy.
219
# Eye candy.
220
# AVR Studio 3.x does not check make's exit code but relies on
220
# AVR Studio 3.x does not check make's exit code but relies on
221
# the following magic strings to be generated by the compile job.
221
# the following magic strings to be generated by the compile job.
222
begin:
222
begin:
223
	@echo
223
	@echo
224
	@echo $(MSG_BEGIN)
224
	@echo $(MSG_BEGIN)
225
 
225
 
226
finished:
226
finished:
227
	@echo $(MSG_ERRORS_NONE)
227
	@echo $(MSG_ERRORS_NONE)
228
 
228
 
229
end:
229
end:
230
	@echo $(MSG_END)
230
	@echo $(MSG_END)
231
	@echo
231
	@echo
232
 
232
 
233
 
233
 
234
# Display size of file.
234
# Display size of file.
235
sizebefore:
235
sizebefore:
236
	@if [ -f $(TARGET).elf ]; then echo; echo $(MSG_SIZE_BEFORE); $(ELFSIZE); echo; fi
236
	@if [ -f $(TARGET).elf ]; then echo; echo $(MSG_SIZE_BEFORE); $(ELFSIZE); echo; fi
237
 
237
 
238
sizeafter:
238
sizeafter:
239
	@if [ -f $(TARGET).elf ]; then echo; echo $(MSG_SIZE_AFTER); $(ELFSIZE); echo; fi
239
	@if [ -f $(TARGET).elf ]; then echo; echo $(MSG_SIZE_AFTER); $(ELFSIZE); echo; fi
240
 
240
 
241
 
241
 
242
 
242
 
243
# Display compiler version information.
243
# Display compiler version information.
244
gccversion : 
244
gccversion : 
245
	@$(CC) --version
245
	@$(CC) --version
246
 
246
 
247
 
247
 
248
 
248
 
249
 
249
 
250
# Convert ELF to COFF for use in debugging / simulating in
250
# Convert ELF to COFF for use in debugging / simulating in
251
# AVR Studio or VMLAB.
251
# AVR Studio or VMLAB.
252
COFFCONVERT=$(OBJCOPY) --debugging \
252
COFFCONVERT=$(OBJCOPY) --debugging \
253
	--change-section-address .data-0x800000 \
253
	--change-section-address .data-0x800000 \
254
	--change-section-address .bss-0x800000 \
254
	--change-section-address .bss-0x800000 \
255
	--change-section-address .noinit-0x800000 \
255
	--change-section-address .noinit-0x800000 \
256
	--change-section-address .eeprom-0x810000 
256
	--change-section-address .eeprom-0x810000 
257
 
257
 
258
 
258
 
259
coff: $(TARGET).elf
259
coff: $(TARGET).elf
260
	@echo
260
	@echo
261
	@echo $(MSG_COFF) $(TARGET).cof
261
	@echo $(MSG_COFF) $(TARGET).cof
262
	$(COFFCONVERT) -O coff-avr $< $(TARGET).cof
262
	$(COFFCONVERT) -O coff-avr $< $(TARGET).cof
263
 
263
 
264
 
264
 
265
extcoff: $(TARGET).elf
265
extcoff: $(TARGET).elf
266
	@echo
266
	@echo
267
	@echo $(MSG_EXTENDED_COFF) $(TARGET).cof
267
	@echo $(MSG_EXTENDED_COFF) $(TARGET).cof
268
	$(COFFCONVERT) -O coff-ext-avr $< $(TARGET).cof
268
	$(COFFCONVERT) -O coff-ext-avr $< $(TARGET).cof
269
 
269
 
270
 
270
 
271
 
271
 
272
 
272
 
273
# Program the device.  
273
# Program the device.  
274
program: $(TARGET).hex $(TARGET).eep
274
program: $(TARGET).hex $(TARGET).eep
275
	$(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM)
275
	$(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM)
276
 
276
 
277
 
277
 
278
 
278
 
279
 
279
 
280
# Create final output files (.hex, .eep) from ELF output file.
280
# Create final output files (.hex, .eep) from ELF output file.
281
%.hex: %.elf
281
%.hex: %.elf
282
	@echo
282
	@echo
283
	@echo $(MSG_FLASH) $@
283
	@echo $(MSG_FLASH) $@
284
	$(OBJCOPY) -O $(FORMAT) -R .eeprom $< $@
284
	$(OBJCOPY) -O $(FORMAT) -R .eeprom $< $@
285
 
285
 
286
%.eep: %.elf
286
%.eep: %.elf
287
	@echo
287
	@echo
288
	@echo $(MSG_EEPROM) $@
288
	@echo $(MSG_EEPROM) $@
289
	-$(OBJCOPY) -j .eeprom --set-section-flags=.eeprom="alloc,load" \
289
	-$(OBJCOPY) -j .eeprom --set-section-flags=.eeprom="alloc,load" \
290
	--change-section-lma .eeprom=0 -O $(FORMAT) $< $@
290
	--change-section-lma .eeprom=0 -O $(FORMAT) $< $@
291
 
291
 
292
# Create extended listing file from ELF output file.
292
# Create extended listing file from ELF output file.
293
%.lss: %.elf
293
%.lss: %.elf
294
	@echo
294
	@echo
295
	@echo $(MSG_EXTENDED_LISTING) $@
295
	@echo $(MSG_EXTENDED_LISTING) $@
296
	$(OBJDUMP) -h -S $< > $@
296
	$(OBJDUMP) -h -S $< > $@
297
 
297
 
298
# Create a symbol table from ELF output file.
298
# Create a symbol table from ELF output file.
299
%.sym: %.elf
299
%.sym: %.elf
300
	@echo
300
	@echo
301
	@echo $(MSG_SYMBOL_TABLE) $@
301
	@echo $(MSG_SYMBOL_TABLE) $@
302
	avr-nm -n $< > $@
302
	avr-nm -n $< > $@
303
 
303
 
304
 
304
 
305
 
305
 
306
# Link: create ELF output file from object files.
306
# Link: create ELF output file from object files.
307
.SECONDARY : $(TARGET).elf
307
.SECONDARY : $(TARGET).elf
308
.PRECIOUS : $(OBJ)
308
.PRECIOUS : $(OBJ)
309
%.elf: $(OBJ)
309
%.elf: $(OBJ)
310
	@echo
310
	@echo
311
	@echo $(MSG_LINKING) $@
311
	@echo $(MSG_LINKING) $@
312
	$(CC) $(ALL_CFLAGS) $(OBJ) --output $@ $(LDFLAGS)
312
	$(CC) $(ALL_CFLAGS) $(OBJ) --output $@ $(LDFLAGS)
313
 
313
 
314
 
314
 
315
# Compile: create object files from C source files.
315
# Compile: create object files from C source files.
316
%.o : %.c
316
%.o : %.c
317
	@echo
317
	@echo
318
	@echo $(MSG_COMPILING) $<
318
	@echo $(MSG_COMPILING) $<
319
	$(CC) -c $(ALL_CFLAGS) $< -o $@
319
	$(CC) -c $(ALL_CFLAGS) $< -o $@
320
 
320
 
321
 
321
 
322
# Compile: create assembler files from C source files.
322
# Compile: create assembler files from C source files.
323
%.s : %.c
323
%.s : %.c
324
	$(CC) -S $(ALL_CFLAGS) $< -o $@
324
	$(CC) -S $(ALL_CFLAGS) $< -o $@
325
 
325
 
326
 
326
 
327
# Assemble: create object files from assembler source files.
327
# Assemble: create object files from assembler source files.
328
%.o : %.S
328
%.o : %.S
329
	@echo
329
	@echo
330
	@echo $(MSG_ASSEMBLING) $<
330
	@echo $(MSG_ASSEMBLING) $<
331
	$(CC) -c $(ALL_ASFLAGS) $< -o $@
331
	$(CC) -c $(ALL_ASFLAGS) $< -o $@
332
 
332
 
333
 
333
 
334
 
334
 
335
 
335
 
336
 
336
 
337
 
337
 
338
# Target: clean project.
338
# Target: clean project.
339
clean: begin clean_list finished end
339
clean: begin clean_list finished end
340
 
340
 
341
clean_list :
341
clean_list :
342
	@echo
342
	@echo
343
	@echo $(MSG_CLEANING)
343
	@echo $(MSG_CLEANING)
344
#	$(REMOVE) $(TARGET).hex
344
#	$(REMOVE) $(TARGET).hex
345
#	$(REMOVE) $(TARGET).eep
345
#	$(REMOVE) $(TARGET).eep
346
#	$(REMOVE) $(TARGET).obj
346
#	$(REMOVE) $(TARGET).obj
347
	$(REMOVE) $(TARGET).cof
347
	$(REMOVE) $(TARGET).cof
348
	$(REMOVE) $(TARGET).elf
348
	$(REMOVE) $(TARGET).elf
349
	$(REMOVE) $(TARGET).map
349
	$(REMOVE) $(TARGET).map
350
	$(REMOVE) $(TARGET).obj
350
	$(REMOVE) $(TARGET).obj
351
	$(REMOVE) $(TARGET).a90
351
	$(REMOVE) $(TARGET).a90
352
	$(REMOVE) $(TARGET).sym
352
	$(REMOVE) $(TARGET).sym
353
	$(REMOVE) $(TARGET).lnk
353
	$(REMOVE) $(TARGET).lnk
354
	$(REMOVE) $(TARGET).lss
354
	$(REMOVE) $(TARGET).lss
355
	$(REMOVE) $(OBJ)
355
	$(REMOVE) $(OBJ)
356
	$(REMOVE) $(LST)
356
	$(REMOVE) $(LST)
357
	$(REMOVE) $(SRC:.c=.s)
357
	$(REMOVE) $(SRC:.c=.s)
358
	$(REMOVE) $(SRC:.c=.d)
358
	$(REMOVE) $(SRC:.c=.d)
359
 
359
 
360
 
360
 
361
# Automatically generate C source code dependencies. 
361
# Automatically generate C source code dependencies. 
362
# (Code originally taken from the GNU make user manual and modified 
362
# (Code originally taken from the GNU make user manual and modified 
363
# (See README.txt Credits).)
363
# (See README.txt Credits).)
364
#
364
#
365
# Note that this will work with sh (bash) and sed that is shipped with WinAVR
365
# Note that this will work with sh (bash) and sed that is shipped with WinAVR
366
# (see the SHELL variable defined above).
366
# (see the SHELL variable defined above).
367
# This may not work with other shells or other seds.
367
# This may not work with other shells or other seds.
368
#
368
#
369
%.d: %.c
369
%.d: %.c
370
	set -e; $(CC) -MM $(ALL_CFLAGS) $< \
370
	set -e; $(CC) -MM $(ALL_CFLAGS) $< \
371
	| sed 's,\(.*\)\.o[ :]*,\1.o \1.d : ,g' > $@; \
371
	| sed 's,\(.*\)\.o[ :]*,\1.o \1.d : ,g' > $@; \
372
	[ -s $@ ] || rm -f $@
372
	[ -s $@ ] || rm -f $@
373
 
373
 
374
 
374
 
375
# Remove the '-' if you want to see the dependency files generated.
375
# Remove the '-' if you want to see the dependency files generated.
376
-include $(SRC:.c=.d)
376
-include $(SRC:.c=.d)
377
 
377
 
378
 
378
 
379
 
379
 
380
# Listing of phony targets.
380
# Listing of phony targets.
381
.PHONY : all begin finish end sizebefore sizeafter gccversion coff extcoff \
381
.PHONY : all begin finish end sizebefore sizeafter gccversion coff extcoff \
382
	clean clean_list program
382
	clean clean_list program
383
 
383