]> gitweb.factorcode.org Git - factor.git/blob - Nmakefile
kernel: fix using for tests
[factor.git] / Nmakefile
1 VERSION = 0.99
2
3 # Crazy hack to do shell commands
4 # We do it in Nmakefile because that way we don't have to invoke build through build.cmd
5 # and we can just do ``nmake /f Nmakefile x86-64-vista`` or similar
6 # and we still get the git branch, id, etc
7
8 !IF [git describe --all > git-describe.tmp] == 0
9 GIT_DESCRIBE = \
10 !INCLUDE <git-describe.tmp>
11 !IF [del git-describe.tmp] == 0
12 !ENDIF
13 !ENDIF
14
15 !IF [git rev-parse HEAD > git-id.tmp] == 0
16 GIT_ID = \
17 !INCLUDE <git-id.tmp>
18 !IF [del git-id.tmp] == 0
19 !ENDIF
20 !ENDIF
21
22 !IF [git rev-parse --abbrev-ref HEAD > git-branch.tmp] == 0
23 GIT_BRANCH = \
24 !INCLUDE <git-branch.tmp>
25 !IF [del git-branch.tmp] == 0
26 !ENDIF
27 !ENDIF
28
29 GIT_LABEL = $(GIT_DESCRIBE)-$(GIT_ID)
30
31 !IF DEFINED(PLATFORM)
32
33 LINK_FLAGS = /nologo shell32.lib user32.lib
34 CL_FLAGS = /nologo /O2 /WX /W3 /D_CRT_SECURE_NO_WARNINGS /DFACTOR_VERSION=$(VERSION) /DFACTOR_GIT_LABEL=$(GIT_LABEL)
35 CL_FLAGS_VISTA = /D_WIN32_WINNT=0x0600
36
37 !IF "$(PLATFORM)" == "x86-32"
38 LINK_FLAGS = $(LINK_FLAGS) /safeseh /largeaddressaware
39 PLAF_DLL_OBJS = vm\os-windows-x86.32.obj vm\safeseh.obj vm\cpu-x86.obj
40 SUBSYSTEM_COM_FLAGS = console,"5.01"
41 SUBSYSTEM_EXE_FLAGS = windows,"5.01"
42
43 !ELSEIF "$(PLATFORM)" == "x86-32-vista"
44 LINK_FLAGS = $(LINK_FLAGS) /safeseh /largeaddressaware
45 CL_FLAGS = $(CL_FLAGS) $(CL_FLAGS_VISTA)
46 PLAF_DLL_OBJS = vm\os-windows-x86.32.obj vm\safeseh.obj vm\cpu-x86.obj
47 SUBSYSTEM_COM_FLAGS = console
48 SUBSYSTEM_EXE_FLAGS = windows
49
50 !ELSEIF "$(PLATFORM)" == "x86-64"
51 PLAF_DLL_OBJS = vm\os-windows-x86.64.obj vm\cpu-x86.obj
52 SUBSYSTEM_COM_FLAGS = console,"5.02"
53 SUBSYSTEM_EXE_FLAGS = windows,"5.02"
54
55
56 !ELSEIF "$(PLATFORM)" == "x86-64-vista"
57 CL_FLAGS = $(CL_FLAGS) $(CL_FLAGS_VISTA)
58 PLAF_DLL_OBJS = vm\os-windows-x86.64.obj vm\cpu-x86.obj
59 SUBSYSTEM_COM_FLAGS = console
60 SUBSYSTEM_EXE_FLAGS = windows
61
62 !ELSE
63 CL_FLAGS = $(CL_FLAGS) $(CL_FLAGS_VISTA)
64 PLAF_DLL_OBJS = vm\os-windows-x86.64.obj vm\cpu-x86.obj
65 SUBSYSTEM_COM_FLAGS = console
66 SUBSYSTEM_EXE_FLAGS = windows
67
68 !ENDIF
69
70 !IF DEFINED(DEBUG)
71 LINK_FLAGS = $(LINK_FLAGS) /DEBUG
72 CL_FLAGS = $(CL_FLAGS) /Zi /DFACTOR_DEBUG
73 !ENDIF
74
75 !IF DEFINED(REPRODUCIBLE)
76 CL_FLAGS = $(CL_FLAGS) /DFACTOR_REPRODUCIBLE
77 !ENDIF
78
79 ML_FLAGS = /nologo /safeseh
80
81 EXE_OBJS = vm\main-windows.obj vm\factor.res
82
83 DLL_OBJS = $(PLAF_DLL_OBJS) \
84         vm\os-windows.obj \
85         vm\aging_collector.obj \
86         vm\alien.obj \
87         vm\arrays.obj \
88         vm\bignum.obj \
89         vm\byte_arrays.obj \
90         vm\callbacks.obj \
91         vm\callstack.obj \
92         vm\code_blocks.obj \
93         vm\code_heap.obj \
94         vm\compaction.obj \
95         vm\contexts.obj \
96         vm\data_heap.obj \
97         vm\data_heap_checker.obj \
98         vm\debug.obj \
99         vm\dispatch.obj \
100         vm\entry_points.obj \
101         vm\errors.obj \
102         vm\factor.obj \
103         vm\full_collector.obj \
104         vm\gc.obj \
105         vm\image.obj \
106         vm\inline_cache.obj \
107         vm\instruction_operands.obj \
108         vm\io.obj \
109         vm\jit.obj \
110         vm\math.obj \
111         vm\mvm.obj \
112         vm\mvm-windows.obj \
113         vm\nursery_collector.obj \
114         vm\object_start_map.obj \
115         vm\objects.obj \
116         vm\primitives.obj \
117         vm\quotations.obj \
118         vm\run.obj \
119         vm\safepoints.obj \
120         vm\sampling_profiler.obj \
121         vm\strings.obj \
122         vm\to_tenured_collector.obj \
123         vm\tuples.obj \
124         vm\utilities.obj \
125         vm\vm.obj \
126         vm\words.obj
127
128 # batch mode has ::
129 .cpp.obj::
130         cl /EHsc $(CL_FLAGS) /MP /Fovm/ /c $<
131
132 .c.obj::
133         cl /EHsc $(CL_FLAGS) /MP /Fovm/ /c $<
134
135 .asm.obj:
136         ml $(ML_FLAGS) /Fo$@ /c $<
137
138 .rs.res:
139         rc $<
140
141 libfactor-ffi-test.dll: vm/ffi_test.obj
142         link $(LINK_FLAGS) /out:libfactor-ffi-test.dll /dll /def:vm\ffi_test.def vm/ffi_test.obj
143
144 factor.dll.lib: $(DLL_OBJS)
145         link $(LINK_FLAGS) /implib:factor.dll.lib /out:factor.dll /dll $(DLL_OBJS)
146
147 factor.com: $(EXE_OBJS) $(DLL_OBJS)
148         link $(LINK_FLAGS) /out:factor.com /SUBSYSTEM:$(SUBSYSTEM_COM_FLAGS) $(EXE_OBJS) $(DLL_OBJS)
149
150 factor.exe: $(EXE_OBJS) $(DLL_OBJS)
151         link $(LINK_FLAGS) /out:factor.exe /SUBSYSTEM:$(SUBSYSTEM_EXE_FLAGS) $(EXE_OBJS) $(DLL_OBJS)
152
153 # If we compile factor.exe, run mt.exe, and run factor.exe,
154 # then Windows caches the manifest. Even on a recompile without applying
155 # the mt.exe tool, if the factor.exe.manifest file is present, the manifest
156 # is applied. To avoid this, we delete the .manifest file on clean
157 # and copy it from a reference file on compilation and mt.exe.
158 #
159 factor.exe.manifest: factor.exe
160         copy factor.exe.manifest.in factor.exe.manifest
161         mt -manifest factor.exe.manifest -outputresource:"factor.exe;#1"
162
163 all: factor.com factor.exe factor.dll.lib libfactor-ffi-test.dll
164
165 !ENDIF
166
167 default:
168         @echo Usage: nmake /f Nmakefile platform
169         @echo Where platform is one of:
170         @echo x86-32
171         @echo x86-64
172         @echo x86-32-vista
173         @echo x86-64-vista
174         @exit 1
175
176 x86-32:
177         nmake /nologo PLATFORM=x86-32 /f Nmakefile all
178
179 x86-64:
180         nmake /nologo PLATFORM=x86-64 /f Nmakefile all
181
182 x86-32-vista:
183         nmake /nologo PLATFORM=x86-32-vista /f Nmakefile all
184
185 x86-64-vista:
186         nmake /nologo PLATFORM=x86-64-vista /f Nmakefile all
187
188 clean:
189         del vm\*.obj
190         if exist vm\factor.res del vm\factor.res
191         if exist factor.lib del factor.lib
192         if exist factor.com del factor.com
193         if exist factor.exe del factor.exe
194         if exist factor.exe.manifest del factor.exe.manifest
195         if exist factor.exp del factor.exp
196         if exist factor.dll del factor.dll
197         if exist factor.dll.lib del factor.dll.lib
198         if exist factor.dll.exp del factor.dll.exp
199         if exist libfactor-ffi-test.dll del libfactor-ffi-test.dll
200         if exist libfactor-ffi-test.exp del libfactor-ffi-test.exp
201         if exist libfactor-ffi-test.lib del libfactor-ffi-test.lib
202
203 .PHONY: all default x86-32 x86-64 x86-32-vista x86-64-vista clean factor.exe.manifest
204
205 .SUFFIXES: .rs