mirror of
https://github.com/taigrr/arduinolibs
synced 2025-01-18 04:33:12 -08:00
Compiling the Crypto library on a host system
This commit is contained in:
127
host/Crypto/Makefile
Normal file
127
host/Crypto/Makefile
Normal file
@@ -0,0 +1,127 @@
|
||||
|
||||
.PHONY: all clean check
|
||||
|
||||
TOPDIR = ../..
|
||||
SRCDIR = $(TOPDIR)/libraries/Crypto
|
||||
|
||||
#VPATH = $(SRCDIR)
|
||||
vpath %.cpp $(SRCDIR)
|
||||
vpath %.o .
|
||||
vpath %.ino $(SRCDIR)/examples
|
||||
vpath %.sketch .
|
||||
|
||||
LIBRARY = libCrypto.a
|
||||
|
||||
CPPFLAGS = \
|
||||
-I$(TOPDIR)/host/emulation \
|
||||
-I$(TOPDIR)/libraries/Crypto \
|
||||
-DHOST_BUILD
|
||||
|
||||
CXXFLAGS = -g -Wall $(CPPFLAGS)
|
||||
|
||||
SOURCES = \
|
||||
AES128.cpp \
|
||||
AES192.cpp \
|
||||
AES256.cpp \
|
||||
AESCommon.cpp \
|
||||
AuthenticatedCipher.cpp \
|
||||
BigNumberUtil.cpp \
|
||||
BLAKE2b.cpp \
|
||||
BLAKE2s.cpp \
|
||||
BlockCipher.cpp \
|
||||
CBC.cpp \
|
||||
CFB.cpp \
|
||||
ChaCha.cpp \
|
||||
ChaChaPoly.cpp \
|
||||
Cipher.cpp \
|
||||
Crypto.cpp \
|
||||
CTR.cpp \
|
||||
Curve25519.cpp \
|
||||
EAX.cpp \
|
||||
Ed25519.cpp \
|
||||
GCM.cpp \
|
||||
GF128.cpp \
|
||||
GHASH.cpp \
|
||||
Hash.cpp \
|
||||
KeccakCore.cpp \
|
||||
NoiseSource.cpp \
|
||||
OFB.cpp \
|
||||
OMAC.cpp \
|
||||
Poly1305.cpp \
|
||||
RNG_host.cpp \
|
||||
SHA256.cpp \
|
||||
SHA3.cpp \
|
||||
SHA512.cpp \
|
||||
SHAKE.cpp \
|
||||
Speck.cpp \
|
||||
SpeckSmall.cpp \
|
||||
SpeckTiny.cpp \
|
||||
XOF.cpp \
|
||||
XTS.cpp
|
||||
|
||||
SKETCHES = \
|
||||
TestAES/TestAES.ino \
|
||||
TestBigNumberUtil/TestBigNumberUtil.ino \
|
||||
TestBLAKE2b/TestBLAKE2b.ino \
|
||||
TestBLAKE2s/TestBLAKE2s.ino \
|
||||
TestCBC/TestCBC.ino \
|
||||
TestCFB/TestCFB.ino \
|
||||
TestChaCha/TestChaCha.ino \
|
||||
TestChaChaPoly/TestChaChaPoly.ino \
|
||||
TestCTR/TestCTR.ino \
|
||||
TestCurve25519/TestCurve25519.ino \
|
||||
TestCurve25519Math/TestCurve25519Math.ino \
|
||||
TestEAX/TestEAX.ino \
|
||||
TestEd25519/TestEd25519.ino \
|
||||
TestGCM/TestGCM.ino \
|
||||
TestGHASH/TestGHASH.ino \
|
||||
TestOFB/TestOFB.ino \
|
||||
TestPoly1305/TestPoly1305.ino \
|
||||
TestSHA256/TestSHA256.ino \
|
||||
TestSHA3_256/TestSHA3_256.ino \
|
||||
TestSHA3_512/TestSHA3_512.ino \
|
||||
TestSHA512/TestSHA512.ino \
|
||||
TestSHAKE128/TestSHAKE128.ino \
|
||||
TestSHAKE256/TestSHAKE256.ino \
|
||||
TestSpeck/TestSpeck.ino \
|
||||
TestXTS/TestXTS.ino \
|
||||
|
||||
OBJECTS = $(patsubst %.cpp,%.o,$(SOURCES))
|
||||
DEPS = $(patsubst %.cpp,.depend/%.d,$(SOURCES))
|
||||
|
||||
SKETCH_OUTPUTS = $(patsubst %.ino,%.sketch,$(SKETCHES))
|
||||
|
||||
all: $(LIBRARY)
|
||||
|
||||
$(LIBRARY): $(OBJECTS)
|
||||
$(RM) $(LIBRARY)
|
||||
$(AR) cr $(LIBRARY) $(OBJECTS)
|
||||
|
||||
clean:
|
||||
$(RM) $(OBJECTS) $(LIBRARY)
|
||||
$(RM) $(SKETCH_OUTPUTS)
|
||||
$(RM) -r .depend Test*
|
||||
|
||||
check: all $(SKETCH_OUTPUTS)
|
||||
@for sketch in $(SKETCH_OUTPUTS); do \
|
||||
echo Running $$sketch; \
|
||||
$$sketch | grep -i fail; \
|
||||
done; exit 0
|
||||
|
||||
%.o: %.cpp
|
||||
$(CXX) $(CXXFLAGS) -o $@ -c $<
|
||||
|
||||
%.sketch: %.ino $(LIBRARY)
|
||||
mkdir -p `dirname $@`
|
||||
$(CXX) -x c++ $(CXXFLAGS) \
|
||||
-include $(TOPDIR)/host/emulation/Arduino.h \
|
||||
-include $(TOPDIR)/host/emulation/Arduino.cpp \
|
||||
-o $@ $< -L. -lCrypto
|
||||
|
||||
.depend/%.d: %.cpp
|
||||
@set -e; rm -f $@; mkdir -p `dirname $@`; \
|
||||
$(CXX) -MM $(CPPFLAGS) $< > $@.$$$$; \
|
||||
sed 's,\(.*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \
|
||||
rm -f $@.$$$$
|
||||
|
||||
-include $(DEPS)
|
||||
Reference in New Issue
Block a user