Rework Makefile such that SHA512 is only
compiled if requested.

CQ-DEPEND=CL:419327

Change-Id: I641010065f9f0b8decb21cb491e60e53f98f7505
Signed-off-by: nagendra modadugu <ngm@google.com>
diff --git a/Makefile b/Makefile
index afbe6fe..983138f 100644
--- a/Makefile
+++ b/Makefile
@@ -10,7 +10,7 @@
 SOURCES += p256_prng.c
 SOURCES += sha.c
 SOURCES += sha256.c
-ifneq ($(SHA512_SUPPORT),)
+ifeq ($(CONFIG_UPTO_SHA512),y)
 SOURCES += sha384.c
 SOURCES += sha512.c
 endif
@@ -26,6 +26,9 @@
 CFLAGS += -Iinclude
 CFLAGS += -Wall -Werror
 CFLAGS += -DTHIRD_PARTY
+ifeq ($(CONFIG_UPTO_SHA512),y)
+CFLAGS += -DSHA512_SUPPORT
+endif
 
 OBJS = $(patsubst %.c,$(obj)/%.o,$(SOURCES))
 DEPS = $(patsubst %.c,$(obj)/%.d,$(SOURCES))