CC=/usr/bin/gcc
LDFLAGS= -g -Wall -Wextra -O3 -fomit-frame-pointer -march=native -fPIC

all: damier_enc PQCgenKAT_kem

SOURCES= cbd.c fips202.c fips202x4.c poly.c  cpucycles.c reduce.c precomp.c ntt.c polyvec.c owcpa.c  kem.c verify.c genmatrix.c keccak4x/KeccakP-1600-times4-SIMD256.o

HEADERS= cbd.h fips202.h fips202x4.h params.h poly.h reduce.h ntt.h polyvec.h owcpa.h verify.h api.h cpucycles.h genmatrix.h


keccak4x/KeccakP-1600-times4-SIMD256.o: keccak4x/KeccakP-1600-times4-SIMD256.c \
																				keccak4x/align.h \
																				keccak4x/brg_endian.h \
																				keccak4x/KeccakP-1600-times4-SIMD256.c \
																				keccak4x/KeccakP-1600-times4-SnP.h \
																				keccak4x/KeccakP-1600-unrolling.macros \
																				keccak4x/SIMD256-config.h
	$(CC) $(CFLAGS) -c keccak4x/KeccakP-1600-times4-SIMD256.c -o $@


damier_enc: $(HEADERS) $(SOURCES) randombytes.h randombytes.c speed.c 
	$(CC) -o $@ $(SOURCES) $(LDFLAGS) randombytes.c speed.c 

PQCgenKAT_kem: $(SOURCES) $(HEADERS) PQCgenKAT_kem.c rng.c rng.h
	$(CC) $(NISTFLAGS) -o $@ $(SOURCES) -I. rng.c PQCgenKAT_kem.c -lcrypto -mavx2
	

.PHONY: test clean

test: 
	@echo "test..."
	./damier_enc
	
clean:
	-rm damier_enc

