]>
Commit | Line | Data |
---|---|---|
bce1b489 | 1 | #Makefile for GNU Objective C runtime library. |
bcecb0b0 | 2 | #Copyright (C) 1993, 95-98, 1999, 2001 Free Software Foundation, Inc. |
bce1b489 BE |
3 | |
4 | #This file is part of GNU CC. | |
5 | ||
6 | #GNU CC is free software; you can redistribute it and/or modify | |
7 | #it under the terms of the GNU General Public License as published by | |
8 | #the Free Software Foundation; either version 2, or (at your option) | |
9 | #any later version. | |
10 | ||
11 | #GNU CC is distributed in the hope that it will be useful, | |
12 | #but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | #MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 | #GNU General Public License for more details. | |
15 | ||
16 | #You should have received a copy of the GNU General Public License | |
17 | #along with GNU CC; see the file COPYING. If not, write to | |
5f38fdda JL |
18 | #the Free Software Foundation, 59 Temple Place - Suite 330, |
19 | #Boston, MA 02111-1307, USA. */ | |
bce1b489 BE |
20 | |
21 | #This was cribbed from the libchill, libiberty and libstdc++ | |
22 | #Makefile.in files. Some of this stuff may be unnecessary and | |
23 | #worthless. | |
24 | ||
9aa338ec | 25 | SHELL = @SHELL@ |
b150efee | 26 | MAKEOVERRIDES= |
bce1b489 BE |
27 | |
28 | #### Start of system configuration section. #### | |
29 | ||
b150efee FS |
30 | srcdir = @glibcpp_srcdir@ |
31 | VPATH = @glibcpp_srcdir@ | |
bce1b489 BE |
32 | prefix = @prefix@ |
33 | exec_prefix = @exec_prefix@ | |
34 | target_alias = @target_alias@ | |
35 | gcc_version = @gcc_version@ | |
36 | gcc_version_trigger = @gcc_version_trigger@ | |
b150efee FS |
37 | top_srcdir = @top_srcdir@ |
38 | toplevel_srcdir = @toplevel_srcdir@ | |
39 | toolexecdir = @glibcpp_toolexecdir@ | |
40 | glibcpp_toolexecdir = @glibcpp_toolexecdir@ | |
41 | glibcpp_toolexeclibdir = @glibcpp_toolexeclibdir@ | |
42 | ||
43 | top_builddir = . | |
bce1b489 BE |
44 | |
45 | libdir = $(exec_prefix)/lib | |
46 | libsubdir = $(libdir)/gcc-lib/$(target_alias)/$(gcc_version) | |
bce1b489 BE |
47 | |
48 | # Multilib support variables. | |
49 | MULTISRCTOP = | |
50 | MULTIBUILDTOP = | |
51 | MULTIDIRS = | |
52 | MULTISUBDIR = | |
53 | MULTIDO = true | |
54 | MULTICLEAN = true | |
55 | ||
56 | # Not configured per top-level version, since that doesn't get passed | |
57 | # down at configure time, but overrridden by the top-level install | |
58 | # target. | |
59 | INSTALL = @INSTALL@ | |
60 | INSTALL_PROGRAM = @INSTALL_PROGRAM@ | |
61 | INSTALL_DATA = @INSTALL_DATA@ | |
62 | ||
63 | AR = @AR@ | |
64 | AR_FLAGS = rc | |
65 | ||
66 | RANLIB = @RANLIB@ | |
67 | ||
68 | CC = @CC@ | |
69 | CFLAGS = @CFLAGS@ | |
9aa338ec | 70 | WARN_CFLAGS = -W -Wall -Wwrite-strings -Wstrict-prototypes |
15794a95 | 71 | GTHREAD_FLAGS=@GTHREAD_FLAGS@ |
9aa338ec | 72 | ALL_CFLAGS = -I. -I$(srcdir) $(CPPFLAGS) $(DEFS) $(CFLAGS) $(WARN_CFLAGS) \ |
15794a95 | 73 | $(GTHREAD_FLAGS) -DIN_GCC -DIN_TARGET_LIBS |
bce1b489 | 74 | |
c161c99b NP |
75 | # Libtool |
76 | # The following strings describe the version of the obj-C library | |
77 | # begin compiled and compatibility issues. | |
78 | # Please refer to Libtool documentation about how to manage these | |
79 | # numbers. | |
80 | LIBOBJC_VERSION = 1:0:0 | |
81 | LIBOBJC_GC_VERSION = 1:0:0 | |
82 | # @LIBTOOL@ does not get it right, so we hack it in - FIXME | |
83 | LIBTOOL = ./libtool | |
84 | LIBTOOL_COMPILE = $(LIBTOOL) --mode=compile | |
85 | LIBTOOL_LINK = $(LIBTOOL) --mode=link | |
86 | LIBTOOL_INSTALL = $(LIBTOOL) --mode=install | |
87 | LIBTOOL_CLEAN = $(LIBTOOL) --mode=clean | |
88 | #LIBTOOL_UNINSTALL = $(LIBTOOL) --mode=uninstall | |
89 | ||
7af06410 MK |
90 | # |
91 | # Define the cc1obj in terms of the CC that is passed on from higher | |
92 | # level make. This is needed to make sure we can create runtime-info.h | |
93 | # when doing canadian cross builds where running ../../gcc/cc1obj | |
94 | # does not make any sense. | |
95 | # | |
96 | CC1OBJ = `$(CC) -print-prog-name=cc1obj` | |
97 | ||
5e2f657b | 98 | INCLUDES = -I$(srcdir)/objc -I$(srcdir)/$(MULTISRCTOP)../gcc \ |
84beab38 KG |
99 | -I$(srcdir)/$(MULTISRCTOP)../gcc/config -I$(MULTIBUILDTOP)../../gcc \ |
100 | -I$(srcdir)/$(MULTISRCTOP)../include | |
bce1b489 BE |
101 | |
102 | OBJC_GCFLAGS=-DOBJC_WITH_GC=1 | |
15794a95 | 103 | OBJC_THREAD_FILE=thr-objc |
c161c99b | 104 | OBJC_BOEHM_GC=@OBJC_BOEHM_GC@ |
bce1b489 BE |
105 | |
106 | .SUFFIXES: | |
c161c99b | 107 | .SUFFIXES: .c .m .lo |
bce1b489 | 108 | |
c161c99b NP |
109 | .c.lo: |
110 | $(LIBTOOL_COMPILE) $(CC) -c $(ALL_CFLAGS) $(INCLUDES) $< | |
bce1b489 | 111 | |
c161c99b NP |
112 | .m.lo: |
113 | $(LIBTOOL_COMPILE) $(CC) -c $(ALL_CFLAGS) $(INCLUDES) $< | |
bce1b489 | 114 | |
4102f627 RL |
115 | # Flags to pass to a recursive make. |
116 | FLAGS_TO_PASS = \ | |
117 | "AR=$(AR)" \ | |
118 | "AR_FLAGS=$(AR_FLAGS)" \ | |
119 | "CC=$(CC)" \ | |
120 | "CFLAGS=$(CFLAGS)" \ | |
90e5b39f | 121 | "DESTDIR=$(DESTDIR)" \ |
4102f627 RL |
122 | "LIBCFLAGS=$(LIBCFLAGS)" \ |
123 | "EXTRA_OFILES=$(EXTRA_OFILES)" \ | |
124 | "HDEFINES=$(HDEFINES)" \ | |
125 | "INSTALL=$(INSTALL)" \ | |
126 | "INSTALL_DATA=$(INSTALL_DATA)" \ | |
127 | "INSTALL_PROGRAM=$(INSTALL_PROGRAM)" \ | |
128 | "LDFLAGS=$(LDFLAGS)" \ | |
c161c99b | 129 | "LIBTOOL=$(LIBTOOL)" \ |
4102f627 RL |
130 | "LOADLIBES=$(LOADLIBES)" \ |
131 | "PICFLAG=$(PICFLAG)" \ | |
132 | "RANLIB=$(RANLIB)" \ | |
76632dd0 DJ |
133 | "SHELL=$(SHELL)" \ |
134 | "prefix=$(prefix)" \ | |
135 | "exec_prefix=$(exec_prefix)" \ | |
136 | "libdir=$(libdir)" \ | |
137 | "libsubdir=$(libsubdir)" \ | |
138 | "tooldir=$(tooldir)" | |
4102f627 | 139 | |
c161c99b | 140 | all: libobjc.la $(OBJC_BOEHM_GC) |
6c5d742e | 141 | : $(MAKE) ; exec $(MULTIDO) $(FLAGS_TO_PASS) multi-do DO=all |
bce1b489 BE |
142 | |
143 | # User-visible header files. | |
144 | ||
145 | OBJC_H = hash.h objc-list.h sarray.h objc.h objc-api.h \ | |
146 | NXConstStr.h Object.h Protocol.h encoding.h typedstream.h \ | |
147 | thr.h | |
148 | ||
149 | # Modules that comprise the runtime library. | |
150 | ||
c161c99b NP |
151 | OBJS = archive.lo class.lo encoding.lo gc.lo hash.lo init.lo linking.lo \ |
152 | misc.lo nil_method.lo NXConstStr.lo Object.lo objects.lo \ | |
153 | Protocol.lo sarray.lo selector.lo sendmsg.lo thr.lo \ | |
154 | $(OBJC_THREAD_FILE).lo | |
bce1b489 | 155 | |
c161c99b NP |
156 | OBJS_GC = archive_gc.lo class_gc.lo encoding_gc.lo gc_gc.lo hash_gc.lo \ |
157 | init_gc.lo linking_gc.lo misc_gc.lo nil_method_gc.lo \ | |
158 | NXConstStr_gc.lo Object_gc.lo objects_gc.lo Protocol_gc.lo \ | |
159 | sarray_gc.lo selector_gc.lo sendmsg_gc.lo thr_gc.lo \ | |
160 | $(OBJC_THREAD_FILE)_gc.lo | |
bce1b489 | 161 | |
7af06410 | 162 | runtime-info.h: |
c161c99b NP |
163 | echo "" > tmp-runtime |
164 | echo "/* This file is automatically generated */" > $@ | |
165 | $(CC1OBJ) -print-objc-runtime-info tmp-runtime >> $@ | |
166 | rm -f tmp-runtime | |
bce1b489 | 167 | |
c161c99b NP |
168 | archive_gc.lo: archive.c |
169 | $(LIBTOOL_COMPILE) $(CC) -c -o $@ $(ALL_CFLAGS) $(OBJC_GCFLAGS) \ | |
170 | $(INCLUDES) $< | |
bce1b489 | 171 | |
c161c99b NP |
172 | class_gc.lo: class.c |
173 | $(LIBTOOL_COMPILE) $(CC) -c -o $@ $(ALL_CFLAGS) $(OBJC_GCFLAGS) \ | |
174 | $(INCLUDES) $< | |
bce1b489 | 175 | |
c161c99b NP |
176 | encoding_gc.lo: encoding.c |
177 | $(LIBTOOL_COMPILE) $(CC) -c -o $@ $(ALL_CFLAGS) $(OBJC_GCFLAGS) \ | |
178 | $(INCLUDES) $< | |
bce1b489 | 179 | |
c161c99b NP |
180 | gc.lo: gc.c |
181 | $(LIBTOOL_COMPILE) $(CC) -c -o $@ $(ALL_CFLAGS) $(INCLUDES) $< | |
bce1b489 | 182 | |
c161c99b NP |
183 | gc_gc.lo: gc.c |
184 | $(LIBTOOL_COMPILE) $(CC) -c -o $@ $(ALL_CFLAGS) $(OBJC_GCFLAGS) \ | |
185 | $(INCLUDES) $< | |
bce1b489 | 186 | |
c161c99b NP |
187 | hash_gc.lo: hash.c |
188 | $(LIBTOOL_COMPILE) $(CC) -c -o $@ $(ALL_CFLAGS) $(OBJC_GCFLAGS) \ | |
189 | $(INCLUDES) $< | |
bce1b489 | 190 | |
c161c99b NP |
191 | init_gc.lo: init.c |
192 | $(LIBTOOL_COMPILE) $(CC) -c -o $@ $(ALL_CFLAGS) $(OBJC_GCFLAGS) \ | |
193 | $(INCLUDES) $< | |
bce1b489 | 194 | |
c161c99b NP |
195 | linking.lo: linking.m |
196 | $(LIBTOOL_COMPILE) $(CC) -fgnu-runtime -c -o $@ $(ALL_CFLAGS) \ | |
197 | $(INCLUDES) $< | |
bce1b489 | 198 | |
c161c99b NP |
199 | linking_gc.lo: linking.m |
200 | $(LIBTOOL_COMPILE) $(CC) -fgnu-runtime -c -o $@ $(ALL_CFLAGS) \ | |
201 | $(OBJC_GCFLAGS) $(INCLUDES) $< | |
bce1b489 | 202 | |
c161c99b NP |
203 | misc_gc.lo: misc.c |
204 | $(LIBTOOL_COMPILE) $(CC) -c $(ALL_CFLAGS) -o $@ $(OBJC_GCFLAGS) \ | |
205 | $(INCLUDES) $< | |
bce1b489 | 206 | |
c161c99b NP |
207 | nil_method_gc.lo: nil_method.c |
208 | $(LIBTOOL_COMPILE) $(CC) -c $(ALL_CFLAGS) -o $@ $(OBJC_GCFLAGS) \ | |
209 | $(INCLUDES) $< | |
bce1b489 | 210 | |
c161c99b NP |
211 | NXConstStr.lo: NXConstStr.m |
212 | $(LIBTOOL_COMPILE) $(CC) -fgnu-runtime -c -o $@ $(ALL_CFLAGS) \ | |
213 | $(INCLUDES) $< | |
bce1b489 | 214 | |
c161c99b NP |
215 | NXConstStr_gc.lo: NXConstStr.m |
216 | $(LIBTOOL_COMPILE) $(CC) -fgnu-runtime -c -o $@ $(ALL_CFLAGS) \ | |
217 | $(OBJC_GCFLAGS) $(INCLUDES) $< | |
bce1b489 | 218 | |
c161c99b NP |
219 | Object.lo: Object.m |
220 | $(LIBTOOL_COMPILE) $(CC) -fgnu-runtime -c -o $@ $(ALL_CFLAGS) \ | |
221 | $(INCLUDES) $< | |
bce1b489 | 222 | |
c161c99b NP |
223 | Object_gc.lo: Object.m |
224 | $(LIBTOOL_COMPILE) $(CC) -fgnu-runtime -c -o $@ $(ALL_CFLAGS) \ | |
225 | $(OBJC_GCFLAGS) $(INCLUDES) $< | |
bce1b489 | 226 | |
c161c99b NP |
227 | objects_gc.lo: objects.c |
228 | $(LIBTOOL_COMPILE) $(CC) -c $(ALL_CFLAGS) -o $@ $(OBJC_GCFLAGS) \ | |
229 | $(INCLUDES) $< | |
bce1b489 | 230 | |
c161c99b NP |
231 | Protocol.lo: Protocol.m |
232 | $(LIBTOOL_COMPILE) $(CC) -fgnu-runtime -c -o $@ $(ALL_CFLAGS) \ | |
233 | $(INCLUDES) $< | |
bce1b489 | 234 | |
c161c99b NP |
235 | Protocol_gc.lo: Protocol.m |
236 | $(LIBTOOL_COMPILE) $(CC) -fgnu-runtime -c -o $@ $(ALL_CFLAGS) \ | |
237 | $(OBJC_GCFLAGS) $(INCLUDES) $< | |
bce1b489 | 238 | |
c161c99b NP |
239 | sarray_gc.lo: sarray.c |
240 | $(LIBTOOL_COMPILE) $(CC) -c -o $@ $(ALL_CFLAGS) $(OBJC_GCFLAGS) \ | |
241 | $(INCLUDES) $< | |
bce1b489 | 242 | |
c161c99b NP |
243 | selector_gc.lo: selector.c |
244 | $(LIBTOOL_COMPILE) $(CC) -c -o $@ $(ALL_CFLAGS) $(OBJC_GCFLAGS) \ | |
245 | $(INCLUDES) $< | |
bce1b489 | 246 | |
c161c99b NP |
247 | sendmsg.lo: sendmsg.c runtime-info.h |
248 | $(LIBTOOL_COMPILE) $(CC) -c -o $@ $(ALL_CFLAGS) $(INCLUDES) $< | |
bce1b489 | 249 | |
c161c99b NP |
250 | sendmsg_gc.lo: sendmsg.c runtime-info.h |
251 | $(LIBTOOL_COMPILE) $(CC) -c -o $@ $(ALL_CFLAGS) $(OBJC_GCFLAGS) \ | |
252 | $(INCLUDES) $< | |
bce1b489 | 253 | |
c161c99b NP |
254 | thr_gc.lo: thr.c |
255 | $(LIBTOOL_COMPILE) $(CC) -c -o $@ $(ALL_CFLAGS) $(OBJC_GCFLAGS) \ | |
256 | $(INCLUDES) $< | |
bce1b489 | 257 | |
c161c99b NP |
258 | $(OBJC_THREAD_FILE)_gc.lo: $(OBJC_THREAD_FILE).c |
259 | $(LIBTOOL_COMPILE) $(CC) -c -o $@ $(ALL_CFLAGS) $(OBJC_GCFLAGS) \ | |
260 | $(INCLUDES) $< | |
bce1b489 BE |
261 | |
262 | doc: info dvi html | |
263 | ||
c161c99b | 264 | libobjc.la: $(OBJS) |
b150efee FS |
265 | $(LIBTOOL_LINK) $(CC) -o $@ $(OBJS) \ |
266 | -rpath $(glibcpp_toolexeclibdir) \ | |
c161c99b | 267 | -version-info $(LIBOBJC_VERSION) |
bce1b489 | 268 | |
c161c99b | 269 | libobjc_gc.la: $(OBJS_GC) |
b150efee FS |
270 | $(LIBTOOL_LINK) $(CC) -o $@ $(OBJS_GC) \ |
271 | -rpath $(glibcpp_toolexeclibdir) \ | |
c161c99b | 272 | -version-info $(LIBOBJC_GC_VERSION) |
bce1b489 | 273 | |
c161c99b NP |
274 | # |
275 | # FIXME -- The following part does not fit in the libtool context. | |
276 | # Libtool is supposed to [going to] be able to create a win 32 DLL | |
277 | # without extra code but since I don't have a win machine to test | |
278 | # if it already works, I leave the old code here. | |
279 | # | |
280 | libobjc_s.a: libobjc.la | |
bce1b489 BE |
281 | mv libobjc.a libobjc_s.a |
282 | ||
283 | # Create a relocatable DLL | |
284 | libobjc.dll: libobjc_s.a libobjc_entry.o | |
285 | $(CC) -mdll -Wl,--base-file -Wl,libobjc.base \ | |
286 | -o libobjc.dll libobjc_s.a libobjc_entry.o -lkernel32 | |
287 | $(DLLTOOL) --dllname libobjc.dll --def $(srcdir)/libobjc.def \ | |
288 | --base-file libobjc.base --output-exp libobjc.exp | |
289 | $(GCC_FOR_TARGET) -mdll -Wl,--base-file libobjc.base libobjc.exp \ | |
290 | -o libobjc.dll libobjc_s.a libobjc_entry.o -lkernel32 | |
291 | $(DLLTOOL) --dllname libobjc.dll --def $(srcdir)/libobjc.def \ | |
292 | --base-file libobjc.base --output-exp libobjc.exp | |
293 | $(GCC_FOR_TARGET) libobjc.exp -mdll \ | |
294 | -o libobjc.dll libobjc_s.a libobjc_entry.o -lkernel32 | |
295 | $(DLLTOOL) --dllname libobjc.dll --def $(srcdir)/libobjc.def \ | |
296 | --output-lib libobjc.a | |
c161c99b NP |
297 | # |
298 | # | |
299 | # | |
300 | # | |
301 | # | |
bce1b489 | 302 | |
10c179f3 JM |
303 | info: |
304 | dvi: | |
305 | html: | |
bce1b489 BE |
306 | |
307 | Makefile: Makefile.in config.status | |
308 | $(SHELL) config.status | |
309 | ||
310 | config.status: configure | |
311 | rm -f config.cache | |
312 | CONFIG_SITE=no-such-file CC='$(CC)' AR='$(AR)' CFLAGS='$(CFLAGS)' \ | |
313 | CPPFLAGS='$(CPPFLAGS)' $(SHELL) config.status --recheck | |
314 | ||
315 | ${srcdir}/configure: configure.in | |
316 | rm -f config.cache | |
317 | cd ${srcdir} && autoconf | |
318 | ||
b150efee | 319 | install: install-libs install-headers |
bce1b489 BE |
320 | |
321 | install-libs: installdirs | |
90e5b39f CC |
322 | $(SHELL) $(toplevel_srcdir)/mkinstalldirs $(DESTDIR)$(glibcpp_toolexeclibdir) |
323 | $(LIBTOOL_INSTALL) $(INSTALL) libobjc.la $(DESTDIR)$(glibcpp_toolexeclibdir); | |
c161c99b | 324 | if [ "$(OBJC_BOEHM_GC)" ]; then \ |
b150efee | 325 | $(LIBTOOL_INSTALL) $(INSTALL) libobjc_gc.la \ |
90e5b39f | 326 | $(DESTDIR)$(glibcpp_toolexeclibdir);\ |
c161c99b | 327 | fi |
b150efee | 328 | $(MULTIDO) $(FLAGS_TO_PASS) multi-do DO="$@" |
90e5b39f | 329 | @-$(LIBTOOL) --mode=finish $(DESTDIR)$(glibcpp_toolexeclibdir) |
bce1b489 BE |
330 | |
331 | # Copy Objective C headers to installation include directory. | |
b150efee | 332 | install-headers: |
90e5b39f | 333 | $(SHELL) $(toplevel_srcdir)/mkinstalldirs $(DESTDIR)$(libsubdir)/include/objc |
bce1b489 | 334 | for file in $(OBJC_H); do \ |
789eb4f5 | 335 | realfile=$(srcdir)/objc/$${file}; \ |
90e5b39f | 336 | $(INSTALL_DATA) $${realfile} $(DESTDIR)$(libsubdir)/include/objc; \ |
bce1b489 BE |
337 | done |
338 | ||
339 | check uninstall install-strip dist installcheck installdirs: | |
340 | ||
341 | mostlyclean: | |
c161c99b NP |
342 | -$(LIBTOOL_CLEAN) rm -f libobjc.la libobjc_gc.la *.lo |
343 | -rm -f runtime-info.h tmp-runtime.s *.o *.lo libobjc* xforward \ | |
bce1b489 BE |
344 | fflags *.aux *.cp *.dvi *.fn *.info *.ky *.log *.pg \ |
345 | *.toc *.tp *.vr *.html libobj.exp | |
346 | @$(MULTICLEAN) multi-clean DO=mostlyclean | |
347 | ||
348 | clean: mostlyclean | |
349 | rm -f config.log | |
350 | @$(MULTICLEAN) multi-clean DO=clean | |
351 | ||
352 | distclean: clean | |
353 | @$(MULTICLEAN) multi-clean DO=distclean | |
354 | rm -f config.cache config.status Makefile configure | |
355 | ||
356 | maintainer-clean realclean: distclean | |
357 | ||
358 | .PHONY: mostlyclean clean distclean maintainer-clean all check uninstall \ | |
359 | install-strip dist installcheck installdirs |