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 1... Line 1...
1
# $Id: Makefile 553 2007-07-20 11:47:48Z andfri $
1
# $Id: Makefile 554 2007-07-21 00:36:32Z andfri $
2
PRG            = bios
-
 
3
ASRC           = $(BIOSDIR)/vectors.S
-
 
4
CSRC           = $(BIOSDIR)/bios_export.c $(BIOSDIR)/bios.c $(BIOSDIR)/flash.c
-
 
5
BIOS_VERSION   = 0x1338
2
BIOS_VERSION   = 0x1338
6
OPTIMIZE       = -Os -mcall-prologues
-
 
7
LIBNAME        = libbios
-
 
8
BIOSDIR        = bios
-
 
9
TEMPLATEDIR    = template
-
 
10
 
3
 
-
 
4
# Paths: set default pathnames if they are not
-
 
5
# passed on from parent Makefile.
-
 
6
ifndef TARGET
-
 
7
TARGET = bios
-
 
8
endif
11
include config.inc
9
ifndef LIBDIR
-
 
10
LIBDIR = .
-
 
11
endif
-
 
12
ifndef SRCDIR
-
 
13
SRCDIR = bios
-
 
14
endif
-
 
15
ifndef CFGDIR
-
 
16
CFGDIR = ..
-
 
17
endif
-
 
18
LIBNAME = lib$(TARGET)
-
 
19
 
12
include system.inc
20
include $(CFGDIR)/bios.inc
-
 
21
 
-
 
22
# VPATH: setup search path for source files.
-
 
23
vpath
-
 
24
vpath %.c $(SRCDIR):$(LIBDIR)
-
 
25
vpath %.S $(SRCDIR):$(LIBDIR)
13
 
26
 
14
DEFS           = -DF_CPU=$(F_CPU) -DCAN_DRIVER_H=$(CAN_DRIVER_H) -DBIOS_VERSION=$(BIOS_VERSION) -I. -I$(BIOSDIR)
27
# List source files here. (C dependencies are automatically generated.)
15
LIBS           =
28
SOURCES =	vectors.S \
-
 
29
			bios_export.c \
-
 
30
			bios.c \
-
 
31
			flash.c
16
 
32
 
17
ifeq ($(CAN_CONTROLLER),MCP2515)
33
ifeq ($(CAN_CONTROLLER),MCP2515)
18
CSRC += drivers/can/mcp2515/mcp2515.c
34
SOURCES += drivers/can/mcp2515/mcp2515.c
19
CAN_DRIVER_H = \<drivers/can/mcp2515/mcp2515.h\>
35
CAN_DRIVER_H = \<drivers/can/mcp2515/mcp2515.h\>
20
endif
36
endif
21
 
37
 
-
 
38
# Start address for linking pass 1, will be overridden for optimizing pass
-
 
39
#BIOS_START = 0x100
-
 
40
 
-
 
41
# Optimization level, can be [0, 1, 2, 3, s]. 
-
 
42
# 0 = turn off optimization. s = optimize for size.
-
 
43
# (Note: 3 is not always the best optimization level. See avr-libc FAQ.)
-
 
44
OPT = s
-
 
45
#OPT = 3
-
 
46
 
-
 
47
# Debugging format.
-
 
48
# Native formats for AVR-GCC's -g are stabs [default], or dwarf-2.
-
 
49
# AVR (extended) COFF requires stabs, plus an avr-objcopy run.
-
 
50
DEBUG = stabs
-
 
51
#DEBUG = dwarf-2
-
 
52
 
-
 
53
# List any extra directories to look for include files here.
-
 
54
# Each directory must be separated by a space.
22
OBJ = $(ASRC:.S=.o) $(CSRC:.c=.o)
55
EXTRAINCDIRS = $(LIBDIR) $(SRCDIR)
-
 
56
 
-
 
57
# Compiler flag to set the C Standard level.
-
 
58
# c89   - "ANSI" C
-
 
59
# gnu89 - c89 plus GCC extensions
-
 
60
# c99   - ISO C99 standard (not yet fully implemented)
-
 
61
# gnu99 - c99 plus GCC extensions
-
 
62
CSTANDARD = -std=gnu99
-
 
63
 
-
 
64
# Place -D or -U options here
-
 
65
CDEFS = -DF_CPU=$(F_CPU) \
-
 
66
		-DCAN_DRIVER_H=$(CAN_DRIVER_H) \
-
 
