solo1/Makefile

118 wiersze
3.1 KiB
Makefile
Czysty Zwykły widok Historia

2018-05-07 00:14:52 +00:00
#define uECC_arch_other 0
#define uECC_x86 1
#define uECC_x86_64 2
#define uECC_arm 3
#define uECC_arm_thumb 4
#define uECC_arm_thumb2 5
#define uECC_arm64 6
#define uECC_avr 7
ecc_platform=2
2018-05-07 00:14:52 +00:00
2018-08-09 23:39:50 +00:00
EFM32_DEBUGGER= -s 440083537 --device EFM32JG1B200F128GM32
#EFM32_DEBUGGER= -s 440121060 #dev board
src = $(wildcard pc/*.c) $(wildcard fido2/*.c) $(wildcard crypto/sha256/*.c) crypto/tiny-AES-c/aes.c
2018-05-07 00:14:52 +00:00
obj = $(src:.c=.o) uECC.o
2018-04-28 17:40:28 +00:00
LIBCBOR = tinycbor/lib/libtinycbor.a
2018-11-04 22:16:16 +00:00
2018-10-25 03:20:46 +00:00
ifeq ($(shell uname -s),Darwin)
export LDFLAGS = -Wl,-dead_strip
else
export LDFLAGS = -Wl,--gc-sections
endif
LDFLAGS += $(LIBCBOR)
CFLAGS = -O2 -fdata-sections -ffunction-sections
2018-09-13 02:32:58 +00:00
INCLUDES = -I./tinycbor/src -I./crypto/sha256 -I./crypto/micro-ecc/ -Icrypto/tiny-AES-c/ -I./fido2/ -I./pc -I./fido2/extensions
CFLAGS += $(INCLUDES)
# for crypto/tiny-AES-c
CFLAGS += -DAES256=1 -DAPP_CONFIG=\"app.h\"
2018-04-28 17:40:28 +00:00
name = main
2019-01-06 19:48:18 +00:00
.PHONY: all $(LIBCBOR)
2018-11-23 16:51:38 +00:00
all: main
tinycbor/Makefile crypto/tiny-AES-c/aes.c:
git submodule update --init
.PHONY: cbor
cbor: $(LIBCBOR)
2019-01-06 19:48:18 +00:00
$(LIBCBOR):
cd tinycbor/ && $(MAKE) clean && $(MAKE) -j8
2019-01-06 19:48:18 +00:00
test: env3
$(MAKE) clean
$(MAKE) -C . main
$(MAKE) clean
cd ./targets/stm32l432; $(MAKE) test PREFIX=$(PREFIX) VENV=". ../../env3/bin/activate;"
$(MAKE) clean
$(MAKE) cppcheck
.PHONY: efm8prog
2018-07-03 03:10:23 +00:00
efm8prog:
2018-09-13 01:25:40 +00:00
cd './targets/efm8\Keil 8051 v9.53 - Debug' && $(MAKE) all
2018-07-04 16:48:18 +00:00
flashefm8.exe -part EFM8UB10F8G -sn 440105518 -erase
2018-09-13 01:25:40 +00:00
flashefm8.exe -part EFM8UB10F8G -sn 440105518 -upload './targets/efm8/Keil 8051 v9.53 - Debug/efm8.hex'
2018-07-03 03:10:23 +00:00
.PHONY: efm32com efm32prog efm32read efm32bootprog
2018-07-14 00:29:14 +00:00
efm32com:
2018-09-13 01:25:40 +00:00
cd './targets/efm32/GNU ARM v7.2.1 - Debug' && $(MAKE) all
efm32prog: efm32com
2018-11-02 04:10:22 +00:00
commander flash './targets/efm32/GNU ARM v7.2.1 - Debug/EFM32.hex' $(EFM32_DEBUGGER) -p "0x1E7FC:0x00000000:4"
efm32read: efm32com
2018-08-09 23:39:50 +00:00
commander swo read $(EFM32_DEBUGGER)
efm32bootprog: efm32com
2018-09-13 01:25:40 +00:00
commander flash './efm32boot/GNU ARM v7.2.1 - Debug/efm32boot.hex' $(EFM32_DEBUGGER) --masserase
2018-07-15 03:03:25 +00:00
$(name): $(obj) $(LIBCBOR)
2018-04-28 17:40:28 +00:00
$(CC) $(LDFLAGS) -o $@ $(obj) $(LDFLAGS)
2018-05-03 02:52:41 +00:00
2018-05-07 00:14:52 +00:00
uECC.o: ./crypto/micro-ecc/uECC.c
$(CC) -c -o $@ $^ -O2 -fdata-sections -ffunction-sections -DuECC_PLATFORM=$(ecc_platform) -I./crypto/micro-ecc/
2018-05-07 00:14:52 +00:00
env2:
2019-01-03 13:30:19 +00:00
virtualenv --python=python2.7 env2
2019-01-04 01:02:27 +00:00
env2/bin/pip install --upgrade -r tools/requirements.txt
env3:
python3 -m venv env3
2019-01-04 01:02:27 +00:00
env3/bin/pip install --upgrade -r tools/requirements.txt
env3/bin/pip install --upgrade black
# selectively reformat our own code
black: env3
env3/bin/black --skip-string-normalization tools/
wink2: env2
env2/bin/python tools/solotool.py solo --wink
wink3: env3
env3/bin/python tools/solotool.py solo --wink
fido2-test: env3
env3/bin/python tools/ctap_test.py
2019-01-17 00:50:52 +00:00
CPPCHECK_FLAGS=--quiet --error-exitcode=2
cppcheck:
cppcheck $(CPPCHECK_FLAGS) crypto/aes-gcm
cppcheck $(CPPCHECK_FLAGS) crypto/sha256
cppcheck $(CPPCHECK_FLAGS) fido2
cppcheck $(CPPCHECK_FLAGS) pc
2018-05-03 02:52:41 +00:00
clean:
2018-11-23 16:51:38 +00:00
rm -f *.o main.exe main $(obj)
for f in crypto/tiny-AES-c/Makefile tinycbor/Makefile ; do \
if [ -f "$$f" ]; then \
(cd `dirname $$f` ; git checkout -- .) ;\
fi ;\
done
2019-01-06 19:48:18 +00:00
full-clean: clean
rm -rf env2 env3