Subversion Repositories HomeAutomation

Rev

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

Rev 553 Rev 554
Line 14... Line 14...
14
endif
14
endif
15
ifndef CFGDIR
15
ifndef CFGDIR
16
CFGDIR = ..
16
CFGDIR = ..
17
endif
17
endif
18
 
18
 
19
include $(BIOSDIR)/bios.inc
19
include $(CFGDIR)/bios.inc
20
 
20
 
21
# VPATH: setup search path for source files.
21
# VPATH: setup search path for source files.
22
vpath
22
vpath
23
vpath %.c $(LIBDIR):$(SRCDIR)
23
vpath %.c $(LIBDIR):$(SRCDIR)
24
 
24
 
Line 177... Line 177...
177
 
177
 
178
# Define all dependency files.
178
# Define all dependency files.
179
DEP = $(OBJ:.o=.dep)
179
DEP = $(OBJ:.o=.dep)
180
 
180
 
181
BUILDDIRS = $(sort $(filter-out ./,$(dir $(OBJ))))
181
BUILDDIRS = $(sort $(filter-out ./,$(dir $(OBJ))))
-
 
182
 
-
 
183
BIOS_RAM_END := $(shell $(AWK) '/0x[0-9a-f]+.*__bios_ram_end/ { print $$1 }' $(BIOSDIR)/bios.map)
182
 
184
 
183
# Compiler flags to generate dependency files.
185
# Compiler flags to generate dependency files.
184
### GENDEPFLAGS = -Wp,-M,-MP,-MT,$(*F).o,-MF,.dep/$(@F).d
186
### GENDEPFLAGS = -Wp,-M,-MP,-MT,$(*F).o,-MF,.dep/$(@F).d
185
GENDEPFLAGS = -M -MG -MP -MT "$(@:.d=.o) $@" -MF $@
187
GENDEPFLAGS = -M -MG -MP -MT "$(@:.dep=.o) $@" -MF $@
186
 
188
 
187
# Default target.
189
# Default target.
188
all: sizebefore build sizeafter
190
all: sizebefore config.h build sizeafter
189
 
191
 
190
build: elf hex eep lss sym
192
build: elf hex eep lss sym
191
 
193
 
192
elf: $(TARGET).elf
194
elf: $(TARGET).elf
193
hex: $(TARGET).hex
195
hex: $(TARGET).hex
Line 203... Line 205...
203
 
205
 
204
sizeafter:
206
sizeafter:
205
	@if [ -f $(TARGET).elf ]; then echo; echo $(MSG_SIZE_AFTER); $(ELFSIZE); echo; fi
207
	@if [ -f $(TARGET).elf ]; then echo; echo $(MSG_SIZE_AFTER); $(ELFSIZE); echo; fi
206
 
208
 
207
# Generate config.h from bios.inc and config.inc
209
# Generate config.h from bios.inc and config.inc
208
config.h: $(BIOSDIR)/bios.inc $(CFGDIR)/config.inc
210
config.h: $(CFGDIR)/bios.inc $(CFGDIR)/config.inc
209
	@echo Generating $@
211
	@echo Generating $@
210
	@echo "/* This file is automatically generated. Do not edit. */\n" > $@
212
	@echo "/* This file is automatically generated. Do not edit. */\n" > $@
211
	@cat $^ | $(AWK) 'BEGIN { FS="="; print "#ifndef CONFIG_H_\n#define CONFIG_H_\n" } /^[^#].*=.*/ { print "#define "$$1,$$2 } END { print "\n#endif /*CONFIG_H_*/" }' >> $@
213
	@cat $^ | $(AWK) 'BEGIN { FS="="; print "#ifndef CONFIG_H_\n#define CONFIG_H_\n" } /^[^#].*=.*/ { print "#define "$$1,$$2 } END { print "\n#endif /*CONFIG_H_*/" }' >> $@
212
 
214
 
213
$(CFGDIR)/config.inc: $(SRCDIR)/config.inc.template
215
$(CFGDIR)/config.inc: $(SRCDIR)/config.inc.template
Line 238... Line 240...
238
	@echo $(MSG_FLASH) $@
240
	@echo $(MSG_FLASH) $@
239
	@$(OBJCOPY) -j .text -j .data -O ihex $< $@
241
	@$(OBJCOPY) -j .text -j .data -O ihex $< $@
240
 
242
 
241
%.eep: %.elf
243
%.eep: %.elf
242
	@echo $(MSG_EEPROM) $@
244
	@echo $(MSG_EEPROM) $@
243
	-$(OBJCOPY) -j .eeprom --set-section-flags=.eeprom="alloc,load" \
245
	-@$(OBJCOPY) -j .eeprom --set-section-flags=.eeprom="alloc,load" \
244
	--change-section-lma .eeprom=0 -O ihex $< $@
246
	--change-section-lma .eeprom=0 -O ihex $< $@
245
 
247
 
246
# Create extended listing file from ELF output file.
248
# Create extended listing file from ELF output file.
247
%.lss: %.elf
249
%.lss: %.elf
248
	@echo $(MSG_EXTENDED_LISTING) $@
250
	@echo $(MSG_EXTENDED_LISTING) $@