fix compile error
[factor/jcg.git] / Makefile
blobffcbf6364c2544f1a4a4be579a0ed984faf2e41d
1 CC = gcc
2 AR = ar
3 LD = ld
5 EXECUTABLE = factor
6 VERSION = 0.92
8 IMAGE = factor.image
9 BUNDLE = Factor.app
10 LIBPATH = -L/usr/X11R6/lib
11 CFLAGS = -Wall
13 ifdef DEBUG
14 CFLAGS += -g
15 else
16 CFLAGS += -O3 $(SITE_CFLAGS)
17 endif
19 ifdef CONFIG
20 include $(CONFIG)
21 endif
23 ENGINE = $(DLL_PREFIX)factor$(DLL_SUFFIX)$(DLL_EXTENSION)
25 DLL_OBJS = $(PLAF_DLL_OBJS) \
26 vm/alien.o \
27 vm/bignum.o \
28 vm/code_heap.o \
29 vm/debug.o \
30 vm/factor.o \
31 vm/ffi_test.o \
32 vm/image.o \
33 vm/io.o \
34 vm/math.o \
35 vm/data_gc.o \
36 vm/code_gc.o \
37 vm/primitives.o \
38 vm/run.o \
39 vm/callstack.o \
40 vm/types.o \
41 vm/quotations.o \
42 vm/utilities.o \
43 vm/errors.o \
44 vm/profiler.o
46 EXE_OBJS = $(PLAF_EXE_OBJS)
48 default:
49 $(MAKE) `./build-support/factor.sh make-target`
51 help:
52 @echo "Run '$(MAKE)' with one of the following parameters:"
53 @echo ""
54 @echo "freebsd-x86-32"
55 @echo "freebsd-x86-64"
56 @echo "linux-x86-32"
57 @echo "linux-x86-64"
58 @echo "linux-ppc"
59 @echo "linux-arm"
60 @echo "openbsd-x86-32"
61 @echo "openbsd-x86-64"
62 @echo "netbsd-x86-32"
63 @echo "netbsd-x86-64"
64 @echo "macosx-x86-32"
65 @echo "macosx-x86-64"
66 @echo "macosx-ppc"
67 @echo "solaris-x86-32"
68 @echo "solaris-x86-64"
69 @echo "wince-arm"
70 @echo "winnt-x86-32"
71 @echo "winnt-x86-64"
72 @echo ""
73 @echo "Additional modifiers:"
74 @echo ""
75 @echo "DEBUG=1 compile VM with debugging information"
76 @echo "SITE_CFLAGS=... additional optimization flags"
77 @echo "NO_UI=1 don't link with X11 libraries (ignored on Mac OS X)"
78 @echo "X11=1 force link with X11 libraries instead of Cocoa (only on Mac OS X)"
80 openbsd-x86-32:
81 $(MAKE) $(EXECUTABLE) CONFIG=vm/Config.openbsd.x86.32
83 openbsd-x86-64:
84 $(MAKE) $(EXECUTABLE) CONFIG=vm/Config.openbsd.x86.64
86 freebsd-x86-32:
87 $(MAKE) $(EXECUTABLE) CONFIG=vm/Config.freebsd.x86.32
89 freebsd-x86-64:
90 $(MAKE) $(EXECUTABLE) CONFIG=vm/Config.freebsd.x86.64
92 netbsd-x86-32:
93 $(MAKE) $(EXECUTABLE) CONFIG=vm/Config.netbsd.x86.32
95 netbsd-x86-64:
96 $(MAKE) $(EXECUTABLE) CONFIG=vm/Config.netbsd.x86.64
98 macosx-freetype:
99 ln -sf libfreetype.6.dylib \
100 Factor.app/Contents/Frameworks/libfreetype.dylib
102 macosx-ppc: macosx-freetype
103 $(MAKE) $(EXECUTABLE) macosx.app CONFIG=vm/Config.macosx.ppc
105 macosx-x86-32: macosx-freetype
106 $(MAKE) $(EXECUTABLE) macosx.app CONFIG=vm/Config.macosx.x86.32
108 macosx-x86-64: macosx-freetype
109 $(MAKE) $(EXECUTABLE) macosx.app CONFIG=vm/Config.macosx.x86.64
111 linux-x86-32:
112 $(MAKE) $(EXECUTABLE) CONFIG=vm/Config.linux.x86.32
114 linux-x86-64:
115 $(MAKE) $(EXECUTABLE) CONFIG=vm/Config.linux.x86.64
117 linux-ppc:
118 $(MAKE) $(EXECUTABLE) CONFIG=vm/Config.linux.ppc
120 linux-arm:
121 $(MAKE) $(EXECUTABLE) CONFIG=vm/Config.linux.arm
123 solaris-x86-32:
124 $(MAKE) $(EXECUTABLE) CONFIG=vm/Config.solaris.x86.32
126 solaris-x86-64:
127 $(MAKE) $(EXECUTABLE) CONFIG=vm/Config.solaris.x86.64
129 freetype6.dll:
130 wget http://factorcode.org/dlls/freetype6.dll
131 chmod 755 freetype6.dll
133 zlib1.dll:
134 wget http://factorcode.org/dlls/zlib1.dll
135 chmod 755 zlib1.dll
137 winnt-x86-32: freetype6.dll zlib1.dll
138 $(MAKE) $(EXECUTABLE) CONFIG=vm/Config.windows.nt.x86.32
140 winnt-x86-64:
141 $(MAKE) $(EXECUTABLE) CONFIG=vm/Config.windows.nt.x86.64
143 wince-arm:
144 $(MAKE) $(EXECUTABLE) CONFIG=vm/Config.windows.ce.arm
146 macosx.app: factor
147 mkdir -p $(BUNDLE)/Contents/MacOS
148 mv $(EXECUTABLE) $(BUNDLE)/Contents/MacOS/factor
149 ln -s Factor.app/Contents/MacOS/factor ./factor
150 cp $(ENGINE) $(BUNDLE)/Contents/Frameworks
152 install_name_tool \
153 -change libfactor.dylib \
154 @executable_path/../Frameworks/libfactor.dylib \
155 Factor.app/Contents/MacOS/factor
157 factor: $(DLL_OBJS) $(EXE_OBJS)
158 $(LINKER) $(ENGINE) $(DLL_OBJS)
159 $(CC) $(LIBS) $(LIBPATH) -L. $(LINK_WITH_ENGINE) \
160 $(CFLAGS) -o $@$(EXE_SUFFIX)$(EXE_EXTENSION) $(EXE_OBJS)
162 clean:
163 rm -f vm/*.o
164 rm -f factor*.dll libfactor.{a,so,dylib}
166 vm/resources.o:
167 $(WINDRES) vm/factor.rs vm/resources.o
169 .c.o:
170 $(CC) -c $(CFLAGS) -o $@ $<
172 .S.o:
173 $(CC) -x assembler-with-cpp -c $(CFLAGS) -o $@ $<
175 .m.o:
176 $(CC) -c $(CFLAGS) -o $@ $<
178 .PHONY: factor