Subversion Repositories HomeAutomation

Rev

Rev 554 | Rev 560 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | SVN | RSS feed

Rev 554 Rev 556
Line 1... Line 1...
1
# $Id: Makefile 554 2007-07-21 00:36:32Z andfri $
1
# $Id: Makefile 556 2007-07-24 22:49:05Z andfri $
2
BIOS_VERSION   = 0x1338
2
BIOS_VERSION   = 0x1338
3
 
3
 
4
# Paths: set default pathnames if they are not
4
# Paths: set default pathnames if they are not
5
# passed on from parent Makefile.
5
# passed on from parent Makefile.
6
ifndef TARGET
6
ifndef TARGET
Line 84... Line 84...
84
CFLAGS += -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums
84
CFLAGS += -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums
85
CFLAGS += -Wall -Wstrict-prototypes
85
CFLAGS += -Wall -Wstrict-prototypes
86
CFLAGS += -Wa,-adhlns=$(@:.o=.lst)
86
CFLAGS += -Wa,-adhlns=$(@:.o=.lst)
87
CFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
87
CFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
88
CFLAGS += $(CSTANDARD)
88
CFLAGS += $(CSTANDARD)
-
 
89
CFLAGS += $(GENDEPFLAGS)
89
 
90
 
90
 
91
 
91
 
92
 
92
# Assembler flags.
93
# Assembler flags.
93
#  -Wa,...:   tell GCC to pass this to the assembler.
94
#  -Wa,...:   tell GCC to pass this to the assembler.
Line 186... Line 187...
186
 
187
 
187
# Define all listing files.
188
# Define all listing files.
188
LST = $(OBJ:.o=.lst)
189
LST = $(OBJ:.o=.lst)
189
 
190
 
190
# Define all dependency files.
191
# Define all dependency files.
191
DEP = $(OBJ:.o=.dep)
192
DEP = $(OBJ:.o=.d)
192
 
193
 
193
BUILDDIRS = $(sort $(filter-out ./,$(dir $(OBJ))))
194
BUILDDIRS = $(sort $(filter-out ./,$(dir $(OBJ))))
194
 
195
 
195
# Compiler flags to generate dependency files.
196
# Compiler flags to generate dependency files.
196
### GENDEPFLAGS = -Wp,-M,-MP,-MT,$(*F).o,-MF,.dep/$(@F).d
-
 
197
GENDEPFLAGS = -M -MG -MP -MT "$(@:.dep=.o) $@" -MF $@
197
GENDEPFLAGS = -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)"
198
 
198
 
199
# Default target.
199
# Default target.
200
all: sizebefore build lib sizeafter
200
all: sizebefore buildtree build lib sizeafter
201
 
201
 
202
build: elf hex eep lss sym
202
build: elf hex eep lss sym
203
 
203
 
204
elf: $(TARGET).elf
204
elf: $(TARGET).elf
205
hex: $(TARGET).hex
205
hex: $(TARGET).hex
206
eep: $(TARGET).eep
206
eep: $(TARGET).eep
207
lss: $(TARGET).lss 
207
lss: $(TARGET).lss 
208
sym: $(TARGET).sym
208
sym: $(TARGET).sym
-
 
209
 
-
 
210
buildtree: $(BUILDDIRS)
209
 
211
 
210
# Display size of file.
212
# Display size of file.
211
HEXSIZE = $(SIZE) --target=ihex $(TARGET).hex
213
HEXSIZE = $(SIZE) --target=ihex $(TARGET).hex
212
ELFSIZE = $(SIZE) $(TARGET).elf
214
ELFSIZE = $(SIZE) $(TARGET).elf
213
sizebefore:
215
sizebefore:
214
	@if [ -f $(TARGET).elf ]; then echo; echo $(MSG_SIZE_BEFORE); $(ELFSIZE); echo; fi
216
	@if [ -f $(TARGET).elf ]; then echo; echo $(MSG_SIZE_BEFORE); $(ELFSIZE); echo; fi
215
 
217
 
216
sizeafter:
218
sizeafter:
217
	@if [ -f $(TARGET).elf ]; then echo; echo $(MSG_SIZE_AFTER); $(ELFSIZE); echo; fi
219
	@if [ -f $(TARGET).elf ]; then echo; echo $(MSG_SIZE_AFTER); $(ELFSIZE); echo; fi
218
 
220
 
