Rev 515 | Rev 621 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | SVN | RSS feed
| Rev 515 | Rev 563 | ||
|---|---|---|---|
| Line 1... | Line 1... | ||
| 1 |
|
1 | # Paths: default pathnames if they are not |
| 2 | - | ||
| 3 | # |
2 | # passed on from parent Makefile. |
| - | 3 | ifndef TARGET |
|
| 4 | TARGET = main |
4 | TARGET = main |
| 5 | 5 | endif |
|
| - | 6 | ifndef LIBDIR |
|
| 6 | LIBDIR = ../../avr-lib |
7 | LIBDIR = ../../../avr-lib |
| - | 8 | endif |
|
| - | 9 | ifndef SRCDIR |
|
| - | 10 | SRCDIR = ../src |
|
| - | 11 | endif |
|
| - | 12 | ifndef BIOSDIR |
|
| - | 13 | BIOSDIR = ../bios |
|
| - | 14 | endif |
|
| - | 15 | ifndef CFGDIR |
|
| - | 16 | CFGDIR = .. |
|
| - | 17 | endif |
|
| - | 18 | ||
| 7 | include $( |
19 | include $(CFGDIR)/bios.inc |
| - | 20 | ||
| - | 21 | # VPATH: setup search path for source files. |
|
| - | 22 | vpath |
|
| - | 23 | vpath %.c $(LIBDIR):$(SRCDIR) |
|
| 8 | 24 | ||
| 9 | # List |
25 | # List source files here. (C dependencies are automatically generated.) |
| 10 |
|
26 | SOURCES = main.c\ |
| 11 |
|
27 | drivers/timer/timebase.c\ |
| 12 |
|
28 | drivers/mcu/mcu.c\ |
| 13 |
|
29 | drivers/sensor/ds18s20/ds18x20.c\ |
| 14 |
|
30 | drivers/sensor/ds18s20/onewire.c\ |
| 15 |
|
31 | drivers/sensor/ds18s20/delay.c\ |
| 16 |
|
32 | drivers/sensor/ds18s20/crc8.c\ |
| 17 | # |
33 | # drivers/sensor/tc1047/tc1047.c\ |
| 18 | # |
34 | # drivers/sensor/ldr/ldr.c\ |
| 19 | - | ||
| 20 | - | ||
| 21 | # List Assembler source files here. |
- | |
| 22 | # Make them always end in a capital .S. Files ending in a lowercase .s |
- | |
| 23 | # will not be considered source files but generated files (assembler |
- | |
| 24 | # output from the compiler), and will be deleted upon "make clean"! |
- | |
| 25 | # Even though the DOS/Win* filesystem matches both .s and .S the same, |
- | |
| 26 | # it will preserve the spelling of the filenames, and gcc itself does |
- | |
| 27 | # care about how the name is spelled on its command-line. |
- | |
| 28 | ASRC = |
- | |
| 29 | - | ||
| 30 | 35 | ||
| 31 | # Optimization level, can be [0, 1, 2, 3, s]. |
36 | # Optimization level, can be [0, 1, 2, 3, s]. |
| 32 | # 0 = turn off optimization. s = optimize for size. |
37 | # 0 = turn off optimization. s = optimize for size. |
| 33 | # (Note: 3 is not always the best optimization level. See avr-libc FAQ.) |
38 | # (Note: 3 is not always the best optimization level. See avr-libc FAQ.) |
| 34 | OPT = s |
39 | OPT = s |
| 35 | #OPT = 3 |
40 | #OPT = 3 |
| Line 39... | Line 44... | ||
| 39 | # AVR (extended) COFF requires stabs, plus an avr-objcopy run. |
44 | # AVR (extended) COFF requires stabs, plus an avr-objcopy run. |
| 40 | DEBUG = stabs |
45 | DEBUG = stabs |
| 41 | #DEBUG = dwarf-2 |
46 | #DEBUG = dwarf-2 |
| 42 | 47 | ||
| 43 | # List any extra directories to look for include files here. |
48 | # List any extra directories to look for include files here. |
| 44 | # Each directory must be |
49 | # Each directory must be separated by a space. |
| 45 | EXTRAINCDIRS = $(LIBDIR) |
50 | EXTRAINCDIRS = $(LIBDIR) $(BIOSDIR) |
| 46 | # $(LIBDIR)/funcdefs\ |
- | |
| 47 | - | ||
| 48 | 51 | ||
| 49 | # Compiler flag to set the C Standard level. |
52 | # Compiler flag to set the C Standard level. |
| 50 | # c89 - "ANSI" C |
53 | # c89 - "ANSI" C |
| 51 | # gnu89 - c89 plus GCC extensions |
54 | # gnu89 - c89 plus GCC extensions |
| 52 | # c99 - ISO C99 standard (not yet fully implemented) |
55 | # c99 - ISO C99 standard (not yet fully implemented) |
| 53 | # gnu99 - c99 plus GCC extensions |
56 | # gnu99 - c99 plus GCC extensions |
| 54 | CSTANDARD = -std=gnu99 |
57 | CSTANDARD = -std=gnu99 |
| 55 | 58 | ||
| 56 | # Place -D or -U options here |
59 | # Place -D or -U options here |
| 57 | CDEFS = |
60 | CDEFS = |
| 58 | 61 | ||
| 59 | # Place -I options here |
62 | # Place -I options here |
| 60 | CINCS = |
63 | CINCS = |
| Line 71... | Line 74... | ||
| 71 | CFLAGS += -g$(DEBUG) |
74 | CFLAGS += -g$(DEBUG) |
| 72 | CFLAGS += $(CDEFS) $(CINCS) |
75 | CFLAGS += $(CDEFS) $(CINCS) |
| 73 | CFLAGS += -O$(OPT) |
76 | CFLAGS += -O$(OPT) |
| 74 | CFLAGS += -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums |
77 | CFLAGS += -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums |
| 75 | CFLAGS += -Wall -Wstrict-prototypes |
78 | CFLAGS += -Wall -Wstrict-prototypes |
| 76 | CFLAGS += -Wa,-adhlns=$( |
79 | CFLAGS += -Wa,-adhlns=$(@:.o=.lst) |
| 77 | CFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS)) |
80 | CFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS)) |
| 78 | CFLAGS += $(CSTANDARD) |
81 | CFLAGS += $(CSTANDARD) |
| 79 | CFLAGS += |
82 | CFLAGS += $(GENDEPFLAGS) |
| 80 | 83 | ||
| 81 | 84 | ||
| 82 | 85 | ||
| 83 | # Assembler flags. |
86 | # Assembler flags. |
| 84 | # -Wa,...: tell GCC to pass this to the assembler. |
87 | # -Wa,...: tell GCC to pass this to the assembler. |
| Line 87... | Line 90... | ||
| 87 | # for use in COFF files, additional information about filenames |
90 | # for use in COFF files, additional information about filenames |
| 88 | # and function names needs to be present in the assembler source |
91 | # and function names needs to be present in the assembler source |
| 89 | # files -- see avr-libc docs [FIXME: not yet described there] |
92 | # files -- see avr-libc docs [FIXME: not yet described there] |
| 90 | ##ASFLAGS = -Wa,-adhlns=$(<:.S=.lst),-gstabs |
93 | ##ASFLAGS = -Wa,-adhlns=$(<:.S=.lst),-gstabs |
| 91 | ASFLAGS = -mmcu=$(MCU) -I. -x assembler-with-cpp |
94 | ASFLAGS = -mmcu=$(MCU) -I. -x assembler-with-cpp |
| 92 | ASFLAGS += -Wa,-adhlns=$( |
95 | ASFLAGS += -Wa,-adhlns=$(@:.o=.lst),-g$(DEBUG) |
| 93 | 96 | ||
| 94 | 97 | ||
| 95 | #Additional libraries. |
98 | #Additional libraries. |
| 96 | 99 | ||
| 97 | # Minimalistic printf version |
100 | # Minimalistic printf version |
| Line 122... | Line 125... | ||
| 122 | # only used for heap (malloc()). |
125 | # only used for heap (malloc()). |
| 123 | #EXTMEMOPTS = -Wl,--defsym=__heap_start=0x801100,--defsym=__heap_end=0x80ffff |
126 | #EXTMEMOPTS = -Wl,--defsym=__heap_start=0x801100,--defsym=__heap_end=0x80ffff |
| 124 | 127 | ||
| 125 | EXTMEMOPTS = |
128 | EXTMEMOPTS = |
| 126 | 129 | ||
| 127 | BIOSOPTS = -Wl,- |
130 | BIOSOPTS = -Wl,-L$(BIOSDIR),-Tdata,$(BIOS_RAM_END) -lbios |
| 128 | 131 | ||
| 129 | # Linker flags. |
132 | # Linker flags. |
| 130 | # -Wl,...: tell GCC to pass this to linker. |
133 | # -Wl,...: tell GCC to pass this to linker. |
| 131 | # -Map: create map file |
134 | # -Map: create map file |
| 132 | # --cref: add cross reference to map file |
135 | # --cref: add cross reference to map file |
| Line 134... | Line 137... | ||
| 134 | LDFLAGS += $(EXTMEMOPTS) |
137 | LDFLAGS += $(EXTMEMOPTS) |
| 135 | LDFLAGS += $(BIOSOPTS) |
138 | LDFLAGS += $(BIOSOPTS) |
| 136 | LDFLAGS += $(PRINTF_LIB) $(SCANF_LIB) $(MATH_LIB) |
139 | LDFLAGS += $(PRINTF_LIB) $(SCANF_LIB) $(MATH_LIB) |
| 137 | 140 | ||
| 138 | # --------------------------------------------------------------------------- |
141 | # --------------------------------------------------------------------------- |
| 139 | - | ||
| 140 | # Define directories, if needed. |
- | |
| 141 | DIRAVR = c:/progra~1/winavr |
- | |
| 142 | DIRAVRBIN = $(DIRAVR)/bin |
- | |
| 143 | DIRAVRUTILS = $(DIRAVR)/utils/bin |
- | |
| 144 | DIRINC = . |
- | |
| 145 | DIRLIB = $(DIRAVR)/avr/lib |
- | |
| 146 | - | ||
| 147 | 142 | ||
| 148 | # Define programs and commands. |
143 | # Define programs and commands. |
| 149 | SHELL = sh |
144 | SHELL = sh |
| 150 | CC = avr-gcc |
145 | CC = avr-gcc |
| - | 146 | AWK = awk |
|
| 151 | OBJCOPY = avr-objcopy |
147 | OBJCOPY = avr-objcopy |
| 152 | OBJDUMP = avr-objdump |
148 | OBJDUMP = avr-objdump |
| 153 | SIZE = avr-size |
149 | SIZE = avr-size |
| 154 | NM = avr-nm |
150 | NM = avr-nm |
| 155 |
|
151 | RM = rm -f |
| 156 |
|
152 | CP = cp |
| 157 | 153 | MKDIR = mkdir |
|
| 158 | 154 | ||
| 159 | 155 | ||
| 160 | 156 | ||
| 161 | # Define Messages |
157 | # Define Messages |
| 162 | # English |
158 | # English |
| 163 | MSG_ERRORS_NONE = Errors: none |
159 | MSG_ERRORS_NONE = Errors: none |
| 164 | MSG_BEGIN = -------- begin -------- |
160 | MSG_BEGIN = -------- begin -------- |
| 165 | MSG_END = -------- end -------- |
161 | MSG_END = -------- end -------- |
| Line 174... | Line 170... | ||
| 174 | MSG_LINKING = Linking: |
170 | MSG_LINKING = Linking: |
| 175 | MSG_COMPILING = Compiling: |
171 | MSG_COMPILING = Compiling: |
| 176 | MSG_ASSEMBLING = Assembling: |
172 | MSG_ASSEMBLING = Assembling: |
| 177 | MSG_DEPEND = Generating dependencies: |
173 | MSG_DEPEND = Generating dependencies: |
| 178 | MSG_CLEANING = Cleaning project: |
174 | MSG_CLEANING = Cleaning project: |
| - | 175 | MSG_CREATE = Creating: |
|
| 179 | 176 | ||
| 180 | - | ||
| 181 | - | ||
| 182 | - | ||
| 183 | # Define all object files. |
177 | # Define all object files. |
| 184 | OBJ = $( |
178 | OBJ = $(filter %.o,$(SOURCES:.c=.o) $(SOURCES:.S=.o)) |
| 185 | 179 | ||
| 186 | # Define all listing files. |
180 | # Define all listing files. |
| 187 | LST = $( |
181 | LST = $(OBJ:.o=.lst) |
| 188 | - | ||
| 189 | - | ||
| 190 | # Compiler flags to generate dependency files. |
- | |
| 191 | ### GENDEPFLAGS = -Wp,-M,-MP,-MT,$(*F).o,-MF,.dep/$(@F).d |
- | |
| 192 | GENDEPFLAGS = -M -MG -MP -MT "$(<:.c=.o) $@" -MF $@ |
- | |
| 193 | - | ||
| 194 | # Combine all necessary flags and optional flags. |
- | |
| 195 | # Add target processor to flags. |
- | |
| 196 | #ALL_CFLAGS = -mmcu=$(MCU) -I. $(CFLAGS) |
- | |
| 197 | #ALL_ASFLAGS = -mmcu=$(MCU) -I. -x assembler-with-cpp $(ASFLAGS) |
- | |
| 198 | - | ||
| 199 | 182 | ||
| - | 183 | # Define all dependency files. |
|
| - | 184 | DEP = $(OBJ:.o=.d) |
|
| 200 | 185 | ||
| - | 186 | BUILDDIRS = $(sort $(filter-out ./,$(dir $(OBJ)))) |
|
| 201 | 187 | ||
| - | 188 | BIOS_RAM_END := $(shell $(AWK) '/0x[0-9a-f]+.*__bios_ram_end/ { print $$1 }' $(BIOSDIR)/bios.map) |
|
| - | 189 | ||
| - | 190 | # Compiler flags to generate dependency files. |
|
| - | 191 | GENDEPFLAGS = -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" |
|
| 202 | 192 | ||
| 203 | # Default target. |
193 | # Default target. |
| 204 | all: |
194 | all: sizebefore buildtree config.h build sizeafter |
| 205 | 195 | ||
| 206 | build: elf hex eep lss sym |
196 | build: elf hex eep lss sym |
| 207 | 197 | ||
| 208 | elf: $(TARGET).elf |
198 | elf: $(TARGET).elf |
| 209 | hex: $(TARGET).hex |
199 | hex: $(TARGET).hex |
| 210 | eep: $(TARGET).eep |
200 | eep: $(TARGET).eep |
| 211 | lss: $(TARGET).lss |
201 | lss: $(TARGET).lss |
| 212 | sym: $(TARGET).sym |
202 | sym: $(TARGET).sym |
| 213 | config: config.h |
- | |
| 214 | - | ||
| 215 | install: hex |
- | |
| 216 | $(CANUPLOAD) $(CANULFLAGS) -n $(NODE_ID) -f $(TARGET).hex -r |
- | |
| 217 | - | ||
| 218 | reset: |
- | |
| 219 | $(CANUPLOAD) $(CANULFLAGS) -n $(NODE_ID) -r |
- | |
| 220 | - | ||
| 221 | start: |
- | |
| 222 | $(CANUPLOAD) $(CANULFLAGS) -n $(NODE_ID) -s |
- | |
| 223 | - | ||
| 224 | # Eye candy. |
- | |
| 225 | # AVR Studio 3.x does not check make's exit code but relies on |
- | |
| 226 | # the following magic strings to be generated by the compile job. |
- | |
| 227 | begin: |
- | |
| 228 | @echo |
- | |
| 229 | @echo $(MSG_BEGIN) |
- | |
| 230 | - | ||
| 231 | finished: |
- | |
| 232 | @echo $(MSG_ERRORS_NONE) |
- | |
| 233 | - | ||
| 234 | end: |
- | |
| 235 | @echo $(MSG_END) |
- | |
| 236 | @echo |
- | |
| 237 | 203 | ||
| - | 204 | buildtree: $(BUILDDIRS) |
|
| 238 | 205 | ||
| 239 | # Display size of file. |
206 | # Display size of file. |
| 240 | HEXSIZE = $(SIZE) --target=ihex $(TARGET).hex |
207 | HEXSIZE = $(SIZE) --target=ihex $(TARGET).hex |
| 241 | ELFSIZE = $(SIZE) $(TARGET).elf |
208 | ELFSIZE = $(SIZE) $(TARGET).elf |
| 242 | sizebefore: |
209 | sizebefore: |
| 243 | @if [ -f $(TARGET).elf ]; then echo; echo $(MSG_SIZE_BEFORE); $(ELFSIZE); echo; fi |
210 | @if [ -f $(TARGET).elf ]; then echo; echo $(MSG_SIZE_BEFORE); $(ELFSIZE); echo; fi |
| 244 | 211 | ||
| 245 | sizeafter: |
212 | sizeafter: |
| 246 | @if [ -f $(TARGET).elf ]; then echo; echo $(MSG_SIZE_AFTER); $(ELFSIZE); echo; fi |
213 | @if [ -f $(TARGET).elf ]; then echo; echo $(MSG_SIZE_AFTER); $(ELFSIZE); echo; fi |
| 247 | - | ||
| 248 | 214 | ||
| 249 | # Generate config.h from bios.inc and config.inc |
215 | # Generate config.h from bios.inc and config.inc |
| 250 | config.h: bios.inc config.inc |
216 | config.h: $(CFGDIR)/bios.inc $(CFGDIR)/config.inc |
| 251 | @echo Generating $@ |
217 | @echo Generating $@ |
| 252 | @echo "/* This file is automatically generated. Do not edit. */\n" > $@ |
218 | @echo "/* This file is automatically generated. Do not edit. */\n" > $@ |
| 253 | @cat $^ | |
219 | @cat $^ | $(AWK) 'BEGIN { FS="="; print "#ifndef CONFIG_H_\n#define CONFIG_H_\n" } /^[^#].*=.*/ { print "#define "$$1,$$2 } END { print "\n#endif /*CONFIG_H_*/" }' >> $@ |
| - | 220 | ||
| - | 221 | $(CFGDIR)/config.inc: $(SRCDIR)/config.inc.template |
|
| - | 222 | @if [ ! -f $@ ]; then cp $< $@; fi |
|
| 254 | 223 | ||
| 255 | # Display compiler version information. |
224 | # Display compiler version information. |
| 256 | gccversion : |
225 | gccversion : |
| 257 | @$(CC) --version |
226 | @$(CC) --version |
| 258 | 227 | ||
| Line 263... | Line 232... | ||
| 263 | --change-section-address .noinit-0x800000 \ |
232 | --change-section-address .noinit-0x800000 \ |
| 264 | --change-section-address .eeprom-0x810000 |
233 | --change-section-address .eeprom-0x810000 |
| 265 | 234 | ||
| 266 | 235 | ||
| 267 | coff: $(TARGET).elf |
236 | coff: $(TARGET).elf |
| 268 | @echo |
- | |
| 269 | @echo $(MSG_COFF) $(TARGET).cof |
237 | @echo $(MSG_COFF) $(TARGET).cof |
| 270 |
|
238 | @$(COFFCONVERT) -O coff-avr $< $(TARGET).cof |
| 271 | - | ||
| 272 | 239 | ||
| 273 | extcoff: $(TARGET).elf |
240 | extcoff: $(TARGET).elf |
| 274 | @echo |
- | |
| 275 | @echo $(MSG_EXTENDED_COFF) $(TARGET).cof |
241 | @echo $(MSG_EXTENDED_COFF) $(TARGET).cof |
| 276 |
|
242 | @$(COFFCONVERT) -O coff-ext-avr $< $(TARGET).cof |
| 277 | - | ||
| 278 | - | ||
| 279 | 243 | ||
| 280 | # Create final output files (.hex, .eep) from ELF output file. |
244 | # Create final output files (.hex, .eep) from ELF output file. |
| 281 | %.hex: %.elf |
245 | %.hex: %.elf |
| 282 | @echo |
- | |
| 283 | @echo $(MSG_FLASH) $@ |
246 | @echo $(MSG_FLASH) $@ |
| 284 |
|
247 | @$(OBJCOPY) -j .text -j .data -O ihex $< $@ |
| 285 | 248 | ||
| 286 | %.eep: %.elf |
249 | %.eep: %.elf |
| 287 | @echo |
- | |
| 288 | @echo $(MSG_EEPROM) $@ |
250 | @echo $(MSG_EEPROM) $@ |
| 289 | - |
251 | -@$(OBJCOPY) -j .eeprom --set-section-flags=.eeprom="alloc,load" \ |
| 290 | --change-section-lma .eeprom=0 -O ihex $< $@ |
252 | --change-section-lma .eeprom=0 -O ihex $< $@ |
| 291 | 253 | ||
| 292 | # Create extended listing file from ELF output file. |
254 | # Create extended listing file from ELF output file. |
| 293 | %.lss: %.elf |
255 | %.lss: %.elf |
| 294 | @echo |
- | |
| 295 | @echo $(MSG_EXTENDED_LISTING) $@ |
256 | @echo $(MSG_EXTENDED_LISTING) $@ |
| 296 |
|
257 | @$(OBJDUMP) -h -S $< > $@ |
| 297 | 258 | ||
| 298 | # Create a symbol table from ELF output file. |
259 | # Create a symbol table from ELF output file. |
| 299 | %.sym: %.elf |
260 | %.sym: %.elf |
| 300 | @echo |
- | |
| 301 | @echo $(MSG_SYMBOL_TABLE) $@ |
261 | @echo $(MSG_SYMBOL_TABLE) $@ |
| 302 |
|
262 | @$(NM) -n $< > $@ |
| 303 | - | ||
| 304 | - | ||
| 305 | 263 | ||
| 306 | # Link: create ELF output file from object files. |
264 | # Link: create ELF output file from object files. |
| 307 | .SECONDARY : $(TARGET).elf |
265 | .SECONDARY : $(TARGET).elf |
| 308 | .PRECIOUS : $(OBJ) |
266 | .PRECIOUS : $(OBJ) |
| 309 | ifneq (,$(filter atmega88 atmega168, $(MCU))) |
267 | ifneq (,$(filter atmega88 atmega168, $(MCU))) |
| 310 | %.elf: $(OBJ) |
268 | %.elf: $(OBJ) |
| 311 | @echo |
- | |
| 312 | @echo $(MSG_LINKING) $@ |
269 | @echo $(MSG_LINKING) $@ |
| 313 | @echo GCC bug workaround for ATmega88/ATmega168: |
270 | @echo GCC bug workaround for ATmega88/ATmega168: |
| 314 |
|
271 | @eval $$($(CC) -v $(CFLAGS) -o $@ $^ $(LDFLAGS) 2>&1 | $(AWK) '{ if (gsub("0x800100","$(BIOS_RAM_END)") == 1) print }') |
| 315 | else |
272 | else |
| 316 | %.elf: $(OBJ) |
273 | %.elf: $(OBJ) |
| 317 | @echo |
- | |
| 318 | @echo $(MSG_LINKING) $@ |
274 | @echo $(MSG_LINKING) $@ |
| 319 |
|
275 | @$(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS) |
| 320 | endif |
276 | endif |
| 321 | 277 | ||
| 322 | # Compile: create object files from C source files. |
278 | # Compile: create object files from C source files. |
| 323 | %.o : %.c |
279 | %.o : %.c |
| 324 | @echo |
- | |
| 325 | @echo $(MSG_COMPILING) $< |
280 | @echo $(MSG_COMPILING) $< |
| 326 |
|
281 | @$(CC) -c $(CFLAGS) $< -o $@ |
| 327 | - | ||
| 328 | 282 | ||
| 329 | # Compile: create assembler files from C source files. |
283 | # Compile: create assembler files from C source files. |
| 330 | %.s : %.c |
284 | %.s : %.c |
| 331 |
|
285 | @$(CC) -S $(CFLAGS) $< -o $@ |
| 332 | - | ||
| 333 | 286 | ||
| 334 | # Assemble: create object files from assembler source files. |
287 | # Assemble: create object files from assembler source files. |
| 335 | %.o : %.S |
288 | %.o : %.S |
| 336 | @echo |
- | |
| 337 | @echo $(MSG_ASSEMBLING) $< |
289 | @echo $(MSG_ASSEMBLING) $< |
| 338 | $(CC) -c $(ASFLAGS) $< -o $@ |
290 | $(CC) -c $(ASFLAGS) $< -o $@ |
| 339 | 291 | ||
| 340 | # Depends: create dependency files from c source files. |
292 | # Depends: create dependency files from c source files. |
| 341 |
|
293 | #%.d : %.c | $(BUILDDIRS) |
| 342 | @echo $(MSG_DEPEND) $< |
294 | # @echo $(MSG_DEPEND) $< |
| 343 | @$(CC) -c $(CFLAGS) $(GENDEPFLAGS) $< |
295 | # @$(CC) -c $(CFLAGS) $(GENDEPFLAGS) $< |
| - | 296 | ||
| - | 297 | # Buildtree: create directories for output files. |
|
| - | 298 | $(BUILDDIRS) : |
|
| - | 299 | @echo $(MSG_CREATE) $@ |
|
| - | 300 | @$(MKDIR) -p $@ |
|
| 344 | 301 | ||
| 345 | # Target: clean project. |
302 | # Target: clean project. |
| 346 | clean: begin clean_list finished end |
- | |
| 347 | - | ||
| 348 |
|
303 | clean: |
| 349 | @echo |
- | |
| 350 | @echo $(MSG_CLEANING) |
304 | @echo $(MSG_CLEANING) |
| 351 | $( |
305 | $(RM) $(TARGET).hex |
| 352 | $( |
306 | $(RM) $(TARGET).eep |
| 353 | $(REMOVE) $(TARGET).obj |
- | |
| 354 | $( |
307 | $(RM) $(TARGET).cof |
| 355 | $( |
308 | $(RM) $(TARGET).elf |
| 356 | $( |
309 | $(RM) $(TARGET).map |
| 357 | $(REMOVE) $(TARGET).obj |
- | |
| 358 | $(REMOVE) $(TARGET).a90 |
- | |
| 359 | $( |
310 | $(RM) $(TARGET).sym |
| 360 | $(REMOVE) $(TARGET).lnk |
- | |
| 361 | $( |
311 | $(RM) $(TARGET).lss |
| 362 | $( |
312 | $(RM) $(OBJ) |
| 363 | $( |
313 | $(RM) $(DEP) |
| 364 | $(REMOVE) $(CSRC:.c=.s) |
- | |
| 365 | $(REMOVE) $(CSRC:.c=.d) |
- | |
| 366 | $( |
314 | $(RM) $(LST) |
| 367 | $( |
315 | $(RM) config.h |
| 368 | 316 | ||
| 369 | 317 | distclean: clean |
|
| - | 318 | $(RM) -r $(BUILDDIRS) |
|
| 370 | 319 | ||
| 371 | # Include the dependency files. |
320 | # Include the dependency files. |
| - | 321 | ifneq ($(MAKECMDGOALS),clean) |
|
| - | 322 | ifneq ($(strip $(DEP)),) |
|
| 372 | -include $( |
323 | -include $(DEP) |
| - | 324 | endif |
|
| 373 | 325 | endif |
|
| 374 | 326 | ||
| 375 | # Listing of phony targets. |
327 | # Listing of phony targets. |
| 376 | .PHONY : all |
328 | .PHONY : all sizebefore sizeafter build \ |
| 377 |
|
329 | elf hex eep lss sym coff extcoff clean \ |
| 378 |
|
330 | distclean gccversion |
| 379 | 331 | ||