67
		-DBIOS_VERSION=$(BIOS_VERSION)
-
 
68
 
-
 
69
# Place -I options here
-
 
70
CINCS =
23
 
71
 
24
#
72
 
-
 
73
# Compiler flags.
25
# You should not have to change anything below here.
74
#  -g*:          generate debugging information
-
 
75
#  -O*:          optimization level
-
 
76
#  -f...:        tuning, see GCC manual and avr-libc documentation
-
 
77
#  -Wall...:     warning level
-
 
78
#  -Wa,...:      tell GCC to pass this to the assembler.
-
 
79
#    -adhlns...: create assembler listing
-
 
80
CFLAGS = -mmcu=$(MCU) -I.
-
 
81
CFLAGS += -g$(DEBUG)
-
 
82
CFLAGS += $(CDEFS) $(CINCS)
-
 
83
CFLAGS += -O$(OPT)
-
 
84
CFLAGS += -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums
-
 
85
CFLAGS += -Wall -Wstrict-prototypes
-
 
86
CFLAGS += -Wa,-adhlns=$(@:.o=.lst)
-
 
87
CFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
-
 
88
CFLAGS += $(CSTANDARD)
-
 
89
 
26
#
90
 
27
 
91
 
-
 
92
# Assembler flags.
-
 
93
#  -Wa,...:   tell GCC to pass this to the assembler.
28
CC             = avr-gcc
94
#  -ahlms:    create listing
-
 
95
#  -gstabs:   have the assembler create line number information; note that
-
 
96
#             for use in COFF files, additional information about filenames
-
 
97
#             and function names needs to be present in the assembler source
-
 
98
#             files -- see avr-libc docs [FIXME: not yet described there]
-
 
99
##ASFLAGS = -Wa,-adhlns=$(<:.S=.lst),-gstabs 
-
 
100
ASFLAGS = -mmcu=$(MCU) -x assembler-with-cpp
-
 
101
ASFLAGS += -Wa,-g$(DEBUG)
-
 
102
 
-
 
103
 
29
AWK            = awk
104
#Additional libraries.
-
 
105
 
-
 
106
# Minimalistic printf version
-
 
107
PRINTF_LIB_MIN = -Wl,-u,vfprintf -lprintf_min
-
 
108
 
-
 
109
# Floating point printf version (requires MATH_LIB = -lm below)
-
 
110
PRINTF_LIB_FLOAT = -Wl,-u,vfprintf -lprintf_flt
-
 
111
 
-
 
112
PRINTF_LIB = 
-
 
113
 
-
 
114
# Minimalistic scanf version
-
 
115
SCANF_LIB_MIN = -Wl,-u,vfscanf -lscanf_min
-
 
116
 
-
 
117
# Floating point + %[ scanf version (requires MATH_LIB = -lm below)
-
 
118
SCANF_LIB_FLOAT = -Wl,-u,vfscanf -lscanf_flt
-
 
119
 
-
 
120
SCANF_LIB = 
-
 
121
 
-
 
122
MATH_LIB = -lm
-
 
123
 
-
 
124
# External memory options
-
 
125
 
-
 
126
# 64 KB of external RAM, starting after internal RAM (ATmega128!),
-
 
127
# used for variables (.data/.bss) and heap (malloc()).
-
 
128
#EXTMEMOPTS = -Wl,-Tdata=0x801100,--defsym=__heap_end=0x80ffff
-
 
129
 
-
 
130
# 64 KB of external RAM, starting after internal RAM (ATmega128!),
-
 
131
# only used for heap (malloc()).
-
 
132
#EXTMEMOPTS = -Wl,--defsym=__heap_start=0x801100,--defsym=__heap_end=0x80ffff
-
 
133
 
-
 
134
EXTMEMOPTS =
30
 
135
 
-
 
136
BIOS_START = $(shell $(AWK) '/0x[0-9a-f]+.*__bios_optimal_start/ { print $$1 }' bios.map)
-
 
137
BIOSOPTS = -Wl,--defsym,__bios_start=$(BIOS_START),--defsym,__boot_start=$(BOOT_START),-T$(LIBDIR)/ldscripts/$(MCU).ld
-
 
138
 
-
 
139
# Linker flags.
31
# Override is only needed by avr-lib build system.
140
#  -Wl,...:     tell GCC to pass this to linker.
-
 
141
#    -Map:      create map file
-
 
142
#    --cref:    add cross reference to  map file
-
 
