Imported File#ftype spec from rubyspecs.
[rbx.git] / shotgun / Makefile
blob91fc84e6cdcc03a66aeb5e155dc3bcd7da934843
1 -include config.mk
2 include common.mk
4 INSTALL=install
5 MKDIR=install -d
7 ifdef DEV
8 BINSUFFIX?=-dev
9 else
10 BINSUFFIX?=
11 endif
13 ifeq ($(DTRACE),1)
14 DTRACE_H=dtrace.h
15 else
16 DTRACE_H=
17 endif
19 CFLAGS += -I.. $(CPPFLAGS) -Iexternal_libs/libbstring -Iexternal_libs/libcchash \
20 -Iexternal_libs/libmpa -Iexternal_libs/libmquark -Iexternal_libs/libev \
21 -Iexternal_libs/libtommath -Iexternal_libs/libgdtoa
23 ALIBS= external_libs/libffi/.libs/libffi.a \
24 external_libs/libgdtoa/libgdtoa.a \
25 external_libs/libtommath/libtommath.a \
26 external_libs/onig/.libs/libonig.a \
27 external_libs/libltdl/.libs/libltdl.a \
28 external_libs/libev/.libs/libev.a \
29 external_libs/libbstring/libbstring.a \
30 external_libs/libcchash/libcchash.a \
31 external_libs/libmpa/libptr_array.a \
32 external_libs/libmquark/libmquark.a
34 LIBS=$(ALIBS) -lz -lm shotgun/lib
35 LDFLAGS=
37 # amd64 must have fPIC shared
38 ifeq ($(MARCH),amd64)
39 CFLAGS+=-fPIC
40 endif
42 ifeq ($(UNAME),SunOS)
43 LDFLAGS+=-lrt
44 endif
46 ifeq ($(UNAME),Linux)
47 LIBS+=-ldl
48 endif
50 OBJS=$(patsubst %.c,%.o,$(shell ls *.c))
51 RBLIB=lib/$(RBXLIB)
53 rubinius: rubinius.bin
55 .PHONY: rubinius
57 install:
58 $(MKDIR) $(LIBPATH)
59 $(INSTALL) -c $(RBLIB) $(LIBPATH)
60 $(MKDIR) $(BINPATH)
61 $(INSTALL) -c rubinius.bin $(BINPATH)/rbx$(BINSUFFIX)
63 config.h:
64 ./mkconfig.sh
66 %.o: %.c
67 $(COMP) $(CFLAGS) -c $<
69 external_libs/libtommath/libtommath.a:
70 cd external_libs/libtommath; $(MAKE)
72 external_libs/onig/config.h:
73 cd external_libs/onig; CFLAGS=-fPIC ./configure
75 external_libs/onig/.libs/libonig.a: external_libs/onig/config.h
76 cd external_libs/onig; $(MAKE)
78 # cinvoke doesn't produce a config.h
79 external_libs/cinvoke/lib/libcinvoke.a:
80 cd external_libs/cinvoke; CFLAGS=-fPIC ./configure; $(MAKE)
82 external_libs/libev/config.h:
83 cd external_libs/libev; CFLAGS=-fPIC ./configure
85 external_libs/libev/.libs/libev.a: external_libs/libev/config.h
86 cd external_libs/libev; $(MAKE) libev.la
88 external_libs/libltdl/config.h:
89 cd external_libs/libltdl; CFLAGS=-fPIC ./configure
91 external_libs/libltdl/.libs/libltdl.a: external_libs/libltdl/config.h
92 cd external_libs/libltdl; $(MAKE)
94 external_libs/libbstring/libbstring.a:
95 cd external_libs/libbstring; $(MAKE)
97 external_libs/libcchash/libcchash.a:
98 cd external_libs/libcchash; $(MAKE)
100 external_libs/libmpa/libptr_array.a:
101 cd external_libs/libmpa; $(MAKE)
103 external_libs/libmquark/libmquark.a:
104 cd external_libs/libmquark; $(MAKE)
106 external_libs/libffi/.libs/libffi.a:
107 cd external_libs/libffi; CFLAGS=-fPIC ./configure && $(MAKE)
109 external_libs/libgdtoa/libgdtoa.a:
110 cd external_libs/libgdtoa; $(MAKE)
112 $(RBLIB): config.h $(DTRACE_H) $(ALIBS)
113 cd lib; $(MAKE) library;
115 .PHONY: $(RBLIB)
117 # Don't try to build main until librubinius exists
118 main.c: $(RBLIB)
120 dtrace.h: rubinius.d
121 /usr/sbin/dtrace -h -s rubinius.d -o dtrace.h
123 rubinius.bin: $(RBLIB) main.o rubinius.local.bin
124 $(COMP) -o rubinius.bin main.o $(RBLIB) $(BIN_RPATH) $(LDFLAGS)
126 rubinius.local.bin: $(RBLIB) main.o
127 $(COMP) -o rubinius.local.bin main.o lib/$(RBXLIBLOCAL) $(BIN_RPATHLOCAL) $(LDFLAGS)
129 test/test_state: test/test_state.c library
130 $(COMP) -c -o test/test_state.o test/test_state.c $(CFLAGS)
131 $(COMP) $(LIBS) -o test/test_state test/test_state.o $(RBLIB)
133 test/test_gc: test/test_gc.c library
134 $(COMP) -c -o test/test_gc.o test/test_gc.c $(CFLAGS)
135 $(COMP) $(LIBS) -o test/test_gc test/test_gc.o $(RBLIB)
137 test/test_instructions: test/test_instructions.c library
138 $(COMP) -c -o test/test_instructions.o test/test_instructions.c $(CFLAGS)
139 $(COMP) $(LIBS) -o test/test_instructions test/test_instructions.o $(RBLIB)
141 test: test/test_state test/test_instructions
142 ./test/test_state
143 ./test/test_instructions
145 .PHONY: test
147 clean:
148 rm -f *.o *.lo *.gen rubinius.bin rubinius.local.bin
149 rm -rf .libs
150 cd lib; $(MAKE) clean
151 .PHONY: clean
153 # Clean, but also nuke configs
154 distclean: clean
155 rm -f config.h config.mk
156 rm -f config/is64bit
157 rm -f config/isbigendian
158 rm -f external_libs/libev/config.h
159 rm -f external_libs/libltdl/config.h
160 rm -f external_libs/onig/config.h
161 -cd external_libs/libbstring; $(MAKE) clean
162 -cd external_libs/libcchash; $(MAKE) clean
163 -cd external_libs/libev; $(MAKE) clean
164 -cd external_libs/libltdl; $(MAKE) clean
165 -cd external_libs/libmpa; $(MAKE) clean
166 -cd external_libs/libmquark; $(MAKE) clean
167 -cd external_libs/libtommath; $(MAKE) clean
168 -cd external_libs/onig; $(MAKE) clean
169 -cd external_libs/libffi; $(MAKE) clean
170 -cd external_libs/libgdtoa; $(MAKE) clean
172 .PHONY: distclean