1 # Regenerate nmake file from makefiles or check its consistency
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
9 Makefile.nmake tst.nmake
: FORCE
11 @echo
'########################################################################' > $@
12 @cat LICENSE | sed
-e
's/^/#/ ' >> $@
13 @echo
'########################################################################' >> $@
15 @echo
'# This file can be auto-regenerated with $$make -f Makefile.unx Makefile.nmake' >> $@
17 @echo
-n
'objs =' >> $@
18 @
$(foreach o
, $(subst /,\\,$(objs
:.o
=.obj
)), printf
" %s\n\t%s" \\ $(o
) >> $@
; )
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)' >> $@
30 @echo
'# or CC = icl -Qstd=c99' >> $@
31 @echo
'AS = nasm' >> $@
33 @echo
'lib: bin static dll' >> $@
34 @echo
'static: bin isa-l_static.lib' >> $@
35 @echo
'dll: bin isa-l.dll' >> $@
37 @echo
'bin: ; -mkdir $$@' >> $@
39 @echo
'isa-l_static.lib: $$(objs)' >> $@
40 @echo
' lib -out:$$@ @<<' >> $@
44 @echo
'isa-l.dll: $$(objs)' >> $@
45 @echo
' link -out:$$@ -dll -def:isa-l.def $$(LINKFLAGS) @<<' >> $@
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
) >> $@
; )
53 @echo
"# Examples" >> $@
55 @
$(foreach ex
, $(notdir $(examples
)), printf
" %s\n\t%s.exe" \\ $(ex
) >> $@
; )
58 @echo
'ex: lib $$(ex)' >> $@
60 @echo
'$$(ex): $$(@B).obj' >> $@
63 @echo
'.obj.exe:' >> $@
64 @echo
' link /out:$$@ $$(LINKFLAGS) isa-l.lib $$?' >> $@
66 @echo
'# Check tests' >> $@
67 @echo
-n
'checks =' >> $@
68 @
$(foreach check, $(notdir $(check_tests
)), printf
" %s\n\t%s.exe" \\ $(check) >> $@
; )
71 @echo
'checks: lib $$(checks)' >> $@
72 @echo
'$$(checks): $$(@B).obj' >> $@
73 @echo
'check: $$(checks)' >> $@
76 @echo
'# Unit tests' >> $@
77 @echo
-n
'tests =' >> $@
78 @
$(foreach test, $(notdir $(unit_tests
)), printf
" %s\n\t%s.exe" \\ $(test) >> $@
; )
81 @echo
'tests: lib $$(tests)' >> $@
82 @echo
'$$(tests): $$(@B).obj' >> $@
84 @echo
'# Performance tests' >> $@
85 @echo
-n
'perfs =' >> $@
86 @
$(foreach perf
, $(notdir $(perf_tests
)), printf
" %s\n\t%s.exe" \\ $(perf
) >> $@
; )
89 @echo
'perfs: lib $$(perfs)' >> $@
90 @echo
'$$(perfs): $$(@B).obj' >> $@
92 @echo
-n
'progs =' >> $@
93 @
$(foreach prog
, $(notdir $(bin_PROGRAMS
)), printf
" %s\n\t%s.exe" \\ $(prog
) >> $@
; )
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
)) >> $@
; )
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' >> $@
110 $(if
$(findstring igzip
,$(units
)),@echo
'zlib.lib:' >> $@
)
111 @cat
$(foreach unit
,$(units
), $(unit
)/Makefile.am
) | sed \
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' \
120 -e
's/LDLIBS *+=//' \
121 -e
's/-lz/zlib.lib/' \