143
LDFLAGS = -Wl,-Map=$(TARGET).map,--cref
-
 
144
LDFLAGS += $(EXTMEMOPTS)
-
 
145
LDFLAGS += $(BIOSOPTS)
-
 
146
LDFLAGS += $(PRINTF_LIB) $(SCANF_LIB) $(MATH_LIB)
32
 
147
 
33
override CFLAGS        = -g -Wall $(OPTIMIZE) -mmcu=$(MCU) $(DEFS)
-
 
34
override LDFLAGS       = -Wl,-Map,$(PRG).map,--defsym,__bios_start=$(BIOS_START),--defsym,__boot_start=$(BOOT_START),-Tldscripts/$(MCU).ld,--cref
-
 
35
override ASFLAGS       = -x assembler-with-cpp -Wa,-gstabs -mmcu=$(MCU) $(DEFS)
148
# ---------------------------------------------------------------------------
36
 
-
 
37
# Start address for linking pass 1, will be overridden for optimizing pass
-
 
38
BIOS_START = 0x100
-
 
39
 
149
 
-
 
150
# Define programs and commands.
-
 
151
SHELL = sh
-
 
152
CC = avr-gcc
-
 
153
AWK = awk
40
OBJCOPY        = avr-objcopy
154
OBJCOPY = avr-objcopy
41
OBJDUMP        = avr-objdump
155
OBJDUMP = avr-objdump
42
SIZE           = avr-size
156
SIZE = avr-size
-
 
157
NM = avr-nm
-
 
158
RM = rm -f
-
 
159
CP = cp
43
SZFLAGS        = 
160
MKDIR = mkdir
-
 
161
 
44
 
162
 
-
 
163
 
45
.PHONY: default
164
# Define Messages
-
 
165
# English
-
 
166
MSG_ERRORS_NONE = Errors: none
-
 
167
MSG_BEGIN = -------- begin --------
46
default: hex template lst cleanintermediate
168
MSG_END = --------  end  --------
47
	@$(SIZE) $(SZFLAGS) $(PRG).elf
169
MSG_SIZE_BEFORE = Size before: 
-
 
170
MSG_SIZE_AFTER = Size after:
-
 
171
MSG_COFF = Converting to AVR COFF:
-
 
172
MSG_EXTENDED_COFF = Converting to AVR Extended COFF:
-
 
173
MSG_FLASH = Creating load file for Flash:
-
 
174
MSG_EEPROM = Creating load file for EEPROM:
-
 
175
MSG_EXTENDED_LISTING = Creating Extended Listing:
-
 
176
MSG_SYMBOL_TABLE = Creating Symbol Table:
-
 
177
MSG_LINKING = Linking:
-
 
178
MSG_COMPILING = Compiling:
-
 
179
MSG_ASSEMBLING = Assembling:
-
 
180
MSG_DEPEND = Generating dependencies:
-
 
181
MSG_CLEANING = Cleaning project:
-
 
182
MSG_CREATE = Creating:
48
 
183
 
49
#include $(CSRC:.c=.d)
184
# Define all object files.
-
 
185
OBJ = $(filter %.o,$(SOURCES:.c=.o) $(SOURCES:.S=.o))
50
 
186
 
51
.PHONY: all
187
# Define all listing files.
52
all: $(PRG).elf lst hex eeprom template
188
LST = $(OBJ:.o=.lst)
53
 
189
 
54
$(PRG)_pass1.elf: $(BIOSDIR)/config.h $(OBJ)
190
# Define all dependency files.
-
 
191
DEP = $(OBJ:.o=.dep)
-
 
192
 
55
	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS)
193
BUILDDIRS = $(sort $(filter-out ./,$(dir $(OBJ))))
56
 
194
 
57
# Get old node config and build new bios "make update NODE_ID=0x01"
195
# Compiler flags to generate dependency files.
58
# this is now done in two steps, first make oldconfig and then make update
196
### GENDEPFLAGS = -Wp,-M,-MP,-MT,$(*F).o,-MF,.dep/$(@F).d
59
# this due to re-reading the configfile
197
GENDEPFLAGS = -M -MG -MP -MT "$(@:.dep=.o) $@" -MF $@
-
 
198
 
-
 
199
# Default target.
60
.PHONY: update oldconfig move updateconfig
200
all: sizebefore build lib sizeafter
-
 
201
 
61
update: clean all updateconfig
202
build: elf hex eep lss sym
62
 
