-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathMakefile.windows
170 lines (122 loc) · 6.67 KB
/
Makefile.windows
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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
CXX = cl
LINKER = link
AR = lib
AR_OPTIONS = /nologo
# Compiler Flags
GENERAL_FLAGS = /nologo /sdl /Gd /FC
ABI_FLAGS = /MD /EHsc /GS /Gy /Gm-
LANG_FLAGS = /GR /Zc:forScope /Zc:inline /Zc:wchar_t /permissive-
OPT_FLAGS = /O2 /Ot /Oi /Oy
WARN_FLAGS = /W3 /WX- /wd4197
LDFLAGS =
# Path to OpenSSL static library and development headers
OPENSSL_PATH = ..\openssl
OPENSSL_INC = $(OPENSSL_PATH)\include
OPENSSL_LIB = $(OPENSSL_PATH)\lib\libeay32.lib
EXE_LINK_CMD = $(LINKER)
POST_LINK_CMD =
LIB_LINKS_TO = user32.lib ws2_32.lib
TEST_LIB_DEP = gdi32.lib
EXE_LINKS_TO = lib\vgp_encryption.lib $(LIB_LINKS_TO)
BUILD_FLAGS = $(GENERAL_FLAGS) $(ABI_FLAGS) $(LANG_FLAGS) $(OPT_FLAGS) $(WARN_FLAGS)
# The primary target
all: create_dirs libs tests
# Executable targets
TESTS = bin\tests.exe
VGP_TEST = bin\vgp_encryption_test.exe
VGP_LIB = lib\vgp_encryption.lib
tests: $(TESTS) $(VGP_TEST)
libs: $(VGP_LIB)
# Misc targets
run: create_dirs $(TESTS) $(VGP_TEST)
@echo Executing VGP component tests ...
@$(TESTS)
@echo off
@echo.
@echo on
@echo Executing VGP positive and negative tests
@$(VGP_TEST)
# create output directories
create_dirs:
@if not exist bin mkdir bin
@if not exist lib mkdir lib
@if not exist obj mkdir obj
# delete output directories
clean:
@if exist bin rmdir /S /Q bin
@if exist lib rmdir /S /Q lib
@if exist obj rmdir /S /Q obj
# Object Files
LIBOBJS = obj\aes256.obj obj\aes256ctr.obj obj\aes256gcm.obj \
obj\encryption.obj obj\encryption_core.obj obj\encryption_error.obj obj\curve25519.obj \
obj\ed25519.obj obj\fe.obj obj\ge.obj obj\os_rand.obj obj\rand.obj \
obj\sha512.obj obj\shake256.obj obj\shake256_rand.obj obj\utils.obj
VGP_TESTOBJS = obj\encryption_test.obj obj\vgp_assert.obj
TESTOBJS = obj\aes256_test.obj obj\aes256ctr_test.obj obj\aes256gcm_test.obj \
obj\encryption_core_test.obj obj\curve25519_test.obj obj\convert_test.obj \
obj\shake256_test.obj obj\vgp_assert.obj obj\test.obj
# Executable targets
$(VGP_TEST): $(VGP_LIB) $(VGP_TESTOBJS)
@$(EXE_LINK_CMD) $(LDFLAGS) $(VGP_TESTOBJS) $(EXE_LINKS_TO) /OUT:$@
@$(POST_LINK_CMD)
$(TESTS): $(VGP_LIB) $(TESTOBJS)
@$(EXE_LINK_CMD) $(LDFLAGS) $(TESTOBJS) $(EXE_LINKS_TO) $(TEST_LIB_DEP) $(OPENSSL_LIB) /OUT:$@
@$(POST_LINK_CMD)
# Library targets
lib\vgp_encryption.lib: $(LIBOBJS)
@$(AR) $(LIBOBJS) /OUT:$@
# Build Commands
obj\aes256.obj: src/aes256.c include/aes256.h include/utils.h
@$(CXX) $(BUILD_FLAGS) /Iinclude /nologo /c src/aes256.c /Fo$@
obj\aes256ctr.obj: src/aes256ctr.c include/aes256ctr.h include/aes256.h include/utils.h
@$(CXX) $(BUILD_FLAGS) /Iinclude /nologo /c src/aes256ctr.c /Fo$@
obj\aes256gcm.obj: src/aes256gcm.c include/aes256gcm.h include/aes256.h include/utils.h
@$(CXX) $(BUILD_FLAGS) /Iinclude /nologo /c src/aes256gcm.c /Fo$@
obj\encryption.obj: src/encryption.cpp include/encryption.h include/encryption_core.h
@$(CXX) $(BUILD_FLAGS) /Iinclude /nologo /c src/encryption.cpp /Fo$@
obj\encryption_core.obj: src/encryption_core.c include/aes256ctr.h include/aes256gcm.h include/encryption_core.h include/encryption_error.h include/curve25519.h include/ed25519.h include/rand.h include/shake256.h include/utils.h
@$(CXX) $(BUILD_FLAGS) /Iinclude /nologo /c src/encryption_core.c /Fo$@
obj\encryption_error.obj: src/encryption_error.c include/encryption_error.h
@$(CXX) $(BUILD_FLAGS) /Iinclude /nologo /c src/encryption_error.c /Fo$@
obj\curve25519.obj: src/curve25519.c include/curve25519.h include/fe.h include/rand.h include/utils.h
@$(CXX) $(BUILD_FLAGS) /Iinclude /nologo /c src/curve25519.c /Fo$@
obj\ed25519.obj: src/ed25519.c include/ed25519.h include/curve25519.h include/ge.h include/rand.h include/sha512.h include/utils.h
@$(CXX) $(BUILD_FLAGS) /Iinclude /nologo /c src/ed25519.c /Fo$@
obj\fe.obj: src/fe.c include/fe.h include/utils.h
@$(CXX) $(BUILD_FLAGS) /Iinclude /nologo /c src/fe.c /Fo$@
obj\ge.obj: src/ge.c include/ge.h include/fe_25_5.h
@$(CXX) $(BUILD_FLAGS) /Iinclude /nologo /c src/ge.c /Fo$@
obj\os_rand.obj: src/os_rand.c include/os_rand.h
@$(CXX) $(BUILD_FLAGS) /Iinclude /nologo /c src/os_rand.c /Fo$@
obj\rand.obj: src/rand.c include/rand.h include/os_rand.h include/shake256_rand.h
@$(CXX) $(BUILD_FLAGS) /Iinclude /nologo /c src/rand.c /Fo$@
obj\sha512.obj: src/sha512.c include/sha512.h
@$(CXX) $(BUILD_FLAGS) /Iinclude /nologo /c src/sha512.c /Fo$@
obj\shake256.obj: src/shake256.c include/shake256.h
@$(CXX) $(BUILD_FLAGS) /Iinclude /nologo /c src/shake256.c /Fo$@
obj\shake256_rand.obj: src/shake256_rand.c include/shake256_rand.h include/shake256.h include/utils.h
@$(CXX) $(BUILD_FLAGS) /Iinclude /nologo /c src/shake256_rand.c /Fo$@
obj\utils.obj: src/utils.c include/utils.h
@$(CXX) $(BUILD_FLAGS) /Iinclude /nologo /c src/utils.c /Fo$@
# VGP test source code
obj\encryption_test.obj: test/encryption_test.cpp include/aes256ctr.h include/aes256gcm.h include/encryption.h include/encryption_error.h include/curve25519.h include/ed25519.h include/rand.h include/shake256.h include/utils.h
@$(CXX) $(BUILD_FLAGS) /Iinclude /nologo /c test/encryption_test.cpp /Fo$@
# Additional test source code
obj\aes256_test.obj: test/aes256_test.c include/aes256.h include/rand.h include/utils.h
@$(CXX) $(BUILD_FLAGS) /Iinclude /I$(OPENSSL_INC) /nologo /c test/aes256_test.c /Fo$@
obj\aes256ctr_test.obj: test/aes256ctr_test.c include/aes256ctr.h include/rand.h include/utils.h
@$(CXX) $(BUILD_FLAGS) /Iinclude /I$(OPENSSL_INC) /nologo /c test/aes256ctr_test.c /Fo$@
obj\aes256gcm_test.obj: test/aes256gcm_test.c include/aes256gcm.h include/utils.h
@$(CXX) $(BUILD_FLAGS) /Iinclude /I$(OPENSSL_INC) /nologo /c test/aes256gcm_test.c /Fo$@
obj\encryption_core_test.obj: test/encryption_core_test.c include/encryption_core.h include/curve25519.h include/ed25519.h include/rand.h include/utils.h
@$(CXX) $(BUILD_FLAGS) /Iinclude /I$(OPENSSL_INC) /nologo /c test/encryption_core_test.c /Fo$@
obj\curve25519_test.obj: test/curve25519_test.c include/curve25519.h include/rand.h include/utils.h
@$(CXX) $(BUILD_FLAGS) /Iinclude /I$(OPENSSL_INC) /nologo /c test/curve25519_test.c /Fo$@
obj\convert_test.obj: test/convert_test.c include/curve25519.h include/ed25519.h include/utils.h
@$(CXX) $(BUILD_FLAGS) /Iinclude /I$(OPENSSL_INC) /nologo /c test/convert_test.c /Fo$@
obj\shake256_test.obj: test/shake256_test.c include/shake256_rand.h include/utils.h
@$(CXX) $(BUILD_FLAGS) /Iinclude /I$(OPENSSL_INC) /nologo /c test/shake256_test.c /Fo$@
obj\vgp_assert.obj: test/vgp_assert.c include/utils.h
@$(CXX) $(BUILD_FLAGS) /Iinclude /I$(OPENSSL_INC) /nologo /c test/vgp_assert.c /Fo$@
obj\test.obj: test/test.c include/shake256_rand.h
@$(CXX) $(BUILD_FLAGS) /Iinclude /I$(OPENSSL_INC) /nologo /c test/test.c /Fo$@