CC=gcc
IDIR=./include
LDIR=./include
ODIR=./out
_DEPS = ROMprotocol.h KeyGen.h Stage2.h defines.h
DEPS = $(pathsbst %,(IDIR)/%,%(_DEPS))


CFLAGS= -I. -T$(IDIR)


.PHONY: all debug clean 

all: main.c ROMprotocol.c KeyGen.c MutualAttestation.c
	${CC} -o $(ODIR)/main main.c KeyGen.c ROMprotocol.c MutualAttestation.c -lm -lmbedcrypto -lmbedtls -lmbedx509 

debug:
	${CC} -gdwarf-2 -g3 -o $(ODIR)/dbg-main main.c KeyGen.c ROMprotocol.c MutualAttestation.c -lm -lmbedcrypto -lmbedtls -lmbedx509 

trial:
	${CC} -g -o $(ODIR)/trial ECCtrial.c -lm -lmbedcrypto -lmbedtls -lmbedx509 

remake:
	rm -r $(ODIR)/*
	${CC} -o $(ODIR)/main main.c KeyGen.c ROMprotocol.c MutualAttestation.c -lm -lmbedcrypto -lmbedtls -lmbedx509

clean: 
	rm -r $(ODIR)/* 
	rm -r ./keys/*
	rm -r ./SecureStorage/*.pem
	rm -r ./SecureStorage/*.der

	

#client - scp keys/Alias_pub.pem pi@10.42.0.13:/home/pi/GIT/openSSL-DICE/trial5/clientkeys/Client1_pub.pem
#server - scp keys/Alias_pub.pem pi@10.42.0.91:/home/pi/GIT/openSSL-DICE/trial5/clientkeys/Server_pub.pem