203
 
63
# Move config from a node-folder to avr-lib dir to be able to compile a new version of bios
204
elf: $(TARGET).elf
64
# this removes the lines starting with BIOS_RAM_END and BIOS_VERSION becasue they are added in make template
-
 
65
oldconfig:
205
hex: $(TARGET).hex
66
	cp config.inc config.old
206
eep: $(TARGET).eep
67
	@$(AWK) '!/^BIOS_RAM_END*/ && !/^BIOS_VERSION*/ { print }' $(PERSONALDIR)/*$(NODE_ID)*/$(BIOSDIR)/bios.inc > config.inc
207
lss: $(TARGET).lss 
68
#	- cp $(PERSONALDIR)/*$(NODE_ID)*/bios.inc config.inc
208
sym: $(TARGET).sym
69
 
209
 
70
# Copy template to personal dir
210
# Display size of file.
71
move: template
211
HEXSIZE = $(SIZE) --target=ihex $(TARGET).hex
72
	- mkdir -p $(PERSONALDIR)/$(NODE_ID)_$(HW_NAME)/$(BIOSDIR)
212
ELFSIZE = $(SIZE) $(TARGET).elf
-
 
213
sizebefore:
73
	- cp $(TEMPLATEDIR)/$(BIOSDIR)/* $(PERSONALDIR)/$(NODE_ID)_$(HW_NAME)/$(BIOSDIR)
214
	@if [ -f $(TARGET).elf ]; then echo; echo $(MSG_SIZE_BEFORE); $(ELFSIZE); echo; fi
-
 
215
 
-
 
216
sizeafter:
74
	- cp $(TEMPLATEDIR)/Makefile $(PERSONALDIR)/$(NODE_ID)_$(HW_NAME)
217
	@if [ -f $(TARGET).elf ]; then echo; echo $(MSG_SIZE_AFTER); $(ELFSIZE); echo; fi
75
 
218
 
76
# Copy template to personal dir but dont copy makefile and main.c as you dont want these files replaced generally 
219
# Generate config.h from bios.inc
-
 
220
config.h: $(CFGDIR)/bios.inc
77
updateconfig: template
221
	@echo Generating $@
78
	- cp $(TEMPLATEDIR)/$(BIOSDIR)/* $(TEMPLATEDIR)/Makefile $(PERSONALDIR)/$(NODE_ID)_*/
222
	@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_*/" }' >> $@
79
 
224
 
-
 
225
# Display compiler version information.
-
 
226
gccversion : 
-
 
227
	@$(CC) --version
80
 
228
 
-
 
229
# Convert ELF to COFF for use in debugging / simulating in AVR Studio or VMLAB.
-
 
230
COFFCONVERT=$(OBJCOPY) --debugging \
81
.PHONY: clean cleanintermediate cleantemplate distclean
231
--change-section-address .data-0x800000 \
-
 
232
--change-section-address .bss-0x800000 \
82
clean: cleanintermediate cleantemplate
233
--change-section-address .noinit-0x800000 \
83
	-rm -f $(PRG).elf $(PRG).lst $(PRG).map *.hex
234
--change-section-address .eeprom-0x810000 
-
 
235
 
84
 
236
 
85
cleanintermediate:
237
coff: $(TARGET).elf
-
 
238
	@echo $(MSG_COFF) $(TARGET).cof
86
	-rm -f $(OBJ) $(LIBNAME).[So] *.d $(BIOSDIR)/config.h
239
	@$(COFFCONVERT) -O coff-avr $< $(TARGET).cof
87
 
240
 
