changeset 11:06bedbe8540d

all these optimisations make it 30% smaller
author Matt Johnston <matt@ucc.asn.au>
date Sat, 19 May 2012 17:15:50 +0800
parents 1bfe28c348dd
children 3c27bfbd7f3a
files Makefile
diffstat 1 files changed, 8 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/Makefile	Sat May 19 17:10:13 2012 +0800
+++ b/Makefile	Sat May 19 17:15:50 2012 +0800
@@ -22,11 +22,11 @@
 CLOCK      = 2000000
 PROGRAMMER = #-c stk500v2 -P avrdoper
 PROGRAMMER = -c stk500 -P ~/dev/stk500 -p $(PROGDEVICE)  -B 2
-OBJS_1WIRE = onewire.o ds18x20.o uart_addon.o crc8.o uart.o
-OBJS_SD = ff.o mmc.o
-OBJECTS    = main.o
-OBJECTS += $(OBJS_1WIRE)
-#OBJECTS += OBJS_SD
+SOURCE_1WIRE = onewire.c ds18x20.c uart_addon.c crc8.c uart.c
+SOURCE_SD = ff.c mmc.c
+SOURCE    = main.c
+SOURCE += $(SOURCE_1WIRE)
+#SOURCE += $(SOURCE_SD)
 LIBS       = -lm
 
 # default but 2mhz
@@ -58,7 +58,7 @@
 # Tune the lines below only if you know what you are doing:
 
 AVRDUDE = avrdude $(PROGRAMMER) 
-COMPILE = avr-gcc -Wall -Os -DF_CPU=$(CLOCK) -mmcu=$(DEVICE) -g -std=c99 -mcall-prologues -fdata-sections -ffunction-sections  -Wl,--print-gc-sections -Wl,--gc-sections -Wl,--relax
+COMPILE = avr-gcc -Wall -Os -DF_CPU=$(CLOCK) -mmcu=$(DEVICE) -g -std=c99 -mcall-prologues -fdata-sections -ffunction-sections  -Wl,--gc-sections -Wl,--relax --combine -fwhole-program
 
 # symbolic targets:
 all:	main.hex
@@ -93,8 +93,8 @@
 	rm -f main.hex main.elf $(OBJECTS)
 
 # file targets:
-main.elf: $(OBJECTS)
-	$(COMPILE) -o main.elf $(OBJECTS) $(LIBS)
+main.elf: $(SOURCE)
+	$(COMPILE) -o main.elf $(SOURCE) $(LIBS)
 
 main.hex: main.elf
 	rm -f main.hex