xref: /isa-l/Makefile.nmake (revision 28305ade9e07213a2c602697a6a3a1e1eed2acca)
1########################################################################
2#  Copyright(c) 2011-2024 Intel Corporation All rights reserved.
3#
4#  Redistribution and use in source and binary forms, with or without
5#  modification, are permitted provided that the following conditions
6#  are met:
7#    * Redistributions of source code must retain the above copyright
8#      notice, this list of conditions and the following disclaimer.
9#    * Redistributions in binary form must reproduce the above copyright
10#      notice, this list of conditions and the following disclaimer in
11#      the documentation and/or other materials provided with the
12#      distribution.
13#    * Neither the name of Intel Corporation nor the names of its
14#      contributors may be used to endorse or promote products derived
15#      from this software without specific prior written permission.
16#
17#  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18#  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19#  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
20#  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
21#  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22#  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23#  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24#  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25#  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26#  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27#  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28#
29#  SPDX-License-Identifier: BSD-3-Clause
30########################################################################
31
32# This file can be auto-regenerated with $make -f Makefile.unx Makefile.nmake
33
34objs = \
35	bin\ec_base.obj \
36	bin\raid_base.obj \
37	bin\crc_base.obj \
38	bin\crc64_base.obj \
39	bin\igzip.obj \
40	bin\hufftables_c.obj \
41	bin\igzip_base.obj \
42	bin\igzip_icf_base.obj \
43	bin\adler32_base.obj \
44	bin\flatten_ll.obj \
45	bin\encode_df.obj \
46	bin\igzip_icf_body.obj \
47	bin\huff_codes.obj \
48	bin\igzip_inflate.obj \
49	bin\mem_zero_detect_base.obj \
50	bin\ec_highlevel_func.obj \
51	bin\gf_vect_mul_sse.obj \
52	bin\gf_vect_mul_avx.obj \
53	bin\gf_vect_dot_prod_sse.obj \
54	bin\gf_vect_dot_prod_avx.obj \
55	bin\gf_vect_dot_prod_avx2.obj \
56	bin\gf_2vect_dot_prod_sse.obj \
57	bin\gf_3vect_dot_prod_sse.obj \
58	bin\gf_4vect_dot_prod_sse.obj \
59	bin\gf_5vect_dot_prod_sse.obj \
60	bin\gf_6vect_dot_prod_sse.obj \
61	bin\gf_2vect_dot_prod_avx.obj \
62	bin\gf_3vect_dot_prod_avx.obj \
63	bin\gf_4vect_dot_prod_avx.obj \
64	bin\gf_5vect_dot_prod_avx.obj \
65	bin\gf_6vect_dot_prod_avx.obj \
66	bin\gf_2vect_dot_prod_avx2.obj \
67	bin\gf_3vect_dot_prod_avx2.obj \
68	bin\gf_4vect_dot_prod_avx2.obj \
69	bin\gf_5vect_dot_prod_avx2.obj \
70	bin\gf_6vect_dot_prod_avx2.obj \
71	bin\gf_vect_mad_sse.obj \
72	bin\gf_2vect_mad_sse.obj \
73	bin\gf_3vect_mad_sse.obj \
74	bin\gf_4vect_mad_sse.obj \
75	bin\gf_5vect_mad_sse.obj \
76	bin\gf_6vect_mad_sse.obj \
77	bin\gf_vect_mad_avx.obj \
78	bin\gf_2vect_mad_avx.obj \
79	bin\gf_3vect_mad_avx.obj \
80	bin\gf_4vect_mad_avx.obj \
81	bin\gf_5vect_mad_avx.obj \
82	bin\gf_6vect_mad_avx.obj \
83	bin\gf_vect_mad_avx2.obj \
84	bin\gf_2vect_mad_avx2.obj \
85	bin\gf_3vect_mad_avx2.obj \
86	bin\gf_4vect_mad_avx2.obj \
87	bin\gf_5vect_mad_avx2.obj \
88	bin\gf_6vect_mad_avx2.obj \
89	bin\ec_multibinary.obj \
90	bin\gf_vect_mad_avx2_gfni.obj \
91	bin\gf_2vect_mad_avx2_gfni.obj \
92	bin\gf_3vect_mad_avx2_gfni.obj \
93	bin\gf_4vect_mad_avx2_gfni.obj \
94	bin\gf_5vect_mad_avx2_gfni.obj \
95	bin\gf_vect_dot_prod_avx512.obj \
96	bin\gf_2vect_dot_prod_avx512.obj \
97	bin\gf_3vect_dot_prod_avx512.obj \
98	bin\gf_4vect_dot_prod_avx512.obj \
99	bin\gf_5vect_dot_prod_avx512.obj \
100	bin\gf_6vect_dot_prod_avx512.obj \
101	bin\gf_vect_dot_prod_avx512_gfni.obj \
102	bin\gf_vect_dot_prod_avx2_gfni.obj \
103	bin\gf_2vect_dot_prod_avx2_gfni.obj \
104	bin\gf_3vect_dot_prod_avx2_gfni.obj \
105	bin\gf_2vect_dot_prod_avx512_gfni.obj \
106	bin\gf_3vect_dot_prod_avx512_gfni.obj \
107	bin\gf_4vect_dot_prod_avx512_gfni.obj \
108	bin\gf_5vect_dot_prod_avx512_gfni.obj \
109	bin\gf_6vect_dot_prod_avx512_gfni.obj \
110	bin\gf_vect_mad_avx512.obj \
111	bin\gf_2vect_mad_avx512.obj \
112	bin\gf_3vect_mad_avx512.obj \
113	bin\gf_4vect_mad_avx512.obj \
114	bin\gf_5vect_mad_avx512.obj \
115	bin\gf_6vect_mad_avx512.obj \
116	bin\gf_vect_mad_avx512_gfni.obj \
117	bin\gf_2vect_mad_avx512_gfni.obj \
118	bin\gf_3vect_mad_avx512_gfni.obj \
119	bin\gf_4vect_mad_avx512_gfni.obj \
120	bin\gf_5vect_mad_avx512_gfni.obj \
121	bin\gf_6vect_mad_avx512_gfni.obj \
122	bin\xor_gen_sse.obj \
123	bin\pq_gen_sse.obj \
124	bin\xor_check_sse.obj \
125	bin\pq_check_sse.obj \
126	bin\pq_gen_avx.obj \
127	bin\xor_gen_avx.obj \
128	bin\pq_gen_avx2.obj \
129	bin\xor_gen_avx512.obj \
130	bin\pq_gen_avx512.obj \
131	bin\raid_multibinary.obj \
132	bin\crc16_t10dif_01.obj \
133	bin\crc16_t10dif_by4.obj \
134	bin\crc16_t10dif_02.obj \
135	bin\crc16_t10dif_by16_10.obj \
136	bin\crc16_t10dif_copy_by4.obj \
137	bin\crc16_t10dif_copy_by4_02.obj \
138	bin\crc32_ieee_01.obj \
139	bin\crc32_ieee_02.obj \
140	bin\crc32_ieee_by4.obj \
141	bin\crc32_ieee_by16_10.obj \
142	bin\crc32_iscsi_01.obj \
143	bin\crc32_iscsi_00.obj \
144	bin\crc32_iscsi_by16_10.obj \
145	bin\crc_multibinary.obj \
146	bin\crc64_multibinary.obj \
147	bin\crc64_ecma_refl_by8.obj \
148	bin\crc64_ecma_refl_by16_10.obj \
149	bin\crc64_ecma_norm_by8.obj \
150	bin\crc64_ecma_norm_by16_10.obj \
151	bin\crc64_iso_refl_by8.obj \
152	bin\crc64_iso_refl_by16_10.obj \
153	bin\crc64_iso_norm_by8.obj \
154	bin\crc64_iso_norm_by16_10.obj \
155	bin\crc64_jones_refl_by8.obj \
156	bin\crc64_jones_refl_by16_10.obj \
157	bin\crc64_jones_norm_by8.obj \
158	bin\crc64_jones_norm_by16_10.obj \
159	bin\crc64_rocksoft_refl_by8.obj \
160	bin\crc64_rocksoft_refl_by16_10.obj \
161	bin\crc64_rocksoft_norm_by8.obj \
162	bin\crc64_rocksoft_norm_by16_10.obj \
163	bin\crc32_gzip_refl_by8.obj \
164	bin\crc32_gzip_refl_by8_02.obj \
165	bin\crc32_gzip_refl_by16_10.obj \
166	bin\igzip_body.obj \
167	bin\igzip_finish.obj \
168	bin\igzip_icf_body_h1_gr_bt.obj \
169	bin\igzip_icf_finish.obj \
170	bin\rfc1951_lookup.obj \
171	bin\adler32_sse.obj \
172	bin\adler32_avx2_4.obj \
173	bin\igzip_multibinary.obj \
174	bin\igzip_update_histogram_01.obj \
175	bin\igzip_update_histogram_04.obj \
176	bin\igzip_decode_block_stateless_01.obj \
177	bin\igzip_decode_block_stateless_04.obj \
178	bin\igzip_inflate_multibinary.obj \
179	bin\encode_df_04.obj \
180	bin\encode_df_06.obj \
181	bin\proc_heap.obj \
182	bin\igzip_deflate_hash.obj \
183	bin\igzip_gen_icf_map_lh1_06.obj \
184	bin\igzip_gen_icf_map_lh1_04.obj \
185	bin\igzip_set_long_icf_fg_04.obj \
186	bin\igzip_set_long_icf_fg_06.obj \
187	bin\mem_zero_detect_avx512.obj \
188	bin\mem_zero_detect_avx2.obj \
189	bin\mem_zero_detect_avx.obj \
190	bin\mem_zero_detect_sse.obj \
191	bin\mem_multibinary.obj
192
193INCLUDES   = -I./ -Ierasure_code/ -Iraid/ -Icrc/ -Iigzip/ -Iprograms/ -Imem/ -Iinclude/ -Itests/fuzz/ -Iexamples/ec/
194# Modern asm feature level, consider upgrading nasm/yasm before decreasing feature_level
195FEAT_FLAGS = -DHAVE_AS_KNOWS_AVX512 -DAS_FEATURE_LEVEL=10
196CFLAGS_REL = -O2 -DNDEBUG /Z7 /Gy
197CFLAGS_DBG = -Od -DDEBUG /Z7
198LINKFLAGS  = -nologo -incremental:no -debug
199CFLAGS     = $(CFLAGS_REL) -nologo -D_USE_MATH_DEFINES $(FEAT_FLAGS) $(INCLUDES) $(D)
200AFLAGS     = -f win64 $(FEAT_FLAGS) $(INCLUDES) $(D)
201CC         = cl
202# or CC    = icl -Qstd=c99
203AS         = nasm
204
205lib: bin static dll
206static: bin isa-l_static.lib isa-l.h
207dll: bin isa-l.dll isa-l.h
208
209bin: ; -mkdir $@
210
211isa-l_static.lib: $(objs)
212	lib -out:$@ @<<
213$?
214<<
215
216!IF [rc] == 0
217isa-l.dll: isa-l.res
218!ELSE
219!MESSAGE Optionally install rc to set file version info
220!ENDIF
221
222isa-l.dll: $(objs)
223	link -out:$@ -dll -def:isa-l.def $(LINKFLAGS) @<<
224$?
225<<
226
227isa-l.res: isa-l.h
228	rc /fo $@ isa-l.rc
229
230{erasure_code}.c.obj:
231	$(CC) $(CFLAGS) /c -Fo$@ $?
232{erasure_code}.asm.obj:
233	$(AS) $(AFLAGS) -o $@ $?
234
235{raid}.c.obj:
236	$(CC) $(CFLAGS) /c -Fo$@ $?
237{raid}.asm.obj:
238	$(AS) $(AFLAGS) -o $@ $?
239
240{crc}.c.obj:
241	$(CC) $(CFLAGS) /c -Fo$@ $?
242{crc}.asm.obj:
243	$(AS) $(AFLAGS) -o $@ $?
244
245{igzip}.c.obj:
246	$(CC) $(CFLAGS) /c -Fo$@ $?
247{igzip}.asm.obj:
248	$(AS) $(AFLAGS) -o $@ $?
249
250{programs}.c.obj:
251	$(CC) $(CFLAGS) /c -Fo$@ $?
252{programs}.asm.obj:
253	$(AS) $(AFLAGS) -o $@ $?
254
255{mem}.c.obj:
256	$(CC) $(CFLAGS) /c -Fo$@ $?
257{mem}.asm.obj:
258	$(AS) $(AFLAGS) -o $@ $?
259
260
261# Examples
262ex = \
263	xor_example.exe \
264	crc_simple_test.exe \
265	crc64_example.exe \
266	igzip_example.exe \
267	igzip_sync_flush_example.exe \
268	ec_simple_example.exe \
269	ec_piggyback_example.exe
270
271{examples\ec}.c.obj:
272	$(CC) $(CFLAGS) /c -Fo$@ $?
273
274ex: lib $(ex)
275
276$(ex): $(@B).obj
277
278.obj.exe:
279	link /out:$@ $(LINKFLAGS) isa-l.lib $?
280
281# Check tests
282checks = \
283	gf_vect_mul_test.exe \
284	erasure_code_test.exe \
285	gf_inverse_test.exe \
286	erasure_code_update_test.exe \
287	xor_gen_test.exe \
288	pq_gen_test.exe \
289	xor_check_test.exe \
290	pq_check_test.exe \
291	crc16_t10dif_test.exe \
292	crc16_t10dif_copy_test.exe \
293	crc64_funcs_test.exe \
294	crc32_funcs_test.exe \
295	igzip_rand_test.exe \
296	igzip_wrapper_hdr_test.exe \
297	checksum32_funcs_test.exe \
298	mem_zero_detect_test.exe
299
300checks: lib $(checks)
301$(checks): $(@B).obj
302check: $(checks)
303	!$?
304
305# Unit tests
306tests = \
307	gf_vect_mul_base_test.exe \
308	gf_vect_dot_prod_base_test.exe \
309	gf_vect_dot_prod_test.exe \
310	gf_vect_mad_test.exe \
311	erasure_code_base_test.exe
312
313tests: lib $(tests)
314$(tests): $(@B).obj
315
316# Performance tests
317perfs = \
318	gf_vect_mul_perf.exe \
319	gf_vect_dot_prod_perf.exe \
320	gf_vect_dot_prod_1tbl.exe \
321	erasure_code_perf.exe \
322	erasure_code_base_perf.exe \
323	erasure_code_update_perf.exe \
324	xor_gen_perf.exe \
325	pq_gen_perf.exe \
326	crc16_t10dif_perf.exe \
327	crc16_t10dif_copy_perf.exe \
328	crc16_t10dif_op_perf.exe \
329	crc32_ieee_perf.exe \
330	crc32_iscsi_perf.exe \
331	crc64_funcs_perf.exe \
332	crc32_gzip_refl_perf.exe \
333	adler32_perf.exe \
334	mem_zero_detect_perf.exe
335
336perfs: lib $(perfs)
337$(perfs): $(@B).obj
338perf: $(perfs)
339	!$?
340
341progs = \
342	igzip.exe
343
344progs: lib $(progs)
345igzip.exe: programs\igzip_cli.obj
346	link /out:$@ $(LINKFLAGS) isa-l.lib $?
347
348isa-l.h:
349	@echo /**>> $@
350	@echo *  @file isa-l.h>> $@
351	@echo *  @brief Include for ISA-L library>> $@
352	@echo */>> $@
353	@echo.>> $@
354	@echo #ifndef _ISAL_H_>> $@
355	@echo #define _ISAL_H_>> $@
356	@echo.>> $@
357	@echo #define ISAL_MAJOR_VERSION 2 >> $@
358	@echo #define ISAL_MINOR_VERSION 31 >> $@
359	@echo #define ISAL_PATCH_VERSION 1 >> $@
360	@echo #define ISAL_MAKE_VERSION(maj, min, patch)  ((maj) * 0x10000 + (min) * 0x100 + (patch))>> $@
361	@echo #define ISAL_VERSION ISAL_MAKE_VERSION(ISAL_MAJOR_VERSION, ISAL_MINOR_VERSION, ISAL_PATCH_VERSION)>> $@
362	@echo.>> $@
363	@echo #ifndef RC_INVOKED>> $@
364	@echo #include ^<isa-l/crc.h^>>> $@
365	@echo #include ^<isa-l/crc64.h^>>> $@
366	@echo #include ^<isa-l/erasure_code.h^>>> $@
367	@echo #include ^<isa-l/gf_vect_mul.h^>>> $@
368	@echo #include ^<isa-l/igzip_lib.h^>>> $@
369	@echo #include ^<isa-l/mem_routines.h^>>> $@
370	@echo #include ^<isa-l/raid.h^>>> $@
371	@echo #endif // RC_INVOKED>> $@
372	@echo #endif //_ISAL_H_>> $@
373
374clean:
375	-if exist *.obj del *.obj
376	-if exist bin\*.obj del bin\*.obj
377	-if exist isa-l_static.lib del isa-l_static.lib
378	-if exist *.exe del *.exe
379	-if exist *.pdb del *.pdb
380	-if exist isa-l.lib del isa-l.lib
381	-if exist isa-l.dll del isa-l.dll
382	-if exist isa-l.exp del isa-l.exp
383	-if exist isa-l.res del isa-l.res
384
385zlib.lib:
386igzip_perf.exe:  zlib.lib
387igzip_inflate_test.exe:  zlib.lib
388