tiny-AES-c/Makefile
Kevin Layer 7f211fb4f4 Testing improvements
Add a new `test' rule that tests all three combinations (128, 192 and
256).  This required the re-ordering of ifdef's in test.c, similar to
that in aes.[ch].  test.elf now exits with the number of tests which
failed, so the test rule in Makefile will notify properly.

Remove the unused variables `buf' and `buf2'.

Also, add a .gitignore file.
2018-07-26 10:12:54 -07:00

55 lines
1.1 KiB
Makefile

#CC = avr-gcc
#CFLAGS = -Wall -mmcu=atmega16 -Os -Wl,-Map,test.map
#OBJCOPY = avr-objcopy
CC = gcc
LD = gcc
CFLAGS = -Wall -Os -c
LDFLAGS = -Wall -Os -Wl,-Map,test.map
ifdef AES192
CFLAGS += -DAES192=1
endif
ifdef AES256
CFLAGS += -DAES256=1
endif
OBJCOPYFLAFS = -j .text -O ihex
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
default: test.elf
.SILENT:
.PHONY: lint clean
test.hex : test.elf
echo copy object-code to new image and format in hex
$(OBJCOPY) ${OBJCOPYFLAFS} $< $@
test.o : test.c aes.h aes.o
echo [CC] $@ $(CFLAGS)
$(CC) $(CFLAGS) -o $@ $<
aes.o : aes.c aes.h
echo [CC] $@ $(CFLAGS)
$(CC) $(CFLAGS) -o $@ $<
test.elf : aes.o test.o
echo [LD] $@
$(LD) $(LDFLAGS) -o $@ $^
clean:
rm -f *.OBJ *.LST *.o *.gch *.out *.hex *.map
test:
make clean && make && ./test.elf
make clean && make AES192=1 && ./test.elf
make clean && make AES256=1 && ./test.elf
lint:
$(call SPLINT)