88
cleantemplate:
241
extcoff: $(TARGET).elf
89
	-rm -f $(TEMPLATEDIR)/$(BIOSDIR)/*
242
	@echo $(MSG_EXTENDED_COFF) $(TARGET).cof
-
 
243
	@$(COFFCONVERT) -O coff-ext-avr $< $(TARGET).cof
90
 
244
 
-
 
245
# Create final output files (.hex, .eep) from ELF output file.
91
distclean:
246
%.hex: %.elf
92
	@echo Cleaning: template
247
	@echo $(MSG_FLASH) $@
93
	$(MAKE) -C template distclean
248
	@$(OBJCOPY) -j .text -j .data -O ihex $< $@
94
	@echo Cleaning: bios
-
 
95
	$(MAKE) clean
-
 
96
 
249
 
97
.PHONY: lst
250
%.eep: %.elf
98
lst:  $(PRG).lst
251
	@echo $(MSG_EEPROM) $@
-
 
252
	-@$(OBJCOPY) -j .eeprom --set-section-flags=.eeprom="alloc,load" \
-
 
253
	--change-section-lma .eeprom=0 -O ihex $< $@
99
 
254
 
-
 
255
# Create extended listing file from ELF output file.
100
%.lst: %.elf
256
%.lss: %.elf
-
 
257
	@echo $(MSG_EXTENDED_LISTING) $@
101
	$(OBJDUMP) -h -S $< > $@
258
	@$(OBJDUMP) -h -S $< > $@
102
 
259
 
103
$(PRG).elf: $(PRG)_pass1.elf
260
# Create a symbol table from ELF output file.
104
	@echo Linking pass 2: Optimizing flash usage
261
%.sym: %.elf
105
	@rm -f $(PRG)_pass1.elf
262
	@echo $(MSG_SYMBOL_TABLE) $@
106
	@$(MAKE) BIOS_START=$(shell $(AWK) '/0x[0-9a-f]+.*__bios_optimal_start/ { print $$1 }' bios.map) $(PRG)_pass1.elf
-
 
107
	@mv $(PRG)_pass1.elf $(PRG).elf
263
	@$(NM) -n $< > $@
108
 
264
 
-
 
265
# Link: create ELF output file from object files.
109
$(LIBNAME).S: $(PRG).elf
266
.SECONDARY : $(TARGET).elf
-
 
267
#.PRECIOUS : $(OBJ)
-
 
268
$(TARGET)_pass1.elf: override BIOS_START=0x100
-
 
269
$(TARGET)_pass1.elf: config.h $(OBJ)
110
	@echo Generating $@
270
	@echo Linking pass 1:
111
	@$(AWK) '$$1 ~ /0x[0-9a-f]+/ && /BIOS_/ { print "\t.set "$$2","$$1"\n\t.global "$$2 }' $(PRG).map > $@
271
	@$(CC) $(LDFLAGS) -o $@ $(filter %.o,$^) $(LIBS)
112
 
272
 
113
$(BIOSDIR)/config.h: config.inc
273
$(TARGET).elf: config.h $(OBJ) | $(TARGET)_pass1.elf
114
	@echo Generating $@
274
	@echo Linking pass 2: Optimizing flash usage
115
	@$(AWK) 'BEGIN { FS="="; print "#ifndef CONFIG_H_\n#define CONFIG_H_\n" } /^[^#].*=.*/ { print "#define "$$1,$$2 } END { print "#endif" }' $< > $@
275
	@$(CC) $(LDFLAGS) -o $@ $(filter %.o,$^) $(LIBS)
116
 
276
 
117
$(TEMPLATEDIR)/$(BIOSDIR)/bios.inc: config.inc $(PRG).elf
277
$(LIBNAME).S: $(TARGET).elf
118
	@echo Generating $@
278
	@echo Generating $@
119
	@echo "# This file is automatically generated. Do not edit." > $@
-
 
120
	@$(AWK) '/^[^#].*=.*/ { print $$0 }' config.inc >> $@
-
 
121
	@$(AWK) '/0x[0-9a-f]+.*__bios_ram_end/ { print "BIOS_RAM_END="$$1 }' bios.map >> $@
279
	@$(AWK) '$$1 ~ /0x[0-9a-f]+/ && /BIOS_/ { print "\t.set "$$2","$$1"\n\t.global "$$2 }' $(TARGET).map > $@
122
	@echo "BIOS_VERSION=$(BIOS_VERSION)" >> $@
-
 
123
 
280
 
124
$(TEMPLATEDIR)/$(BIOSDIR)/bios.h: drivers/can/can.h $(BIOSDIR)/bios_export.h
281
bios.h: $(LIBDIR)/drivers/can/can.h $(LIBDIR)/bios/bios_export.h
125
	@echo Generating $@
282
	@echo Generating $@
126
	@echo "/* This file is automatically generated. Do not edit. */\n" > $@
283
	@echo "/* This file is automatically generated. Do not edit. */\n" > $@
127
	@echo "#ifndef BIOS_H_\n#define BIOS_H_\n" >> $@
284
	@echo "#ifndef BIOS_H_\n#define BIOS_H_\n" >> $@
128
	@cat $^ >> $@
285
	@cat $^ >> $@
129
	@echo "\n#endif /*BIOS_H_*/" >> $@
