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