-
Notifications
You must be signed in to change notification settings - Fork 12
/
Makefile.Microsoft_nmake
87 lines (66 loc) · 3.95 KB
/
Makefile.Microsoft_nmake
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
# SPDX-License-Identifier: Apache-2.0
CFLAGS = /nologo /O2 /Imlkem /Imlkem/fips202 /Imlkem/fips202/native /Imlkem/sys /Imlkem/native
OBJ_FILES = .\mlkem\*.obj \
.\mlkem\fips202\*.obj \
BUILD_DIR = test\build
MLKEM512_BUILD_DIR = $(BUILD_DIR)\mlkem512
MLKEM768_BUILD_DIR = $(BUILD_DIR)\mlkem768
MLKEM1024_BUILD_DIR = $(BUILD_DIR)\mlkem1024
OBJ_FILES_512 = $(subst .\,$(MLKEM512_BUILD_DIR)\,$(OBJ_FILES))
OBJ_FILES_768 = $(subst .\,$(MLKEM768_BUILD_DIR)\,$(OBJ_FILES))
OBJ_FILES_1024 = $(subst .\,$(MLKEM1024_BUILD_DIR)\,$(OBJ_FILES))
# NOTE: We currently only build code for non-opt code, as we haven't yet made the assembly compatible on Windows
!IFNDEF OPT
OPT = 0
!ENDIF
{test/notrandombytes}.c{$(BUILD_DIR)\randombytes}.obj::
@if NOT EXIST $(BUILD_DIR)\randombytes mkdir $(BUILD_DIR)\randombytes
$(CC) $(CFLAGS) /c /Fo$(BUILD_DIR)\randombytes\ $<
# compilation for mlkem512
{mlkem}.c{$(MLKEM512_BUILD_DIR)\mlkem}.obj::
@if NOT EXIST $(MLKEM512_BUILD_DIR)\mlkem mkdir $(MLKEM512_BUILD_DIR)\mlkem
$(CC) $(CFLAGS) /D MLKEM_K=2 /c /Fo$(MLKEM512_BUILD_DIR)\mlkem\ $<
{mlkem\fips202}.c{$(MLKEM512_BUILD_DIR)\mlkem\fips202}.obj::
@if NOT EXIST $(MLKEM512_BUILD_DIR)\mlkem\fips202 mkdir $(MLKEM512_BUILD_DIR)\mlkem\fips202
$(CC) $(CFLAGS) /D MLKEM_K=2 /c /Fo$(MLKEM512_BUILD_DIR)\mlkem\fips202\ $<
{test}.c{$(MLKEM512_BUILD_DIR)\test}.obj::
@if NOT EXIST $(MLKEM512_BUILD_DIR)\test mkdir $(MLKEM512_BUILD_DIR)\test
$(CC) $(CFLAGS) /D MLKEM_K=2 /c /Fo$(MLKEM512_BUILD_DIR)\test\ $<
# compilation for mlkem768
{mlkem}.c{$(MLKEM768_BUILD_DIR)\mlkem}.obj::
@if NOT EXIST $(MLKEM768_BUILD_DIR)\mlkem mkdir $(MLKEM768_BUILD_DIR)\mlkem
$(CC) $(CFLAGS) /D MLKEM_K=3 /c /Fo$(MLKEM768_BUILD_DIR)\mlkem\ $<
{mlkem\fips202}.c{$(MLKEM768_BUILD_DIR)\mlkem\fips202}.obj::
@if NOT EXIST $(MLKEM768_BUILD_DIR)\mlkem\fips202 mkdir $(MLKEM768_BUILD_DIR)\mlkem\fips202
$(CC) $(CFLAGS) /D MLKEM_K=3 /c /Fo$(MLKEM768_BUILD_DIR)\mlkem\fips202\ $<
{test}.c{$(MLKEM768_BUILD_DIR)\test}.obj::
@if NOT EXIST $(MLKEM768_BUILD_DIR)\test mkdir $(MLKEM768_BUILD_DIR)\test
$(CC) $(CFLAGS) /D MLKEM_K=3 /c /Fo$(MLKEM768_BUILD_DIR)\test\ $<
# compilation for mlkem1024
{mlkem}.c{$(MLKEM1024_BUILD_DIR)\mlkem}.obj::
@if NOT EXIST $(MLKEM1024_BUILD_DIR)\mlkem mkdir $(MLKEM1024_BUILD_DIR)\mlkem
$(CC) $(CFLAGS) /D MLKEM_K=4 /c /Fo$(MLKEM1024_BUILD_DIR)\mlkem\ $<
{mlkem\fips202}.c{$(MLKEM1024_BUILD_DIR)\mlkem\fips202}.obj::
@if NOT EXIST $(MLKEM1024_BUILD_DIR)\mlkem\fips202 mkdir $(MLKEM1024_BUILD_DIR)\mlkem\fips202
$(CC) $(CFLAGS) /D MLKEM_K=4 /c /Fo$(MLKEM1024_BUILD_DIR)\mlkem\fips202\ $<
{test}.c{$(MLKEM1024_BUILD_DIR)\test}.obj::
@if NOT EXIST $(MLKEM1024_BUILD_DIR)\test mkdir $(MLKEM1024_BUILD_DIR)\test
$(CC) $(CFLAGS) /D MLKEM_K=4 /c /Fo$(MLKEM1024_BUILD_DIR)\test\ $<
# compile functional test for mlkem512
test_mlkem512: $(OBJ_FILES_512) $(MLKEM512_BUILD_DIR)\test\test_mlkem.obj $(BUILD_DIR)\randombytes\notrandombytes.obj
@if NOT EXIST $(MLKEM512_BUILD_DIR)\bin mkdir $(MLKEM512_BUILD_DIR)\bin
$(CC) $(CFLAGS) /D MLKEM_K=2 /Fe$(MLKEM512_BUILD_DIR)\bin\test_mlkem512 $** /link
# compile functional test for mlkem768
test_mlkem768: $(OBJ_FILES_768) $(MLKEM768_BUILD_DIR)\test\test_mlkem.obj $(BUILD_DIR)\randombytes\notrandombytes.obj
@if NOT EXIST $(MLKEM768_BUILD_DIR)\bin mkdir $(MLKEM768_BUILD_DIR)\bin
$(CC) $(CFLAGS) /D MLKEM_K=3 /Fe$(MLKEM768_BUILD_DIR)\bin\test_mlkem768 $** /link
# compile functional test for mlkem1024
test_mlkem1024: $(OBJ_FILES_1024) $(MLKEM1024_BUILD_DIR)\test\test_mlkem.obj $(BUILD_DIR)\randombytes\notrandombytes.obj
@if NOT EXIST $(MLKEM1024_BUILD_DIR)\bin mkdir $(MLKEM1024_BUILD_DIR)\bin
$(CC) $(CFLAGS) /D MLKEM_K=4 /Fe$(MLKEM1024_BUILD_DIR)\bin\test_mlkem1024 $** /link
quickcheck: test_mlkem512 test_mlkem768 test_mlkem1024
$(MLKEM512_BUILD_DIR)\bin\test_mlkem512.exe
$(MLKEM768_BUILD_DIR)\bin\test_mlkem768.exe
$(MLKEM1024_BUILD_DIR)\bin\test_mlkem1024.exe
clean:
-DEL $(BUILD_DIR)