286
	@echo "\n#endif /*BIOS_H_*/" >> $@
130
 
287
 
131
.PHONY: template
-
 
132
template: $(TEMPLATEDIR)/$(BIOSDIR)/bios.h $(TEMPLATEDIR)/$(BIOSDIR)/bios.inc $(TEMPLATEDIR)/$(BIOSDIR)/$(LIBNAME).a($(LIBNAME).o)
-
 
133
 
-
 
134
%.d: %.c
-
 
135
	@set -e; rm -f $@; \
-
 
136
	$(CC) -M $(CFLAGS) $< > $@.$$$$; \
288
lib: bios.h $(LIBNAME).a($(LIBNAME).o)
137
	sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \
-
 
138
	rm -f $@.$$$$	
-
 
139
 
-
 
140
# Rules for building the rom images
-
 
141
 
-
 
142
hex:  $(PRG).hex
-
 
143
 
-
 
144
%.hex: %.elf
-
 
145
	$(OBJCOPY) -j .text -j .data -j .bootloader -O ihex $< $@
-
 
146
 
289
 
147
# Rules for uploading rom images to flash
290
# Compile: create object files from C source files.
-
 
291
%.o : %.c
-
 
292
	@echo $(MSG_COMPILING) $<
-
 
293
	@$(CC) -c $(CFLAGS) $< -o $@ 
148
 
294
 
-
 
295
# Compile: create assembler files from C source files.
149
install: hex
296
%.s : %.c
150
	$(UPLOAD) $(ULFLAGS)
297
	@$(CC) -S $(CFLAGS) $< -o $@
151
 
298
 
152
# Update bios over can, get config from old node config and build new bios "make reinstall NODE_ID=0x01"
-
 
153
# this is now done in two steps, first make oldconfig and then make reinstall
299
# Assemble: create object files from assembler source files.
154
# this due to re-reading the configfile
-
 
155
reinstall: update
300
%.o : %.S
156
#next row not needed when using candude
301
	@echo $(MSG_ASSEMBLING) $<
157
#	$(OBJCOPY) -I ihex -O ihex --change-addresses=-$(shell $(AWK) '/0x[0-9a-f]+.*__bios_optimal_start/ { print $$1 }' bios.map) bios.hex bios_offset.hex
-
 
158
	$(CANUPLOAD) $(CANULFLAGS) -n $(NODE_ID) -f $(PRG).hex -r -b
302
	@$(CC) -c $(ASFLAGS) $< -o $@
159
 
303
 
160
# Rules for building the eeprom images
304
# Depends: create dependency files from c source files.
-
 
305
%.dep : %.c | $(BUILDDIRS)
-
 
306
	@echo $(MSG_DEPEND) $<
-
 
307
	@$(CC) -c $(CFLAGS) $(GENDEPFLAGS) $<
161
 
308
 
-
 
309
# Buildtree: create directories for output files.
162
eeprom: ehex
310
$(BUILDDIRS) :
-
 
311
	@echo $(MSG_CREATE) $@
-
 
312
	@$(MKDIR) -p $@
163
 
313
 
-
 
314
# Target: clean project.
-
 
315
clean: 
-
 
316
	@echo $(MSG_CLEANING)
-
 
317
	$(RM) $(TARGET).eep
-
 
318
	$(RM) $(TARGET).cof
164
ehex:  $(PRG)_eeprom.hex
319
	$(RM) $(TARGET)_pass1.elf
-
 
320
	$(RM) $(TARGET).elf
-
 
321
	$(RM) $(TARGET).sym
-
 
322
	$(RM) $(TARGET).lss
-
 
323
	$(RM) $(OBJ)
-
 
324
	$(RM) $(DEP)
-
 
325
	$(RM) $(LST)
-
 
326
	$(RM) $(LIBNAME).S
-
 
327
	$(RM) config.h
-
 
328
	$(RM) -r drivers
165
 
329
 
166
%_eeprom.hex: %.elf
330
# Include the dependency files.
167
	$(OBJCOPY) -j .eeprom --change-section-lma .eeprom=0 -O ihex $< $@
331
-include $(DEP)
168
 
332
 
-
 
333
# Listing of phony targets.
-
 
334
.PHONY : all sizebefore sizeafter build \
-
 
335
elf hex eep lss sym coff extcoff clean \
169
.DELETE_ON_ERROR:
336
gccversion lib
170
	
337