]> git.proxmox.com Git - ceph.git/blob - ceph/src/isa-l/tools/gen_nmake.mk
import quincy beta 17.1.0
[ceph.git] / ceph / src / isa-l / tools / gen_nmake.mk
1 # Regenerate nmake file from makefiles or check its consistency
2
3 test_nmake_file: tst.nmake
4 @diff -u Makefile.nmake tst.nmake || (echo Potential nmake consistency issue; $(RM) tst.nmake; false;)
5 @echo No nmake consistency issues
6 @$(RM) tst.nmake
7
8 FORCE:
9 Makefile.nmake tst.nmake: FORCE
10 @echo Regenerating $@
11 @echo '########################################################################' > $@
12 @cat LICENSE | sed -e 's/^/#/ ' >> $@
13 @echo '########################################################################' >> $@
14 @echo '' >> $@
15 @echo '# This file can be auto-regenerated with $$make -f Makefile.unx Makefile.nmake' >> $@
16 @echo '' >> $@
17 @echo -n 'objs =' >> $@
18 @$(foreach o, $(subst /,\\,$(objs:.o=.obj)), printf " %s\n\t%s" \\ $(o) >> $@; )
19 @echo '' >> $@
20 @echo '' >> $@
21 @echo 'INCLUDES = $(INCLUDE)' >> $@
22 @echo '# Modern asm feature level, consider upgrading nasm/yasm before decreasing feature_level' >> $@
23 @echo 'FEAT_FLAGS = -DHAVE_AS_KNOWS_AVX512 -DAS_FEATURE_LEVEL=10' >> $@
24 @echo 'CFLAGS_REL = -O2 -DNDEBUG /Z7 /MD /Gy' >> $@
25 @echo 'CFLAGS_DBG = -Od -DDEBUG /Z7 /MDd' >> $@
26 @echo 'LINKFLAGS = -nologo -incremental:no -debug' >> $@
27 @echo 'CFLAGS = $$(CFLAGS_REL) -nologo -D_USE_MATH_DEFINES $$(FEAT_FLAGS) $$(INCLUDES) $$(D)' >> $@
28 @echo 'AFLAGS = -f win64 $$(FEAT_FLAGS) $$(INCLUDES) $$(D)' >> $@
29 @echo 'CC = cl' >> $@
30 @echo '# or CC = icl -Qstd=c99' >> $@
31 @echo 'AS = nasm' >> $@
32 @echo '' >> $@
33 @echo 'lib: bin static dll' >> $@
34 @echo 'static: bin isa-l_static.lib' >> $@
35 @echo 'dll: bin isa-l.dll' >> $@
36 @echo '' >> $@
37 @echo 'bin: ; -mkdir $$@' >> $@
38 @echo '' >> $@
39 @echo 'isa-l_static.lib: $$(objs)' >> $@
40 @echo ' lib -out:$$@ @<<' >> $@
41 @echo '$$?' >> $@
42 @echo '<<' >> $@
43 @echo '' >> $@
44 @echo 'isa-l.dll: $$(objs)' >> $@
45 @echo ' link -out:$$@ -dll -def:isa-l.def $$(LINKFLAGS) @<<' >> $@
46 @echo '$$?' >> $@
47 @echo '<<' >> $@
48 @echo '' >> $@
49 @$(foreach b, $(units), \
50 printf "{%s}.c.obj:\n\t\$$(CC) \$$(CFLAGS) /c -Fo\$$@ \$$?\n{%s}.asm.obj:\n\t\$$(AS) \$$(AFLAGS) -o \$$@ \$$?\n\n" $(b) $(b) >> $@; )
51 @echo '' >> $@
52 ifneq (,$(examples))
53 @echo "# Examples" >> $@
54 @echo -n 'ex =' >> $@
55 @$(foreach ex, $(notdir $(examples)), printf " %s\n\t%s.exe" \\ $(ex) >> $@; )
56 @echo '' >> $@
57 @echo '' >> $@
58 @echo 'ex: lib $$(ex)' >> $@
59 @echo '' >> $@
60 @echo '$$(ex): $$(@B).obj' >> $@
61 endif
62 @echo '' >> $@
63 @echo '.obj.exe:' >> $@
64 @echo ' link /out:$$@ $$(LINKFLAGS) isa-l.lib $$?' >> $@
65 @echo '' >> $@
66 @echo '# Check tests' >> $@
67 @echo -n 'checks =' >> $@
68 @$(foreach check, $(notdir $(check_tests)), printf " %s\n\t%s.exe" \\ $(check) >> $@; )
69 @echo '' >> $@
70 @echo '' >> $@
71 @echo 'checks: lib $$(checks)' >> $@
72 @echo '$$(checks): $$(@B).obj' >> $@
73 @echo 'check: $$(checks)' >> $@
74 @echo ' !$$?' >> $@
75 @echo '' >> $@
76 @echo '# Unit tests' >> $@
77 @echo -n 'tests =' >> $@
78 @$(foreach test, $(notdir $(unit_tests)), printf " %s\n\t%s.exe" \\ $(test) >> $@; )
79 @echo '' >> $@
80 @echo '' >> $@
81 @echo 'tests: lib $$(tests)' >> $@
82 @echo '$$(tests): $$(@B).obj' >> $@
83 @echo '' >> $@
84 @echo '# Performance tests' >> $@
85 @echo -n 'perfs =' >> $@
86 @$(foreach perf, $(notdir $(perf_tests)), printf " %s\n\t%s.exe" \\ $(perf) >> $@; )
87 @echo '' >> $@
88 @echo '' >> $@
89 @echo 'perfs: lib $$(perfs)' >> $@
90 @echo '$$(perfs): $$(@B).obj' >> $@
91 @echo '' >> $@
92 @echo -n 'progs =' >> $@
93 @$(foreach prog, $(notdir $(bin_PROGRAMS)), printf " %s\n\t%s.exe" \\ $(prog) >> $@; )
94 @echo '' >> $@
95 @echo '' >> $@
96 @echo 'progs: lib $$(progs)' >> $@
97 @$(foreach p, $(notdir $(bin_PROGRAMS)), \
98 printf "%s.exe: %s\n\tlink /out:\$$@ \$$(LINKFLAGS) isa-l.lib \$$?\n" $(p) $(subst /,\\,$(programs_$(p)_SOURCES:.c=.obj)) >> $@; )
99 @echo '' >> $@
100 @echo 'clean:' >> $@
101 @echo ' -if exist *.obj del *.obj' >> $@
102 @echo ' -if exist bin\*.obj del bin\*.obj' >> $@
103 @echo ' -if exist isa-l_static.lib del isa-l_static.lib' >> $@
104 @echo ' -if exist *.exe del *.exe' >> $@
105 @echo ' -if exist *.pdb del *.pdb' >> $@
106 @echo ' -if exist isa-l.lib del isa-l.lib' >> $@
107 @echo ' -if exist isa-l.dll del isa-l.dll' >> $@
108 @echo ' -if exist isa-l.exp del isa-l.exp' >> $@
109 @echo '' >> $@
110 $(if $(findstring igzip,$(units)),@echo 'zlib.lib:' >> $@ )
111 @cat $(foreach unit,$(units), $(unit)/Makefile.am) | sed \
112 -e '/: /!d' \
113 -e 's/\([^ :]*\)[ ]*/\1.exe /g' \
114 -e :c -e 's/:\(.*\).exe/:\1/;tc' \
115 -e 's/\.o[ $$]/.obj /g' \
116 -e 's/\.o\.exe[ ]:/.obj:/g' \
117 -e '/CFLAGS_.*+=/d' \
118 -e '/:.*\%.*:/d' \
119 -e 's/ :/:/' \
120 -e 's/LDLIBS *+=//' \
121 -e 's/-lz/zlib.lib/' \
122 -e 's/ $$//' \
123 >> $@