Rev 554 | Rev 563 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | SVN | RSS feed
| Rev 554 | Rev 556 | ||
|---|---|---|---|
| Line 73... | Line 73... | ||
| 73 | CFLAGS += -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums |
73 | CFLAGS += -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums |
| 74 | CFLAGS += -Wall -Wstrict-prototypes |
74 | CFLAGS += -Wall -Wstrict-prototypes |
| 75 | CFLAGS += -Wa,-adhlns=$(@:.o=.lst) |
75 | CFLAGS += -Wa,-adhlns=$(@:.o=.lst) |
| 76 | CFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS)) |
76 | CFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS)) |
| 77 | CFLAGS += $(CSTANDARD) |
77 | CFLAGS += $(CSTANDARD) |
| - | 78 | CFLAGS += $(GENDEPFLAGS) |
|
| 78 | 79 | ||
| 79 | 80 | ||
| 80 | 81 | ||
| 81 | # Assembler flags. |
82 | # Assembler flags. |
| 82 | # -Wa,...: tell GCC to pass this to the assembler. |
83 | # -Wa,...: tell GCC to pass this to the assembler. |
| Line 174... | Line 175... | ||
| 174 | 175 | ||
| 175 | # Define all listing files. |
176 | # Define all listing files. |
| 176 | LST = $(OBJ:.o=.lst) |
177 | LST = $(OBJ:.o=.lst) |
| 177 | 178 | ||
| 178 | # Define all dependency files. |
179 | # Define all dependency files. |
| 179 | DEP = $(OBJ:.o=. |
180 | DEP = $(OBJ:.o=.d) |
| 180 | 181 | ||
| 181 | BUILDDIRS = $(sort $(filter-out ./,$(dir $(OBJ)))) |
182 | BUILDDIRS = $(sort $(filter-out ./,$(dir $(OBJ)))) |
| 182 | 183 | ||
| 183 | BIOS_RAM_END := $(shell $(AWK) '/0x[0-9a-f]+.*__bios_ram_end/ { print $$1 }' $(BIOSDIR)/bios.map) |
184 | BIOS_RAM_END := $(shell $(AWK) '/0x[0-9a-f]+.*__bios_ram_end/ { print $$1 }' $(BIOSDIR)/bios.map) |
| 184 | 185 | ||
| 185 | # Compiler flags to generate dependency files. |
186 | # Compiler flags to generate dependency files. |
| 186 | ### GENDEPFLAGS = -Wp,-M,-MP,-MT,$(*F).o,-MF,.dep/$(@F).d |
- | |
| 187 | GENDEPFLAGS = - |
187 | GENDEPFLAGS = -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" |
| 188 | 188 | ||
| 189 | # Default target. |
189 | # Default target. |
| 190 | all: sizebefore config.h build sizeafter |
190 | all: sizebefore buildtree config.h build sizeafter |
| 191 | 191 | ||
| 192 | build: elf hex eep lss sym |
192 | build: elf hex eep lss sym |
| 193 | 193 | ||
| 194 | elf: $(TARGET).elf |
194 | elf: $(TARGET).elf |
| 195 | hex: $(TARGET).hex |
195 | hex: $(TARGET).hex |
| 196 | eep: $(TARGET).eep |
196 | eep: $(TARGET).eep |
| 197 | lss: $(TARGET).lss |
197 | lss: $(TARGET).lss |
| 198 | sym: $(TARGET).sym |
198 | sym: $(TARGET).sym |
| - | 199 | ||
| - | 200 | buildtree: $(BUILDDIRS) |
|
| 199 | 201 | ||
| 200 | # Display size of file. |
202 | # Display size of file. |
| 201 | HEXSIZE = $(SIZE) --target=ihex $(TARGET).hex |
203 | HEXSIZE = $(SIZE) --target=ihex $(TARGET).hex |
| 202 | ELFSIZE = $(SIZE) $(TARGET).elf |
204 | ELFSIZE = $(SIZE) $(TARGET).elf |
| 203 | sizebefore: |
205 | sizebefore: |
| Line 282... | Line 284... | ||
| 282 | %.o : %.S |
284 | %.o : %.S |
| 283 | @echo $(MSG_ASSEMBLING) $< |
285 | @echo $(MSG_ASSEMBLING) $< |
| 284 | $(CC) -c $(ASFLAGS) $< -o $@ |
286 | $(CC) -c $(ASFLAGS) $< -o $@ |
| 285 | 287 | ||
| 286 | # Depends: create dependency files from c source files. |
288 | # Depends: create dependency files from c source files. |
| 287 |
|
289 | #%.d : %.c | $(BUILDDIRS) |
| 288 | @echo $(MSG_DEPEND) $< |
290 | # @echo $(MSG_DEPEND) $< |
| 289 | @$(CC) -c $(CFLAGS) $(GENDEPFLAGS) $< |
291 | # @$(CC) -c $(CFLAGS) $(GENDEPFLAGS) $< |
| 290 | 292 | ||
| 291 | # Buildtree: create directories for output files. |
293 | # Buildtree: create directories for output files. |
| 292 | $(BUILDDIRS) : |
294 | $(BUILDDIRS) : |
| 293 | @echo $(MSG_CREATE) $@ |
295 | @echo $(MSG_CREATE) $@ |
| 294 | @$(MKDIR) -p $@ |
296 | @$(MKDIR) -p $@ |
| Line 302... | Line 304... | ||
| 302 | $(RM) $(TARGET).elf |
304 | $(RM) $(TARGET).elf |
| 303 | $(RM) $(TARGET).map |
305 | $(RM) $(TARGET).map |
| 304 | $(RM) $(TARGET).sym |
306 | $(RM) $(TARGET).sym |
| 305 | $(RM) $(TARGET).lss |
307 | $(RM) $(TARGET).lss |
| 306 | $(RM) $(OBJ) |
308 | $(RM) $(OBJ) |
| - | 309 | $(RM) $(DEP) |
|
| 307 | $(RM) $(LST) |
310 | $(RM) $(LST) |
| 308 | $(RM) config.h |
311 | $(RM) config.h |
| 309 | 312 | ||
| 310 | distclean: clean |
313 | distclean: clean |
| 311 | $(RM) -r $(BUILDDIRS) |
314 | $(RM) -r $(BUILDDIRS) |
| 312 | 315 | ||
| 313 | # Include the dependency files. |
316 | # Include the dependency files. |
| - | 317 | ifneq ($(MAKECMDGOALS),clean) |
|
| - | 318 | ifneq ($(strip $(DEP)),) |
|
| 314 | -include $(DEP) |
319 | -include $(DEP) |
| - | 320 | endif |
|
| - | 321 | endif |
|
| 315 | 322 | ||
| 316 | # Listing of phony targets. |
323 | # Listing of phony targets. |
| 317 | .PHONY : all sizebefore sizeafter build \ |
324 | .PHONY : all sizebefore sizeafter build \ |
| 318 | elf hex eep lss sym coff extcoff clean \ |
325 | elf hex eep lss sym coff extcoff clean \ |
| 319 | distclean gccversion |
326 | distclean gccversion |