This repository has been archived by the owner on Jul 22, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 22
/
Copy pathMakefile.Flags
279 lines (229 loc) · 10.3 KB
/
Makefile.Flags
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
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
## @file
# SPDM library.
#
# Copyright (c) 2020, Intel Corporation. All rights reserved.<BR>
#
# SPDX-License-Identifier: BSD-2-Clause-Patent
#
##
#
# Build Configuration Macro Definition
#
ARCH = X64
TARGET = DEBUG
CRYPTO = MbedTls
TOOLCHAIN = VS2019
!IF "$(ARCH)" == "X64"
!MESSAGE ARCH=X64
!ELSEIF "$(ARCH)" == "Ia32"
!MESSAGE ARCH=Ia32
!ELSE
!ERROR Unknown ARCH!
!ENDIF
!IF "$(TARGET)" == "DEBUG"
!MESSAGE TARGET=DEBUG
!ELSEIF "$(TARGET)" == "RELEASE"
!MESSAGE TARGET=RELEASE
!ELSE
!ERROR Unknown TARGET!
!ENDIF
!IF "$(CRYPTO)" == "MbedTls"
!MESSAGE CRYPTO=MbedTls
!ELSEIF "$(CRYPTO)" == "Openssl"
!MESSAGE CRYPTO=Openssl
!ELSE
!ERROR Unknown CRYPTO!
!ENDIF
!IF "$(TOOLCHAIN)" == "VS2015"
!MESSAGE TOOLCHAIN=VS2015
!ELSEIF "$(TOOLCHAIN)" == "VS2019"
!MESSAGE TOOLCHAIN=VS2019
!ELSEIF "$(TOOLCHAIN)" == "CLANG"
!MESSAGE TOOLCHAIN=CLANG
!ELSEIF "$(TOOLCHAIN)" == "LIBFUZZER"
!MESSAGE TOOLCHAIN=LIBFUZZER
!ELSEIF "$(TOOLCHAIN)" == "CBMC"
!MESSAGE TOOLCHAIN=CBMC
!ELSE
!ERROR Unknown TOOLCHAIN!
!ENDIF
#
# Shell Command Macro
#
#CP = copy /y
CP = xcopy /y /s
MV = move /y
RM = del /f /q
MD = mkdir
RD = rmdir /s /q
#
# Tools definitions specific to this module
#
!IF "$(TOOLCHAIN)" == "VS2015"
VS_BIN_HOST = %VCINSTALLDIR%bin
VS_BIN_IA32 = %VCINSTALLDIR%bin
VS_BIN_X64 = %VCINSTALLDIR%bin\x86_amd64
!ELSEIF "$(TOOLCHAIN)" == "VS2019"
VS_BIN_HOST = %VCToolsInstallDir%bin\Hostx64\x64
VS_BIN_IA32 = %VCToolsInstallDir%bin\Hostx86\x86
VS_BIN_X64 = %VCToolsInstallDir%bin\Hostx64\x64
!ENDIF
MAKE = nmake.exe
MAKEFILE = Makefile
#
# CBMC test tool
#
!IF "$(TOOLCHAIN)" == "CBMC"
CC = goto-cl.exe
CC_OBJ_FLAG = /Fo
MBEDTLS_FLAGS = /wd4244 /wd4132 /wd4245 /wd4310 /wd4701 /wd4127
OPENSSL_FLAGS = /FIBase.h /wd4090 /wd4132 /wd4244 /wd4245 /wd4267 /wd4306 /wd4310 /wd4700 /wd4389 /wd4702 /wd4706 /wd4819
CMOCKA_FLAGS = /wd4204 /wd4133 /wd4267 /wd4701 /wd4702 /wd4703 /D _CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES=1 /D _CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES_COUNT=1 /D _CRT_NONSTDC_NO_WARNINGS=1
CC_FLAGS = /nologo /c /WX /W4 /Gs32768 /D UNICODE /Gy /EHs-c- /GR- /GF /Z7 /Oy- /D_CRT_SECURE_NO_WARNINGS /DCBMC_CC
!IF "$(TARGET)" == "DEBUG"
CC_FLAGS = $(CC_FLAGS) /Od
!ELSEIF "$(TARGET)" == "RELEASE"
CC_FLAGS = $(CC_FLAGS) /GL /O1b2s
!ENDIF
SLINK = echo
SLINK_OBJ_FLAG = >
SLINK_FLAGS =
DLINK = goto-cl.exe
DLINK_OBJECT_FILES = $(STATIC_LIBRARY_OBJECT_FILES)
DLINK_FLAGS =
#
# CLANG
#
!ELSEIF "$(TOOLCHAIN)" == "CLANG"
CC = clang.exe
CC_OBJ_FLAG = -o
MBEDTLS_FLAGS =
OPENSSL_FLAGS = -include Base.h -Wno-error=format -Wno-format
CMOCKA_FLAGS = -std=gnu99 -Wpedantic -Wall -Wshadow -Wmissing-prototypes -Wcast-align -Werror=address -Wstrict-prototypes -Werror=strict-prototypes -Wwrite-strings -Werror=write-strings -Werror-implicit-function-declaration -Wpointer-arith -Werror=pointer-arith -Wdeclaration-after-statement -Werror=declaration-after-statement -Wreturn-type -Werror=return-type -Wuninitialized -Werror=uninitialized -Werror=strict-overflow -Wstrict-overflow=2 -Wno-format-zero-length -Wmissing-field-initializers -Wformat-security -Werror=format-security -fno-common -Wformat -fno-common -fstack-protector-strong
CC_FLAGS = -c -g -fshort-wchar -fno-strict-aliasing -Wall -Wno-array-bounds -ffunction-sections -fdata-sections -fno-common -mno-red-zone -Wno-address -fno-asynchronous-unwind-tables -flto -DUSING_LTO -Wno-switch -funwind-tables -D_CRT_SECURE_NO_WARNINGS
!IF "$(TARGET)" == "DEBUG"
CC_FLAGS = $(CC_FLAGS) -O0 -gcodeview
!ELSEIF "$(TARGET)" == "RELEASE"
CC_FLAGS = $(CC_FLAGS) -Oz
!ENDIF
!IF "$(ARCH)" == "X64"
CC_FLAGS = $(CC_FLAGS) -m64 -mcmodel=small
!ELSEIF "$(ARCH)" == "Ia32"
CC_FLAGS = $(CC_FLAGS) -m32 -march=i586
!ENDIF
SLINK = llvm-lib.exe
SLINK_OBJ_FLAG = /OUT:
SLINK_FLAGS =
DLINK = lld-link.exe
DLINK_OBJECT_FILES = $(STATIC_LIBRARY_FILES)
DLINK_FLAGS = /out:"$(BIN_DIR)\$(BASE_NAME).exe" /base:0x10000000 /pdb:"$(BIN_DIR)\$(BASE_NAME).pdb" /NOLOGO /SUBSYSTEM:CONSOLE /NODEFAULTLIB:libcmt.lib /IGNORE:4086 /MLLVM:-exception-model=wineh /lldmap /OPT:REF
!IF "$(TARGET)" == "DEBUG"
DLINK_FLAGS = $(DLINK_FLAGS) /DEBUG:GHASH
!ELSEIF "$(TARGET)" == "RELEASE"
DLINK_FLAGS = $(DLINK_FLAGS)
!ENDIF
!IF "$(ARCH)" == "X64"
DLINK_FLAGS = $(DLINK_FLAGS) /MACHINE:AMD64
!ELSEIF "$(ARCH)" == "Ia32"
DLINK_FLAGS = $(DLINK_FLAGS) /MACHINE:I386
!ENDIF
!IF "$(ARCH)" == "X64"
DLINK_FLAGS = $(DLINK_FLAGS) /LIBPATH:"%VCToolsInstallDir%lib\x64" /LIBPATH:"%UniversalCRTSdkDir%lib\%UCRTVersion%\ucrt\x64" /LIBPATH:"%WindowsSdkDir%lib\%WindowsSDKLibVersion%\um\x64"
!ELSEIF "$(ARCH)" == "Ia32"
DLINK_FLAGS = $(DLINK_FLAGS) /LIBPATH:"%VCToolsInstallDir%lib\x86" /LIBPATH:"%UniversalCRTSdkDir%lib\%UCRTVersion%\ucrt\x86" /LIBPATH:"%WindowsSdkDir%lib\%WindowsSDKLibVersion%\um\x86"
!ENDIF
DLINK_FLAGS = $(DLINK_FLAGS) Kernel32.lib MSVCRTD.lib vcruntimed.lib ucrtd.lib Gdi32.lib User32.lib Winmm.lib Advapi32.lib ws2_32.lib
#
# LIBFUZZER
#
!ELSEIF "$(TOOLCHAIN)" == "LIBFUZZER"
CC = clang.exe
CC_OBJ_FLAG = -o
MBEDTLS_FLAGS =
OPENSSL_FLAGS = -include Base.h -Wno-error=format -Wno-format
CMOCKA_FLAGS = -std=gnu99 -Wpedantic -Wall -Wshadow -Wmissing-prototypes -Wcast-align -Werror=address -Wstrict-prototypes -Werror=strict-prototypes -Wwrite-strings -Werror=write-strings -Werror-implicit-function-declaration -Wpointer-arith -Werror=pointer-arith -Wdeclaration-after-statement -Werror=declaration-after-statement -Wreturn-type -Werror=return-type -Wuninitialized -Werror=uninitialized -Werror=strict-overflow -Wstrict-overflow=2 -Wno-format-zero-length -Wmissing-field-initializers -Wformat-security -Werror=format-security -fno-common -Wformat -fno-common -fstack-protector-strong
CC_FLAGS = -c -g -fshort-wchar -fno-strict-aliasing -Wall -Wno-array-bounds -ffunction-sections -fdata-sections -fno-common -mno-red-zone -Wno-address -fno-asynchronous-unwind-tables -flto -DUSING_LTO -Wno-switch -funwind-tables -D_CRT_SECURE_NO_WARNINGS -DTEST_WITH_LIBFUZZER=TRUE -O1 -fsanitize=fuzzer,address
!IF "$(TARGET)" == "DEBUG"
CC_FLAGS = $(CC_FLAGS) -O0 -gcodeview
!ELSEIF "$(TARGET)" == "RELEASE"
CC_FLAGS = $(CC_FLAGS) -Oz
!ENDIF
!IF "$(ARCH)" == "X64"
CC_FLAGS = $(CC_FLAGS) -m64 -mcmodel=small
!ELSEIF "$(ARCH)" == "Ia32"
CC_FLAGS = $(CC_FLAGS) -m32 -march=i586
!ENDIF
SLINK = llvm-lib.exe
SLINK_OBJ_FLAG = /OUT:
SLINK_FLAGS =
DLINK = lld-link.exe
DLINK_OBJECT_FILES = $(STATIC_LIBRARY_FILES)
DLINK_FLAGS = /out:"$(BIN_DIR)\$(BASE_NAME).exe" /base:0x10000000 /pdb:"$(BIN_DIR)\$(BASE_NAME).pdb" /NOLOGO /SUBSYSTEM:CONSOLE /NODEFAULTLIB:libcmt.lib /IGNORE:4086 /MLLVM:-exception-model=wineh /lldmap /OPT:REF
!IF "$(TARGET)" == "DEBUG"
DLINK_FLAGS = $(DLINK_FLAGS) /DEBUG:GHASH
!ELSEIF "$(TARGET)" == "RELEASE"
DLINK_FLAGS = $(DLINK_FLAGS)
!ENDIF
!IF "$(ARCH)" == "X64"
DLINK_FLAGS = $(DLINK_FLAGS) /MACHINE:AMD64
!ELSEIF "$(ARCH)" == "Ia32"
DLINK_FLAGS = $(DLINK_FLAGS) /MACHINE:I386
!ENDIF
!IF "$(ARCH)" == "X64"
DLINK_FLAGS = $(DLINK_FLAGS) /LIBPATH:"%VCToolsInstallDir%lib\x64" /LIBPATH:"%UniversalCRTSdkDir%lib\%UCRTVersion%\ucrt\x64" /LIBPATH:"%WindowsSdkDir%lib\%WindowsSDKLibVersion%\um\x64" /LIBPATH:"%LLVM_PATH%\lib\clang\9.0.0\lib\windows"
!ELSEIF "$(ARCH)" == "Ia32"
DLINK_FLAGS = $(DLINK_FLAGS) /LIBPATH:"%VCToolsInstallDir%lib\x86" /LIBPATH:"%UniversalCRTSdkDir%lib\%UCRTVersion%\ucrt\x86" /LIBPATH:"%WindowsSdkDir%lib\%WindowsSDKLibVersion%\um\x86" /LIBPATH:"%LLVMx86_PATH%\lib\clang\9.0.0\lib\windows"
!ENDIF
!IF "$(ARCH)" == "X64"
DLINK_FLAGS = $(DLINK_FLAGS) Kernel32.lib MSVCRTD.lib vcruntimed.lib ucrtd.lib Gdi32.lib User32.lib Winmm.lib Advapi32.lib ws2_32.lib clang_rt.asan_dynamic-x86_64.lib clang_rt.asan_dynamic_runtime_thunk-x86_64.lib clang_rt.fuzzer-x86_64.lib
!ELSEIF "$(ARCH)" == "Ia32"
DLINK_FLAGS = $(DLINK_FLAGS) Kernel32.lib MSVCRTD.lib vcruntimed.lib ucrtd.lib Gdi32.lib User32.lib Winmm.lib Advapi32.lib ws2_32.lib clang_rt.asan_dynamic-i386.lib clang_rt.asan_dynamic_runtime_thunk-i386.lib clang_rt.fuzzer-i386.lib
!ENDIF
#
# Visual Studio
#
!ELSE
CC = cl.exe
CC_OBJ_FLAG = /Fo:
MBEDTLS_FLAGS = /wd4244 /wd4132 /wd4245 /wd4310 /wd4701 /wd4127
OPENSSL_FLAGS = /FIBase.h /wd4090 /wd4132 /wd4244 /wd4245 /wd4267 /wd4306 /wd4310 /wd4700 /wd4389 /wd4702 /wd4706 /wd4819
CMOCKA_FLAGS = /wd4204 /wd4133 /wd4267 /wd4701 /wd4702 /wd4703 /D _CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES=1 /D _CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES_COUNT=1 /D _CRT_NONSTDC_NO_WARNINGS=1
CC_FLAGS = /nologo /c /WX /W4 /Gs32768 /D UNICODE /Gy /EHs-c- /GR- /GF /Z7 /Gw /Oy- /D_CRT_SECURE_NO_WARNINGS
CC_FLAGS = $(CC_FLAGS) /GS
!IF "$(TARGET)" == "DEBUG"
CC_FLAGS = $(CC_FLAGS) /Od
CC_FLAGS = $(CC_FLAGS) /RTCs
!ELSEIF "$(TARGET)" == "RELEASE"
CC_FLAGS = $(CC_FLAGS) /GL /O1b2s
!ENDIF
SLINK = lib.exe
SLINK_OBJ_FLAG = /OUT:
SLINK_FLAGS = /NOLOGO /LTCG
DLINK = link.exe
DLINK_OBJECT_FILES = $(STATIC_LIBRARY_FILES)
DLINK_FLAGS = /out:"$(BIN_DIR)\$(BASE_NAME).exe" /base:0x10000000 /pdb:"$(BIN_DIR)\$(BASE_NAME).pdb" /NOLOGO /SUBSYSTEM:CONSOLE /NODEFAULTLIB:libcmt.lib /IGNORE:4086 /MAP /OPT:REF
!IF "$(TARGET)" == "DEBUG"
DLINK_FLAGS = $(DLINK_FLAGS) /DEBUG
!ELSEIF "$(TARGET)" == "RELEASE"
DLINK_FLAGS = $(DLINK_FLAGS) /LTCG
!ENDIF
!IF "$(ARCH)" == "X64"
DLINK_FLAGS = $(DLINK_FLAGS) /MACHINE:AMD64
!ELSEIF "$(ARCH)" == "Ia32"
DLINK_FLAGS = $(DLINK_FLAGS) /MACHINE:I386
!ENDIF
!IF "$(TOOLCHAIN)" == "VS2015"
!IF "$(ARCH)" == "X64"
DLINK_FLAGS = $(DLINK_FLAGS) /LIBPATH:"%VCINSTALLDIR%Lib\AMD64" /LIBPATH:"%UniversalCRTSdkDir%lib\%UCRTVersion%\ucrt\x64" /LIBPATH:"%WindowsSdkDir%lib\%WindowsSDKLibVersion%\um\x64"
!ELSEIF "$(ARCH)" == "Ia32"
DLINK_FLAGS = $(DLINK_FLAGS) /LIBPATH:"%VCINSTALLDIR%Lib" /LIBPATH:"%UniversalCRTSdkDir%lib\%UCRTVersion%\ucrt\x86" /LIBPATH:"%WindowsSdkDir%lib\%WindowsSDKLibVersion%\um\x86"
!ENDIF
!ELSEIF "$(TOOLCHAIN)" == "VS2019"
!IF "$(ARCH)" == "X64"
DLINK_FLAGS = $(DLINK_FLAGS) /LIBPATH:"%VCToolsInstallDir%lib\x64" /LIBPATH:"%UniversalCRTSdkDir%lib\%UCRTVersion%\ucrt\x64" /LIBPATH:"%WindowsSdkDir%lib\%WindowsSDKLibVersion%\um\x64"
!ELSEIF "$(ARCH)" == "Ia32"
DLINK_FLAGS = $(DLINK_FLAGS) /LIBPATH:"%VCToolsInstallDir%lib\x86" /LIBPATH:"%UniversalCRTSdkDir%lib\%UCRTVersion%\ucrt\x86" /LIBPATH:"%WindowsSdkDir%lib\%WindowsSDKLibVersion%\um\x86"
!ENDIF
!ENDIF
DLINK_FLAGS = $(DLINK_FLAGS) Kernel32.lib MSVCRTD.lib vcruntimed.lib ucrtd.lib Gdi32.lib User32.lib Winmm.lib Advapi32.lib ws2_32.lib
!ENDIF