]> gitweb.factorcode.org Git - factor.git/blob - GNUmakefile
fix build for linux (issue #480). thanks, jcollado!
[factor.git] / GNUmakefile
1 ifdef CONFIG
2         CC = gcc
3         CPP = g++
4
5         VERSION = 0.94
6
7         BUNDLE = Factor.app
8         LIBPATH = -L/usr/X11R6/lib
9
10         include $(CONFIG)
11
12         CFLAGS = -Wall $(SITE_CFLAGS)
13
14         ifdef DEBUG
15                 CFLAGS += -g -DFACTOR_DEBUG
16         else
17                 CFLAGS += -O3
18         endif
19
20         ENGINE = $(DLL_PREFIX)factor$(DLL_SUFFIX)$(DLL_EXTENSION)
21         EXECUTABLE = factor$(EXE_SUFFIX)$(EXE_EXTENSION)
22         CONSOLE_EXECUTABLE = factor$(EXE_SUFFIX)$(CONSOLE_EXTENSION)
23
24         DLL_OBJS = $(PLAF_DLL_OBJS) \
25                 vm/aging_collector.o \
26                 vm/alien.o \
27                 vm/arrays.o \
28                 vm/bignum.o \
29                 vm/booleans.o \
30                 vm/byte_arrays.o \
31                 vm/callbacks.o \
32                 vm/callstack.o \
33                 vm/code_blocks.o \
34                 vm/code_heap.o \
35                 vm/compaction.o \
36                 vm/contexts.o \
37                 vm/data_heap.o \
38                 vm/data_heap_checker.o \
39                 vm/debug.o \
40                 vm/dispatch.o \
41                 vm/entry_points.o \
42                 vm/errors.o \
43                 vm/factor.o \
44                 vm/free_list.o \
45                 vm/full_collector.o \
46                 vm/gc.o \
47                 vm/gc_info.o \
48                 vm/image.o \
49                 vm/inline_cache.o \
50                 vm/instruction_operands.o \
51                 vm/io.o \
52                 vm/jit.o \
53                 vm/math.o \
54                 vm/mvm.o \
55                 vm/nursery_collector.o \
56                 vm/object_start_map.o \
57                 vm/objects.o \
58                 vm/primitives.o \
59                 vm/quotations.o \
60                 vm/run.o \
61                 vm/safepoints.o \
62                 vm/sampling_profiler.o \
63                 vm/strings.o \
64                 vm/to_tenured_collector.o \
65                 vm/tuples.o \
66                 vm/utilities.o \
67                 vm/vm.o \
68                 vm/words.o
69
70         MASTER_HEADERS = $(PLAF_MASTER_HEADERS) \
71                 vm/assert.hpp \
72                 vm/layouts.hpp \
73                 vm/platform.hpp \
74                 vm/primitives.hpp \
75                 vm/segments.hpp \
76                 vm/gc_info.hpp \
77                 vm/contexts.hpp \
78                 vm/run.hpp \
79                 vm/objects.hpp \
80                 vm/sampling_profiler.hpp \
81                 vm/errors.hpp \
82                 vm/bignumint.hpp \
83                 vm/bignum.hpp \
84                 vm/booleans.hpp \
85                 vm/instruction_operands.hpp \
86                 vm/code_blocks.hpp \
87                 vm/bump_allocator.hpp \
88                 vm/bitwise_hacks.hpp \
89                 vm/mark_bits.hpp \
90                 vm/free_list.hpp \
91                 vm/fixup.hpp \
92                 vm/tuples.hpp \
93                 vm/free_list_allocator.hpp \
94                 vm/write_barrier.hpp \
95                 vm/object_start_map.hpp \
96                 vm/nursery_space.hpp \
97                 vm/aging_space.hpp \
98                 vm/tenured_space.hpp \
99                 vm/data_heap.hpp \
100                 vm/code_heap.hpp \
101                 vm/gc.hpp \
102                 vm/debug.hpp \
103                 vm/strings.hpp \
104                 vm/words.hpp \
105                 vm/float_bits.hpp \
106                 vm/io.hpp \
107                 vm/image.hpp \
108                 vm/alien.hpp \
109                 vm/callbacks.hpp \
110                 vm/dispatch.hpp \
111                 vm/entry_points.hpp \
112                 vm/safepoints.hpp \
113                 vm/vm.hpp \
114                 vm/allot.hpp \
115                 vm/tagged.hpp \
116                 vm/data_roots.hpp \
117                 vm/code_roots.hpp \
118                 vm/generic_arrays.hpp \
119                 vm/callstack.hpp \
120                 vm/slot_visitor.hpp \
121                 vm/collector.hpp \
122                 vm/copying_collector.hpp \
123                 vm/nursery_collector.hpp \
124                 vm/aging_collector.hpp \
125                 vm/to_tenured_collector.hpp \
126                 vm/code_block_visitor.hpp \
127                 vm/compaction.hpp \
128                 vm/full_collector.hpp \
129                 vm/arrays.hpp \
130                 vm/math.hpp \
131                 vm/byte_arrays.hpp \
132                 vm/jit.hpp \
133                 vm/quotations.hpp \
134                 vm/inline_cache.hpp \
135                 vm/mvm.hpp \
136                 vm/factor.hpp \
137                 vm/utilities.hpp
138
139         EXE_OBJS = $(PLAF_EXE_OBJS)
140
141         FFI_TEST_LIBRARY = libfactor-ffi-test$(SHARED_DLL_EXTENSION)
142
143         TEST_OBJS = vm/ffi_test.o
144 endif
145
146 default:
147         $(MAKE) `./build-support/factor.sh make-target`
148
149 help:
150         @echo "Run '$(MAKE)' with one of the following parameters:"
151         @echo ""
152         @echo "linux-x86-32"
153         @echo "linux-x86-64"
154         @echo "linux-ppc-32"
155         @echo "linux-ppc-64"
156         @echo "linux-arm"
157         @echo "macosx-x86-32"
158         @echo "macosx-x86-64"
159         @echo "macosx-x86-fat"
160         @echo "windows-x86-32"
161         @echo "windows-x86-64"
162         @echo ""
163         @echo "Additional modifiers:"
164         @echo ""
165         @echo "DEBUG=1  compile VM with debugging information"
166         @echo "SITE_CFLAGS=...  additional optimization flags"
167         @echo "NO_UI=1  don't link with X11 libraries (ignored on Mac OS X)"
168         @echo "X11=1  force link with X11 libraries instead of Cocoa (only on Mac OS X)"
169
170 ALL = factor factor-ffi-test factor-lib
171
172 macosx-x86-32:
173         $(MAKE) $(ALL) macosx.app CONFIG=vm/Config.macosx.x86.32
174
175 macosx-x86-64:
176         $(MAKE) $(ALL) macosx.app CONFIG=vm/Config.macosx.x86.64
177
178 macosx-x86-fat:
179         $(MAKE) $(ALL) macosx.app CONFIG=vm/Config.macosx.x86.fat
180
181 linux-x86-32:
182         $(MAKE) $(ALL) CONFIG=vm/Config.linux.x86.32
183
184 linux-x86-64:
185         $(MAKE) $(ALL) CONFIG=vm/Config.linux.x86.64
186
187 linux-ppc-32:
188         $(MAKE) $(ALL) CONFIG=vm/Config.linux.ppc.32
189
190 linux-ppc-64:
191         $(MAKE) $(ALL) CONFIG=vm/Config.linux.ppc.64
192
193 linux-arm:
194         $(MAKE) $(ALL) CONFIG=vm/Config.linux.arm
195
196 windows-x86-32:
197         $(MAKE) $(ALL) CONFIG=vm/Config.windows.x86.32
198         $(MAKE) factor-console CONFIG=vm/Config.windows.x86.32
199
200 windows-x86-64:
201         $(MAKE) $(ALL) CONFIG=vm/Config.windows.x86.64
202         $(MAKE) factor-console CONFIG=vm/Config.windows.x86.64
203
204 ifdef CONFIG
205
206 macosx.app: factor
207         mkdir -p $(BUNDLE)/Contents/MacOS
208         mkdir -p $(BUNDLE)/Contents/Frameworks
209         mv $(EXECUTABLE) $(BUNDLE)/Contents/MacOS/factor
210         ln -s Factor.app/Contents/MacOS/factor ./factor
211
212 $(ENGINE): $(DLL_OBJS)
213         $(TOOLCHAIN_PREFIX)$(LINKER) $(ENGINE) $(DLL_OBJS)
214
215 factor-lib: $(ENGINE)
216
217 factor: $(EXE_OBJS) $(DLL_OBJS)
218         $(TOOLCHAIN_PREFIX)$(CPP) $(LIBPATH) -L. $(DLL_OBJS) \
219                 $(CFLAGS) -o $(EXECUTABLE) $(LIBS) $(EXE_OBJS)
220
221 factor-console: $(EXE_OBJS) $(DLL_OBJS)
222         $(TOOLCHAIN_PREFIX)$(CPP) $(LIBPATH) -L. $(DLL_OBJS) \
223                 $(CFLAGS) $(CFLAGS_CONSOLE) -o $(CONSOLE_EXECUTABLE) $(LIBS) $(EXE_OBJS)
224
225 factor-ffi-test: $(FFI_TEST_LIBRARY)
226
227 $(FFI_TEST_LIBRARY): vm/ffi_test.o
228         $(TOOLCHAIN_PREFIX)$(CC) $(LIBPATH) $(CFLAGS) $(FFI_TEST_CFLAGS) $(SHARED_FLAG) -o $(FFI_TEST_LIBRARY) $(TEST_OBJS)
229
230 vm/resources.o:
231         $(TOOLCHAIN_PREFIX)$(WINDRES) vm/factor.rs vm/resources.o
232
233 vm/ffi_test.o: vm/ffi_test.c
234         $(TOOLCHAIN_PREFIX)$(CC) -c $(CFLAGS) $(FFI_TEST_CFLAGS) -o $@ $<
235
236 vm/master.hpp.gch: vm/master.hpp $(MASTER_HEADERS)
237         $(TOOLCHAIN_PREFIX)$(CPP) -c -x c++-header $(CFLAGS) -o $@ $<
238
239 %.o: %.cpp vm/master.hpp.gch
240         $(TOOLCHAIN_PREFIX)$(CPP) -c $(CFLAGS) -o $@ $<
241
242 %.o: %.S
243         $(TOOLCHAIN_PREFIX)$(CC) -c $(CFLAGS) -o $@ $<
244
245 %.o: %.mm vm/master.hpp.gch
246         $(TOOLCHAIN_PREFIX)$(CPP) -c $(CFLAGS) -o $@ $<
247
248 .SUFFIXES: .mm
249
250 endif
251
252 clean:
253         rm -f vm/*.gch
254         rm -f vm/*.o
255         rm -f factor.dll
256         rm -f factor.lib
257         rm -f factor.dll.lib
258         rm -f libfactor.*
259         rm -f libfactor-ffi-test.*
260         rm -f Factor.app/Contents/Frameworks/libfactor.dylib
261
262 .PHONY: factor factor-lib factor-console factor-ffi-test tags clean macosx.app