]> gitweb.factorcode.org Git - factor.git/blobdiff - Nmakefile
scryfall: parse mtga deck format
[factor.git] / Nmakefile
old mode 100755 (executable)
new mode 100644 (file)
index e964105..f87fb76
--- a/Nmakefile
+++ b/Nmakefile
-LINK_FLAGS = /nologo shell32.lib\r
-CL_FLAGS = /nologo /O2 /W3\r
-\r
-EXE_OBJS = factor.dll.lib vm\main-windows-nt.obj vm\factor.res\r
-\r
-DLL_OBJS = vm\os-windows-nt.obj \\r
-       vm\os-windows.obj \\r
-       vm\aging_collector.obj \\r
-       vm\alien.obj \\r
-       vm\arrays.obj \\r
-       vm\bignum.obj \\r
-       vm\booleans.obj \\r
-       vm\byte_arrays.obj \\r
-       vm\callbacks.obj \\r
-       vm\callstack.obj \\r
-       vm\code_blocks.obj \\r
-       vm\code_heap.obj \\r
-       vm\compaction.obj \\r
-       vm\contexts.obj \\r
-       vm\data_heap.obj \\r
-       vm\data_heap_checker.obj \\r
-       vm\debug.obj \\r
-       vm\dispatch.obj \\r
-       vm\entry_points.obj \\r
-       vm\errors.obj \\r
-       vm\factor.obj \\r
-       vm\free_list.obj \\r
-       vm\full_collector.obj \\r
-       vm\gc.obj \\r
-       vm\image.obj \\r
-       vm\inline_cache.obj \\r
-       vm\instruction_operands.obj \\r
-       vm\io.obj \\r
-       vm\jit.obj \\r
-       vm\math.obj \\r
-       vm\nursery_collector.obj \\r
-       vm\object_start_map.obj \\r
-       vm\objects.obj \\r
-       vm\primitives.obj \\r
-       vm\profiler.obj \\r
-       vm\quotations.obj \\r
-       vm\run.obj \\r
-       vm\strings.obj \\r
-       vm\to_tenured_collector.obj \\r
-       vm\tuples.obj \\r
-       vm\utilities.obj \\r
-        vm\vm.obj \\r
-       vm\words.obj\r
-\r
-.cpp.obj:\r
-       cl /EHsc $(CL_FLAGS) /Fo$@ /c $<\r
-\r
-.rs.res:\r
-       rc $<\r
-\r
-all: factor.com factor.exe\r
-\r
-factor.dll.lib: $(DLL_OBJS)\r
-       link $(LINK_FLAGS) /implib:factor.dll.lib /out:factor.dll /dll $(DLL_OBJS)\r
-\r
-factor.com: $(EXE_OBJS)\r
-       link $(LINK_FLAGS) /out:factor.com /SUBSYSTEM:console $(EXE_OBJS)\r
-\r
-factor.exe: $(EXE_OBJS)\r
-       link $(LINK_FLAGS) /out:factor.exe /SUBSYSTEM:windows $(EXE_OBJS)\r
-\r
-clean:\r
-       del vm\*.obj\r
-       del factor.lib\r
-       del factor.com\r
-       del factor.exe\r
-       del factor.dll\r
-       del factor.dll.lib\r
-\r
-.PHONY: all clean\r
-\r
-.SUFFIXES: .rs\r
+VERSION = 0.100
+
+# Crazy hack to do shell commands
+# We do it in Nmakefile because that way we don't have to invoke build through build.cmd
+# and we can just do ``nmake /f Nmakefile x86-64-vista`` or similar
+# and we still get the git branch, id, etc
+
+!IF [git describe --all > git-describe.tmp] == 0
+GIT_DESCRIBE = \
+!INCLUDE <git-describe.tmp>
+!IF [del git-describe.tmp] == 0
+!ENDIF
+!ENDIF
+
+!IF [git rev-parse HEAD > git-id.tmp] == 0
+GIT_ID = \
+!INCLUDE <git-id.tmp>
+!IF [del git-id.tmp] == 0
+!ENDIF
+!ENDIF
+
+!IF [git rev-parse --abbrev-ref HEAD > git-branch.tmp] == 0
+GIT_BRANCH = \
+!INCLUDE <git-branch.tmp>
+!IF [del git-branch.tmp] == 0
+!ENDIF
+!ENDIF
+
+GIT_LABEL = $(GIT_DESCRIBE)-$(GIT_ID)
+
+!IF DEFINED(PLATFORM)
+
+LINK_FLAGS = /nologo shell32.lib user32.lib
+CL_FLAGS = /nologo /O2 /WX /W3 /D_CRT_SECURE_NO_WARNINGS /DFACTOR_VERSION=$(VERSION) /DFACTOR_GIT_LABEL=$(GIT_LABEL)
+CL_FLAGS_VISTA = /D_WIN32_WINNT=0x0600
+
+!IF "$(PLATFORM)" == "x86-32"
+LINK_FLAGS = $(LINK_FLAGS) /safeseh /largeaddressaware
+PLAF_DLL_OBJS = vm\os-windows-x86.32.obj vm\safeseh.obj vm\cpu-x86.obj
+SUBSYSTEM_COM_FLAGS = console,"5.01"
+SUBSYSTEM_EXE_FLAGS = windows,"5.01"
+
+!ELSEIF "$(PLATFORM)" == "x86-32-vista"
+LINK_FLAGS = $(LINK_FLAGS) /safeseh /largeaddressaware
+CL_FLAGS = $(CL_FLAGS) $(CL_FLAGS_VISTA)
+PLAF_DLL_OBJS = vm\os-windows-x86.32.obj vm\safeseh.obj vm\cpu-x86.obj
+SUBSYSTEM_COM_FLAGS = console
+SUBSYSTEM_EXE_FLAGS = windows
+
+!ELSEIF "$(PLATFORM)" == "x86-64"
+PLAF_DLL_OBJS = vm\os-windows-x86.64.obj vm\cpu-x86.obj
+SUBSYSTEM_COM_FLAGS = console,"5.02"
+SUBSYSTEM_EXE_FLAGS = windows,"5.02"
+
+
+!ELSEIF "$(PLATFORM)" == "x86-64-vista"
+CL_FLAGS = $(CL_FLAGS) $(CL_FLAGS_VISTA)
+PLAF_DLL_OBJS = vm\os-windows-x86.64.obj vm\cpu-x86.obj
+SUBSYSTEM_COM_FLAGS = console
+SUBSYSTEM_EXE_FLAGS = windows
+
+!ELSE
+CL_FLAGS = $(CL_FLAGS) $(CL_FLAGS_VISTA)
+PLAF_DLL_OBJS = vm\os-windows-x86.64.obj vm\cpu-x86.obj
+SUBSYSTEM_COM_FLAGS = console
+SUBSYSTEM_EXE_FLAGS = windows
+
+!ENDIF
+
+!IF DEFINED(DEBUG)
+LINK_FLAGS = $(LINK_FLAGS) /DEBUG
+CL_FLAGS = $(CL_FLAGS) /Zi /DFACTOR_DEBUG
+!ENDIF
+
+!IF DEFINED(REPRODUCIBLE)
+CL_FLAGS = $(CL_FLAGS) /DFACTOR_REPRODUCIBLE
+!ENDIF
+
+ML_FLAGS = /nologo /safeseh
+
+EXE_OBJS = vm\main-windows.obj vm\factor.res
+
+DLL_OBJS = $(PLAF_DLL_OBJS) \
+       vm\os-windows.obj \
+       vm\aging_collector.obj \
+       vm\alien.obj \
+       vm\arrays.obj \
+       vm\bignum.obj \
+       vm\byte_arrays.obj \
+       vm\callbacks.obj \
+       vm\callstack.obj \
+       vm\code_blocks.obj \
+       vm\code_heap.obj \
+       vm\compaction.obj \
+       vm\contexts.obj \
+       vm\data_heap.obj \
+       vm\data_heap_checker.obj \
+       vm\debug.obj \
+       vm\dispatch.obj \
+       vm\entry_points.obj \
+       vm\errors.obj \
+       vm\factor.obj \
+       vm\full_collector.obj \
+       vm\gc.obj \
+       vm\image.obj \
+       vm\inline_cache.obj \
+       vm\instruction_operands.obj \
+       vm\io.obj \
+       vm\jit.obj \
+       vm\math.obj \
+       vm\mvm.obj \
+       vm\mvm-windows.obj \
+       vm\nursery_collector.obj \
+       vm\object_start_map.obj \
+       vm\objects.obj \
+       vm\primitives.obj \
+       vm\quotations.obj \
+       vm\run.obj \
+       vm\safepoints.obj \
+       vm\sampling_profiler.obj \
+       vm\strings.obj \
+       vm\to_tenured_collector.obj \
+       vm\tuples.obj \
+       vm\utilities.obj \
+       vm\vm.obj \
+       vm\words.obj
+
+# batch mode has ::
+.cpp.obj::
+       cl /EHsc $(CL_FLAGS) /MP /Fovm/ /c $<
+
+.c.obj::
+       cl /EHsc $(CL_FLAGS) /MP /Fovm/ /c $<
+
+.asm.obj:
+       ml $(ML_FLAGS) /Fo$@ /c $<
+
+.rs.res:
+       rc $<
+
+libfactor-ffi-test.dll: vm/ffi_test.obj
+       link $(LINK_FLAGS) /out:libfactor-ffi-test.dll /dll /def:vm\ffi_test.def vm/ffi_test.obj
+
+factor.dll.lib: $(DLL_OBJS)
+       link $(LINK_FLAGS) /implib:factor.dll.lib /out:factor.dll /dll $(DLL_OBJS)
+
+factor.com: $(EXE_OBJS) $(DLL_OBJS)
+       link $(LINK_FLAGS) /out:factor.com /SUBSYSTEM:$(SUBSYSTEM_COM_FLAGS) $(EXE_OBJS) $(DLL_OBJS)
+
+factor.exe: $(EXE_OBJS) $(DLL_OBJS)
+       link $(LINK_FLAGS) /out:factor.exe /SUBSYSTEM:$(SUBSYSTEM_EXE_FLAGS) $(EXE_OBJS) $(DLL_OBJS)
+
+# If we compile factor.exe, run mt.exe, and run factor.exe,
+# then Windows caches the manifest. Even on a recompile without applying
+# the mt.exe tool, if the factor.exe.manifest file is present, the manifest
+# is applied. To avoid this, we delete the .manifest file on clean
+# and copy it from a reference file on compilation and mt.exe.
+#
+factor.exe.manifest: factor.exe
+       copy factor.exe.manifest.in factor.exe.manifest
+       mt -manifest factor.exe.manifest -outputresource:"factor.exe;#1"
+
+all: factor.com factor.exe factor.dll.lib libfactor-ffi-test.dll
+
+!ENDIF
+
+default:
+       @echo Usage: nmake /f Nmakefile platform
+       @echo Where platform is one of:
+       @echo x86-32
+       @echo x86-64
+       @echo x86-32-vista
+       @echo x86-64-vista
+       @exit 1
+
+x86-32:
+       nmake /nologo PLATFORM=x86-32 /f Nmakefile all
+
+x86-64:
+       nmake /nologo PLATFORM=x86-64 /f Nmakefile all
+
+x86-32-vista:
+       nmake /nologo PLATFORM=x86-32-vista /f Nmakefile all
+
+x86-64-vista:
+       nmake /nologo PLATFORM=x86-64-vista /f Nmakefile all
+
+clean:
+       del vm\*.obj
+       if exist vm\factor.res del vm\factor.res
+       if exist factor.lib del factor.lib
+       if exist factor.com del factor.com
+       if exist factor.exe del factor.exe
+       if exist factor.exe.manifest del factor.exe.manifest
+       if exist factor.exp del factor.exp
+       if exist factor.dll del factor.dll
+       if exist factor.dll.lib del factor.dll.lib
+       if exist factor.dll.exp del factor.dll.exp
+       if exist libfactor-ffi-test.dll del libfactor-ffi-test.dll
+       if exist libfactor-ffi-test.exp del libfactor-ffi-test.exp
+       if exist libfactor-ffi-test.lib del libfactor-ffi-test.lib
+
+.PHONY: all default x86-32 x86-64 x86-32-vista x86-64-vista clean factor.exe.manifest
+
+.SUFFIXES: .rs