comparison Makefile @ 45:a0f2fcc6d9dd

add buildid
author Matt Johnston <matt@ucc.asn.au>
date Sat, 29 Jun 2013 23:46:39 +0800
parents d07aa7644c66
children
comparison
equal deleted inserted replaced
44:2a47c458d6ed 45:a0f2fcc6d9dd
23 PROGRAMMER = #-c stk500v2 -P avrdoper 23 PROGRAMMER = #-c stk500v2 -P avrdoper
24 PROGRAMMER = -c arduino -b 115200 -P /dev/ttyAMA0 -p $(PROGDEVICE) -B 2 24 PROGRAMMER = -c arduino -b 115200 -P /dev/ttyAMA0 -p $(PROGDEVICE) -B 2
25 SOURCE_1WIRE = onewire.c simple_ds18b20.c crc8.c 25 SOURCE_1WIRE = onewire.c simple_ds18b20.c crc8.c
26 SOURCE_CRYPTO = hmac-sha1.c sha1-asm.S aes.c 26 SOURCE_CRYPTO = hmac-sha1.c sha1-asm.S aes.c
27 SOURCE_SD = byteordering.c fat.c partition.c sd_raw.c 27 SOURCE_SD = byteordering.c fat.c partition.c sd_raw.c
28 SOURCE = main.c 28 SOURCE = main.c buildid.c
29 SOURCE += $(SOURCE_CRYPTO) $(SOURCE_SD) 29 SOURCE += $(SOURCE_CRYPTO) $(SOURCE_SD)
30 LIBS = 30 LIBS =
31 BOOTLOADER_HEX = ATmegaBOOT_168_pihelp.hex 31 BOOTLOADER_HEX = ATmegaBOOT_168_pihelp.hex
32 32
33 OBJECTS := $(patsubst %.c,%.o,$(patsubst %.S,%.o,$(SOURCE))) 33 OBJECTS := $(patsubst %.c,%.o,$(patsubst %.S,%.o,$(SOURCE)))
95 COMPILE = avr-gcc -Wall -Os -DF_CPU=$(CLOCK) -mmcu=$(DEVICE) -g -std=c99 -mcall-prologues -fdata-sections -ffunction-sections -Wl,--gc-sections -Wl,--relax -fwhole-program -flto 95 COMPILE = avr-gcc -Wall -Os -DF_CPU=$(CLOCK) -mmcu=$(DEVICE) -g -std=c99 -mcall-prologues -fdata-sections -ffunction-sections -Wl,--gc-sections -Wl,--relax -fwhole-program -flto
96 96
97 # symbolic targets: 97 # symbolic targets:
98 all: main.hex 98 all: main.hex
99 99
100 .PHONY: buildid.c
101
102 buildid.c:
103 echo "#include \"buildid.h\"" > $@
104 echo "uint8_t buildid[20] = { `dd if=/dev/urandom bs=20 count=1 2> /dev/null | hexdump -e '20/1 "0x%02x, "' ` };" >> $@
105
100 .c.o: 106 .c.o:
101 $(COMPILE) -c $< -o $@ 107 $(COMPILE) -c $< -o $@
102 108
103 .S.o: 109 .S.o:
104 $(COMPILE) -x assembler-with-cpp -c $< -o $@ 110 $(COMPILE) -x assembler-with-cpp -c $< -o $@