CC = /usr/bin/cc
CFLAGS = -Wall -Wextra -march=native -mtune=native -O3 -fomit-frame-pointer 
NISTFLAGS = -O3 -fomit-frame-pointer -march=native -fPIC
SOURCES = sign.c polyvec.c packing.c poly.c reduce.c ntt.c rounding.c fips202.c
HEADERS = api.h params.h polyvec.h packing.h poly.h reduce.h ntt.h \
  rounding.h fips202.h

all: aigis_sig PQCgenKAT_sign

aigis_sig: $(SOURCES) randombytes.c aigis_sig.c \
  speed.c cpucycles.c $(HEADERS) randombytes.h speed.h \
  cpucycles.h
	$(CC) $(CFLAGS) $(SOURCES) randombytes.c aigis_sig.c \
	  speed.c cpucycles.c -o $@

PQCgenKAT_sign: $(SOURCES) rng.c PQCgenKAT_sign.c $(HEADERS) rng.h
	$(CC) $(NISTFLAGS) $(SOURCES) rng.c PQCgenKAT_sign.c -o $@ -lcrypto
	
.PHONY: test kat clean

test: 
	@echo "test speed..."
	./aigis_sig
	
	
kat:
	@echo "generate kat files..." 
	./PQCgenKAT_sign
	
	
clean:
	rm -f aigis_sig
	rm -f PQCgenKAT_sign
