2014-05-29 04:21:30 +04:00
|
|
|
#CC = avr-gcc
|
|
|
|
#CFLAGS = -Wall -mmcu=atmega16 -Os -Wl,-Map,test.map
|
|
|
|
#OBJCOPY = avr-objcopy
|
|
|
|
CC = gcc
|
2017-12-05 15:27:53 +03:00
|
|
|
LD = gcc
|
2018-09-24 16:35:10 +03:00
|
|
|
AR = ar
|
|
|
|
ARFLAGS = rcs
|
2017-12-05 15:27:53 +03:00
|
|
|
CFLAGS = -Wall -Os -c
|
|
|
|
LDFLAGS = -Wall -Os -Wl,-Map,test.map
|
2018-07-26 19:58:44 +03:00
|
|
|
ifdef AES192
|
|
|
|
CFLAGS += -DAES192=1
|
|
|
|
endif
|
|
|
|
ifdef AES256
|
|
|
|
CFLAGS += -DAES256=1
|
|
|
|
endif
|
2017-12-05 15:27:53 +03:00
|
|
|
|
2018-09-24 16:35:10 +03:00
|
|
|
OBJCOPYFLAGS = -j .text -O ihex
|
2014-05-29 04:21:30 +04:00
|
|
|
OBJCOPY = objcopy
|
|
|
|
|
|
|
|
# include path to AVR library
|
|
|
|
INCLUDE_PATH = /usr/lib/avr/include
|
|
|
|
# splint static check
|
|
|
|
SPLINT = splint test.c aes.c -I$(INCLUDE_PATH) +charindex -unrecog
|
|
|
|
|
2017-12-05 15:27:53 +03:00
|
|
|
default: test.elf
|
|
|
|
|
2014-05-29 04:21:30 +04:00
|
|
|
.SILENT:
|
|
|
|
.PHONY: lint clean
|
|
|
|
|
2017-12-05 15:27:53 +03:00
|
|
|
test.hex : test.elf
|
|
|
|
echo copy object-code to new image and format in hex
|
2018-09-24 16:35:10 +03:00
|
|
|
$(OBJCOPY) ${OBJCOPYFLAGS} $< $@
|
2014-05-29 04:21:30 +04:00
|
|
|
|
2017-12-05 15:27:53 +03:00
|
|
|
test.o : test.c aes.h aes.o
|
2018-07-26 19:58:44 +03:00
|
|
|
echo [CC] $@ $(CFLAGS)
|
2017-12-05 15:27:53 +03:00
|
|
|
$(CC) $(CFLAGS) -o $@ $<
|
2014-05-29 04:21:30 +04:00
|
|
|
|
2017-12-05 15:27:53 +03:00
|
|
|
aes.o : aes.c aes.h
|
2018-07-26 19:58:44 +03:00
|
|
|
echo [CC] $@ $(CFLAGS)
|
2017-12-05 15:27:53 +03:00
|
|
|
$(CC) $(CFLAGS) -o $@ $<
|
2014-05-29 04:21:30 +04:00
|
|
|
|
2017-12-05 15:27:53 +03:00
|
|
|
test.elf : aes.o test.o
|
|
|
|
echo [LD] $@
|
|
|
|
$(LD) $(LDFLAGS) -o $@ $^
|
2014-05-29 04:21:30 +04:00
|
|
|
|
2018-09-24 16:35:10 +03:00
|
|
|
aes.a : aes.o
|
|
|
|
echo [AR] $@
|
|
|
|
$(AR) $(ARFLAGS) $@ $^
|
|
|
|
|
|
|
|
lib : aes.a
|
2014-05-29 04:21:30 +04:00
|
|
|
|
|
|
|
clean:
|
2018-09-24 16:35:10 +03:00
|
|
|
rm -f *.OBJ *.LST *.o *.gch *.out *.hex *.map *.elf *.a
|
2014-05-29 04:21:30 +04:00
|
|
|
|
2018-07-26 19:58:44 +03:00
|
|
|
test:
|
|
|
|
make clean && make && ./test.elf
|
|
|
|
make clean && make AES192=1 && ./test.elf
|
|
|
|
make clean && make AES256=1 && ./test.elf
|
|
|
|
|
2014-05-29 04:21:30 +04:00
|
|
|
lint:
|
|
|
|
$(call SPLINT)
|