2019-02-14 03:25:34 +00:00
|
|
|
# This Makefile can be used with GNU Make or BSD Make
|
|
|
|
|
|
|
|
# override as desired
|
|
|
|
TYPE=kem
|
|
|
|
SCHEME=kyber768
|
|
|
|
IMPLEMENTATION=clean
|
|
|
|
|
|
|
|
SCHEME_DIR="../crypto_$(TYPE)/$(SCHEME)/$(IMPLEMENTATION)"
|
|
|
|
SCHEME_UPPERCASE=$(shell echo $(SCHEME) | tr a-z A-Z | sed 's/-//')
|
|
|
|
|
|
|
|
COMMON_DIR=../common
|
2019-02-18 15:07:01 +00:00
|
|
|
COMMON_FILES=$(COMMON_DIR)/fips202.c $(COMMON_DIR)/sha2.c
|
2019-02-18 15:19:07 +00:00
|
|
|
COMMON_HEADERS=$(COMMON_DIR)/fips202.h $(COMMON_DIR)/randombytes.h $(COMMON_DIR)/sha2.h
|
2019-02-14 03:25:34 +00:00
|
|
|
DEST_DIR=../bin
|
|
|
|
|
|
|
|
CFLAGS=-Wall -Wextra -Wpedantic -Werror -std=c99 -I$(COMMON_DIR) $(EXTRAFLAGS)
|
|
|
|
|
2019-02-18 15:07:01 +00:00
|
|
|
all: $(DEST_DIR)/functest_$(SCHEME)_$(IMPLEMENTATION) $(DEST_DIR)/testvectors_$(SCHEME)_$(IMPLEMENTATION)
|
2019-02-14 03:25:34 +00:00
|
|
|
|
2019-02-18 14:06:46 +00:00
|
|
|
.PHONY: rebuild-scheme
|
|
|
|
rebuild-scheme:
|
|
|
|
cd $(SCHEME_DIR) && make
|
|
|
|
|
2019-02-18 15:19:07 +00:00
|
|
|
$(DEST_DIR)/functest_$(SCHEME)_$(IMPLEMENTATION): rebuild-scheme crypto_$(TYPE)/functest.c $(COMMON_FILES) $(COMMON_DIR)/randombytes.c $(COMMON_HEADERS)
|
2019-02-14 03:25:34 +00:00
|
|
|
mkdir -p $(DEST_DIR)
|
2019-02-18 15:11:38 +00:00
|
|
|
$(CC) $(CFLAGS) -DPQCLEAN_NAMESPACE=PQCLEAN_$(SCHEME_UPPERCASE) -I$(SCHEME_DIR) crypto_$(TYPE)/testvectors.c $(COMMON_FILES) $(COMMON_DIR)/randombytes.c -o $@ -L$(SCHEME_DIR) -l$(SCHEME)_$(IMPLEMENTATION)
|
2019-02-18 15:07:01 +00:00
|
|
|
|
2019-02-18 15:19:07 +00:00
|
|
|
$(DEST_DIR)/testvectors_$(SCHEME)_$(IMPLEMENTATION): rebuild-scheme crypto_$(TYPE)/testvectors.c $(COMMON_FILES) $(COMMON_DIR)/notrandombytes.c $(COMMON_HEADERS)
|
2019-02-18 15:07:01 +00:00
|
|
|
mkdir -p $(DEST_DIR)
|
2019-02-18 15:11:38 +00:00
|
|
|
$(CC) $(CFLAGS) -DPQCLEAN_NAMESPACE=PQCLEAN_$(SCHEME_UPPERCASE) -I$(SCHEME_DIR) crypto_$(TYPE)/testvectors.c $(COMMON_FILES) $(COMMON_DIR)/notrandombytes.c -o $@ -L$(SCHEME_DIR) -l$(SCHEME)_$(IMPLEMENTATION)
|
2019-02-14 03:25:34 +00:00
|
|
|
|
2019-02-18 15:23:08 +00:00
|
|
|
.PHONY: clean
|
2019-02-14 03:25:34 +00:00
|
|
|
clean:
|
|
|
|
$(RM) $(DEST_DIR)/functest_$(SCHEME)_$(IMPLEMENTATION)
|
2019-02-18 15:07:01 +00:00
|
|
|
$(RM) $(DEST_DIR)/testvectors_$(SCHEME)_$(IMPLEMENTATION)
|