219
# Generate config.h from bios.inc
221
# Generate config.h from bios.inc
220
config.h: $(CFGDIR)/bios.inc
222
config.h: $(CFGDIR)/bios.inc
221
	@echo Generating $@
223
	@echo Generating $@
222
	@echo "/* This file is automatically generated. Do not edit. */\n" > $@
224
	@echo "/* This file is automatically generated. Do not edit. */\n" > $@
223
	@cat $^ | $(AWK) 'BEGIN { FS="="; print "#ifndef CONFIG_H_\n#define CONFIG_H_\n" } /^[^#].*=.*/ { print "#define "$$1,$$2 } END { print "\n#endif /*CONFIG_H_*/" }' >> $@
225
	@cat $^ | $(AWK) 'BEGIN { FS="="; print "#ifndef CONFIG_H_\n#define CONFIG_H_\n" } /^[^#].*=.*/ { print "#define "$$1,$$2 } END { print "\n#endif /*CONFIG_H_*/" }' >> $@
224
 
226
 
225
# Display compiler version information.
227
# Display compiler version information.
226
gccversion : 
228
gccversion : 
227
	@$(CC) --version
229
	@$(CC) --version
228
 
230
 
229
# Convert ELF to COFF for use in debugging / simulating in AVR Studio or VMLAB.
231
# Convert ELF to COFF for use in debugging / simulating in AVR Studio or VMLAB.
Line 249... Line 251...
249
 
251
 
250
%.eep: %.elf
252
%.eep: %.elf
251
	@echo $(MSG_EEPROM) $@
253
	@echo $(MSG_EEPROM) $@
252
	-@$(OBJCOPY) -j .eeprom --set-section-flags=.eeprom="alloc,load" \
254
	-@$(OBJCOPY) -j .eeprom --set-section-flags=.eeprom="alloc,load" \
253
	--change-section-lma .eeprom=0 -O ihex $< $@
255
	--change-section-lma .eeprom=0 -O ihex $< $@
254
 
256
 
255
# Create extended listing file from ELF output file.
257
# Create extended listing file from ELF output file.
256
%.lss: %.elf
258
%.lss: %.elf
257
	@echo $(MSG_EXTENDED_LISTING) $@
259
	@echo $(MSG_EXTENDED_LISTING) $@
258
	@$(OBJDUMP) -h -S $< > $@
260
	@$(OBJDUMP) -h -S $< > $@
259
 
261
 
Line 300... Line 302...
300
%.o : %.S
302
%.o : %.S
301
	@echo $(MSG_ASSEMBLING) $<
303
	@echo $(MSG_ASSEMBLING) $<
302
	@$(CC) -c $(ASFLAGS) $< -o $@
304
	@$(CC) -c $(ASFLAGS) $< -o $@
303
 
305
 
304
# Depends: create dependency files from c source files.
306
# Depends: create dependency files from c source files.
305
%.dep : %.c | $(BUILDDIRS)
307
#%.d : %.c | $(BUILDDIRS)
306
	@echo $(MSG_DEPEND) $<
308
#	@echo $(MSG_DEPEND) $<
307
	@$(CC) -c $(CFLAGS) $(GENDEPFLAGS) $<
309
#	@$(CC) -c $(CFLAGS) $(GENDEPFLAGS) $<
308
 
310
 
309
# Buildtree: create directories for output files.
311
# Buildtree: create directories for output files.
310
$(BUILDDIRS) :
312
$(BUILDDIRS) :
311
	@echo $(MSG_CREATE) $@
313
	@echo $(MSG_CREATE) $@
312
	@$(MKDIR) -p $@
314
	@$(MKDIR) -p $@
Line 326... Line 328...
326
	$(RM) $(LIBNAME).S
328
	$(RM) $(LIBNAME).S
327
	$(RM) config.h
329
	$(RM) config.h
328
	$(RM) -r drivers
330
	$(RM) -r drivers
329
 
331
 
330
# Include the dependency files.
332
# Include the dependency files.
-
 
333
ifneq ($(MAKECMDGOALS),clean)
-
 
334
ifneq ($(strip $(DEP)),)
331
-include $(DEP)
335
-include $(DEP)
-
 
336
endif
-
 
337
endif
332
 
338
 
333
# Listing of phony targets.
339
# Listing of phony targets.
334
.PHONY : all sizebefore sizeafter build \
340
.PHONY : all sizebefore sizeafter build \
335
elf hex eep lss sym coff extcoff clean \
341
elf hex eep lss sym coff extcoff clean \
336
gccversion lib
342
gccversion lib