# This Makefile can be used with Microsoft Visual Studio's nmake using the command: # nmake /f Makefile.Microsoft_nmake # override as desired, use /E # vim: set ts=4 sw=4 et: TYPE=kem SCHEME=ml-kem-768 SCHEME_UPPERCASE=MLKEM768 IMPLEMENTATION=clean IMPLEMENTATION_UPPERCASE=CLEAN KAT_RNG=nist SCHEME_DIR=..\crypto_$(TYPE)\$(SCHEME)\$(IMPLEMENTATION) TEST_COMMON_DIR=..\test\common COMMON_DIR=..\common COMMON_OBJECTS=$(COMMON_DIR)\aes.obj $(COMMON_DIR)\fips202.obj $(COMMON_DIR)\sha2.obj $(COMMON_DIR)\nistseedexpander.obj $(COMMON_DIR)\sp800-185.obj COMMON_OBJECTS_NOPATH=aes.obj fips202.obj sha2.obj sp800-185.obj nistseedexpander.obj DEST_DIR=..\bin !IF "$(SCHEME)" == "falcon-512" INTEROP=falcon-padded-512 INTEROP_UPPERCASE=FALCONPADDED512 !ELSEIF "$(SCHEME)" == "falcon-1024" INTEROP=falcon-padded-1024 INTEROP_UPPERCASE=FALCONPADDED1024 !ELSEIF "$(SCHEME)" == "falcon-padded-512" INTEROP=falcon-512 INTEROP_UPPERCASE=FALCON512 !ELSEIF "$(SCHEME)" == "falcon-padded-1024" INTEROP=falcon-1024 INTEROP_UPPERCASE=FALCON1024 !ENDIF !IFDEF INTEROP INTEROP_DIR=..\crypto_$(TYPE)\$(INTEROP)\$(IMPLEMENTATION) !ENDIF CFLAGS=/nologo /O2 /I $(COMMON_DIR) /W4 /WX all: $(DEST_DIR)\functest_$(SCHEME)_$(IMPLEMENTATION).EXE $(DEST_DIR)\testvectors_$(SCHEME)_$(IMPLEMENTATION).EXE build-scheme: cd $(SCHEME_DIR) nmake /f Makefile.Microsoft_nmake cd ..\..\..\test clean-scheme: cd $(SCHEME_DIR) nmake /f Makefile.Microsoft_nmake clean cd ..\..\..\test !IFDEF INTEROP build-interop: cd $(INTEROP_DIR) nmake /f Makefile.Microsoft_nmake cd ..\..\..\test clean-interop: cd $(INTEROP_DIR) nmake /f Makefile.Microsoft_nmake clean cd ..\..\..\test !ENDIF functest: $(DEST_DIR)\functest_$(SCHEME)_$(IMPLEMENTATION).exe testvectors: $(DEST_DIR)\testvectors_$(SCHEME)_$(IMPLEMENTATION).exe printparams: $(DEST_DIR)\printparams_$(SCHEME)_$(IMPLEMENTATION).exe nistkat: $(DEST_DIR)\nistkat_$(SCHEME)_$(IMPLEMENTATION).exe !IFDEF INTEROP $(DEST_DIR)\functest_$(SCHEME)_$(IMPLEMENTATION).exe: build-scheme build-interop $(COMMON_OBJECTS) $(COMMON_DIR)\randombytes.obj -MKDIR $(DEST_DIR) -DEL functest.obj $(CC) /c crypto_$(TYPE)\functest.c $(CFLAGS) /I $(SCHEME_DIR) /DPQCLEAN_NAMESPACE=PQCLEAN_$(SCHEME_UPPERCASE)_$(IMPLEMENTATION_UPPERCASE) /DPQCLEAN_FALCON_TEST_INTEROP /DPQCLEAN_INTEROP_NAMESPACE=PQCLEAN_$(INTEROP_UPPERCASE)_$(IMPLEMENTATION_UPPERCASE) /DPQCLEAN_INTEROP_INCLUDE=$(INTEROP_DIR) LINK.EXE /STACK:8192000 /OUT:$@ functest.obj $(COMMON_OBJECTS_NOPATH) randombytes.obj $(SCHEME_DIR)\lib$(SCHEME)_$(IMPLEMENTATION).lib $(INTEROP_DIR)\lib$(INTEROP)_$(IMPLEMENTATION).lib Advapi32.lib !ELSE $(DEST_DIR)\functest_$(SCHEME)_$(IMPLEMENTATION).exe: build-scheme $(COMMON_OBJECTS) $(COMMON_DIR)\randombytes.obj -MKDIR $(DEST_DIR) -DEL functest.obj $(CC) /c crypto_$(TYPE)\functest.c $(CFLAGS) /I $(SCHEME_DIR) /DPQCLEAN_NAMESPACE=PQCLEAN_$(SCHEME_UPPERCASE)_$(IMPLEMENTATION_UPPERCASE) LINK.EXE /STACK:8192000 /OUT:$@ functest.obj $(COMMON_OBJECTS_NOPATH) randombytes.obj $(SCHEME_DIR)\lib$(SCHEME)_$(IMPLEMENTATION).lib Advapi32.lib !ENDIF $(DEST_DIR)\testvectors_$(SCHEME)_$(IMPLEMENTATION).exe: build-scheme $(COMMON_OBJECTS) $(TEST_COMMON_DIR)\notrandombytes.obj -MKDIR $(DEST_DIR) -DEL testvectors.obj $(CC) /c crypto_$(TYPE)\testvectors.c $(CFLAGS) /I $(SCHEME_DIR) /DPQCLEAN_NAMESPACE=PQCLEAN_$(SCHEME_UPPERCASE)_$(IMPLEMENTATION_UPPERCASE) LINK.EXE /STACK:8192000 /OUT:$@ testvectors.obj $(COMMON_OBJECTS_NOPATH) notrandombytes.obj $(SCHEME_DIR)\lib$(SCHEME)_$(IMPLEMENTATION).lib $(DEST_DIR)\printparams_$(SCHEME)_$(IMPLEMENTATION).exe: crypto_$(TYPE)\printparams.c $(SCHEME_DIR)\api.h -MKDIR $(DEST_DIR) -DEL printparams.obj $(CC) /c crypto_$(TYPE)\printparams.c $(CFLAGS) /I $(SCHEME_DIR) /DPQCLEAN_NAMESPACE=PQCLEAN_$(SCHEME_UPPERCASE)_$(IMPLEMENTATION_UPPERCASE) LINK.EXE /OUT:$@ printparams.obj $(DEST_DIR)\nistkat_$(SCHEME)_$(IMPLEMENTATION).exe: build-scheme $(COMMON_OBJECTS) $(TEST_COMMON_DIR)\$(KAT_RNG)katrng.obj -MKDIR $(DEST_DIR) -DEL $(KAT_RNG)kat.obj $(CC) /c crypto_$(TYPE)\$(KAT_RNG)kat.c $(CFLAGS) /I $(SCHEME_DIR) /DPQCLEAN_NAMESPACE=PQCLEAN_$(SCHEME_UPPERCASE)_$(IMPLEMENTATION_UPPERCASE) LINK.EXE /STACK:8192000 /OUT:$@ $(KAT_RNG)kat.obj $(COMMON_OBJECTS_NOPATH) $(KAT_RNG)katrng.obj $(SCHEME_DIR)\lib$(SCHEME)_$(IMPLEMENTATION).lib clean: -DEL functest.obj testvectors.obj printparams.obj $(KAT_RNG)kat.obj -DEL $(COMMON_OBJECTS_NOPATH) randombytes.obj notrandombytes.obj -DEL $(DEST_DIR)\functest_$(SCHEME)_$(IMPLEMENTATION).exe -DEL $(DEST_DIR)\testvectors_$(SCHEME)_$(IMPLEMENTATION).exe -DEL $(DEST_DIR)\printparams_$(SCHEME)_$(IMPLEMENTATION).exe -DEL $(DEST_DIR)\nistkat_$(SCHEME)_$(IMPLEMENTATION).exe