Revision 1480
program makefile can now autobuild the library
trunk/code/makefile_root.mk | ||
---|---|---|
1 | 1 |
# This is makefile_root.mk |
2 | 2 |
# |
3 |
# Make global makefile changes here |
|
4 |
# |
|
3 | 5 |
################################### |
4 | 6 |
|
5 | 7 |
# Hey Emacs, this is a -*- makefile -*- |
... | ... | |
34 | 36 |
# make debug = Start either simulavr or avarice as specified for debugging, |
35 | 37 |
# with avr-gdb or avr-insight as the front end for debugging. |
36 | 38 |
# |
39 |
# make library = Build the library, then make software |
|
40 |
# |
|
37 | 41 |
# make filename.s = Just compile filename.c into the assembler code only. |
38 | 42 |
# |
39 | 43 |
# make filename.i = Create a preprocessed source file for use in submitting |
... | ... | |
286 | 290 |
MSG_COMPILING = Compiling: |
287 | 291 |
MSG_ASSEMBLING = Assembling: |
288 | 292 |
MSG_CLEANING = Cleaning project: |
293 |
MSG_LIBRARY_BUILD = Building library: |
|
294 |
MSG_LIBRARY_CHECK = Checking if we need to rebuild the library: |
|
289 | 295 |
|
290 | 296 |
|
291 | 297 |
|
292 |
|
|
293 | 298 |
# Define all object files. |
294 | 299 |
OBJ = $(SRC:.c=.o) $(ASRC:.S=.o) |
295 | 300 |
|
... | ... | |
311 | 316 |
|
312 | 317 |
|
313 | 318 |
# Default target. |
314 |
all: begin gccversion sizebefore build sizeafter checksize end |
|
319 |
all: begin gccversion lib sizebefore build sizeafter checksize end
|
|
315 | 320 |
|
316 | 321 |
build: elf hex eep lss sym |
317 | 322 |
|
... | ... | |
340 | 345 |
ELFSIZE = $(SIZE) -A $(TARGET).elf |
341 | 346 |
AVRMEM = avr-mem.sh $(TARGET).elf $(MCU) |
342 | 347 |
|
343 |
# check RAM size (make sure under 4 kB)
|
|
348 |
# Check RAM size (make sure under 4 kB)
|
|
344 | 349 |
AWK = $(shell if uname -s |grep -i w32 >/dev/null; then echo 'gawk'; else echo 'awk'; fi) |
345 | 350 |
DATASIZE = avr-size -A main.elf | grep 'data' | $(AWK) '{ print $$2 }' > 1.tmp |
346 | 351 |
BSSSIZE = avr-size -A main.elf | grep 'bss' | $(AWK) '{ print $$2 }' > 2.tmp |
... | ... | |
355 | 360 |
else echo ".data and .bss size fine";echo; fi |
356 | 361 |
@$(CLEANSIZE) |
357 | 362 |
|
363 |
# Display size before |
|
358 | 364 |
sizebefore: |
359 | 365 |
@if test -f $(TARGET).elf; then echo; echo $(MSG_SIZE_BEFORE); $(ELFSIZE); \ |
360 | 366 |
$(AVRMEM) 2>/dev/null; echo; fi |
361 | 367 |
|
368 |
# Display size after |
|
362 | 369 |
sizeafter: |
363 | 370 |
@if test -f $(TARGET).elf; then echo; echo $(MSG_SIZE_AFTER); $(ELFSIZE); \ |
364 | 371 |
$(AVRMEM) 2>/dev/null; echo; fi |
... | ... | |
368 | 375 |
# Display compiler version information. |
369 | 376 |
gccversion : |
370 | 377 |
@$(CC) --version |
378 |
|
|
379 |
|
|
380 |
# Build the library |
|
381 |
library: |
|
382 |
@echo $(MSG_LIBRARY_BUILD) |
|
383 |
@cd $(COLONYROOT)/code/projects/libdragonfly;make clean;make dist |
|
384 |
@cd $(COLONYROOT)/code/projects/libwireless/lib;make clean;make dist |
|
371 | 385 |
|
386 |
# Check if library needs to be built |
|
387 |
lib: |
|
388 |
@echo $(MSG_LIBRARY_CHECK) |
|
389 |
@cd $(COLONYROOT)/code/projects/libdragonfly;make dist |
|
390 |
@cd $(COLONYROOT)/code/projects/libwireless/lib;make dist |
|
372 | 391 |
|
373 | 392 |
|
374 | 393 |
# Program the device. |
Also available in: Unified diff