1 # Makefile for GNU Objective C runtime library.
2 # Copyright 1993, 1995, 1996, 1997, 1998, 1999, 2001, 2002, 2003, 2004
3 # Free Software Foundation, Inc.
5 #This file is part of GCC.
7 #GCC is free software; you can redistribute it and/or modify
8 #it under the terms of the GNU General Public License as published by
9 #the Free Software Foundation; either version 2, or (at your option)
12 #GCC is distributed in the hope that it will be useful,
13 #but WITHOUT ANY WARRANTY; without even the implied warranty of
14 #MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 #GNU General Public License for more details.
17 #You should have received a copy of the GNU General Public License
18 #along with GCC; see the file COPYING. If not, write to
19 #the Free Software Foundation, 59 Temple Place - Suite 330,
20 #Boston, MA 02111-1307, USA. */
22 #This was cribbed from the libchill, libiberty and libstdc++
23 #Makefile.in files. Some of this stuff may be unnecessary and
29 #### Start of system configuration section. ####
31 srcdir = @glibcpp_srcdir@
32 VPATH = @glibcpp_srcdir@
34 exec_prefix = @exec_prefix@
35 target_noncanonical = @target_noncanonical@
36 gcc_version = @gcc_version@
37 host_subdir = @host_subdir@
38 top_srcdir = @top_srcdir@
39 toplevel_srcdir = @toplevel_srcdir@
40 toolexecdir = @toolexecdir@
41 # Toolexecdir is used only by toolexeclibdir
42 toolexeclibdir = @toolexeclibdir@
44 includedirname = @includedirname@
49 libdir = $(exec_prefix)/lib
50 libsubdir = $(libdir)/gcc/$(target_noncanonical)/$(gcc_version)
52 # Multilib support variables.
60 # Not configured per top-level version, since that doesn't get passed
61 # down at configure time, but overrridden by the top-level install
64 INSTALL_PROGRAM = @INSTALL_PROGRAM@
65 INSTALL_DATA = @INSTALL_DATA@
74 WARN_CFLAGS = -W -Wall -Wwrite-strings -Wstrict-prototypes
75 GTHREAD_FLAGS=@GTHREAD_FLAGS@
76 ALL_CFLAGS = -I. -I$(srcdir) $(CPPFLAGS) $(DEFS) $(CFLAGS) $(WARN_CFLAGS) \
77 $(GTHREAD_FLAGS) -DIN_GCC -DIN_TARGET_LIBS -fno-strict-aliasing
80 # The following strings describe the version of the obj-C library
81 # begin compiled and compatibility issues.
82 # Please refer to Libtool documentation about how to manage these
84 LIBOBJC_VERSION = @VERSION@
85 LIBOBJC_GC_VERSION = @VERSION@
87 LIBTOOL_COMPILE = $(LIBTOOL) --mode=compile
88 LIBTOOL_LINK = $(LIBTOOL) --mode=link
89 LIBTOOL_INSTALL = $(LIBTOOL) --mode=install
90 LIBTOOL_CLEAN = $(LIBTOOL) --mode=clean
91 #LIBTOOL_UNINSTALL = $(LIBTOOL) --mode=uninstall
93 INCLUDES = -I$(srcdir)/objc -I$(srcdir)/$(MULTISRCTOP)../gcc \
94 -I$(srcdir)/$(MULTISRCTOP)../gcc/config \
95 -I$(MULTIBUILDTOP)../../$(host_subdir)/gcc \
96 -I$(srcdir)/$(MULTISRCTOP)../include
98 OBJC_GCFLAGS=-DOBJC_WITH_GC=1
99 OBJC_THREAD_FILE=thr-objc
100 OBJC_BOEHM_GC=@OBJC_BOEHM_GC@
106 $(LIBTOOL_COMPILE) $(CC) -c $(ALL_CFLAGS) $(INCLUDES) $<
109 $(LIBTOOL_COMPILE) $(CC) -c $(ALL_CFLAGS) $(INCLUDES) $<
111 # Flags to pass to a recursive make.
114 "AR_FLAGS=$(AR_FLAGS)" \
117 "DESTDIR=$(DESTDIR)" \
118 "LIBCFLAGS=$(LIBCFLAGS)" \
119 "EXTRA_OFILES=$(EXTRA_OFILES)" \
120 "HDEFINES=$(HDEFINES)" \
121 "INSTALL=$(INSTALL)" \
122 "INSTALL_DATA=$(INSTALL_DATA)" \
123 "INSTALL_PROGRAM=$(INSTALL_PROGRAM)" \
124 "LDFLAGS=$(LDFLAGS)" \
125 "LIBTOOL=$(LIBTOOL)" \
126 "LOADLIBES=$(LOADLIBES)" \
127 "PICFLAG=$(PICFLAG)" \
131 "exec_prefix=$(exec_prefix)" \
133 "libsubdir=$(libsubdir)" \
136 all: libobjc$(libext).la $(OBJC_BOEHM_GC)
137 : $(MAKE) ; exec $(MULTIDO) $(FLAGS_TO_PASS) multi-do DO=all
139 # User-visible header files.
141 OBJC_H = hash.h objc-list.h sarray.h objc.h objc-api.h \
142 NXConstStr.h Object.h Protocol.h encoding.h typedstream.h \
145 # Modules that comprise the runtime library.
147 OBJS = archive.lo class.lo encoding.lo gc.lo hash.lo init.lo linking.lo \
148 misc.lo nil_method.lo NXConstStr.lo Object.lo objects.lo \
149 Protocol.lo sarray.lo selector.lo sendmsg.lo thr.lo \
150 $(OBJC_THREAD_FILE).lo exception.lo
152 OBJS_GC = archive_gc.lo class_gc.lo encoding_gc.lo gc_gc.lo hash_gc.lo \
153 init_gc.lo linking_gc.lo misc_gc.lo nil_method_gc.lo \
154 NXConstStr_gc.lo Object_gc.lo objects_gc.lo Protocol_gc.lo \
155 sarray_gc.lo selector_gc.lo sendmsg_gc.lo thr_gc.lo \
156 $(OBJC_THREAD_FILE)_gc.lo exception_gc.lo
159 echo "" > tmp-runtime.m
160 echo "/* This file is automatically generated */" > $@
161 $(CC) $(MULTIFLAGS) -print-objc-runtime-info -S tmp-runtime.m >> $@
162 rm -f tmp-runtime.m tmp-runtime.s
164 archive_gc.lo: archive.c
165 $(LIBTOOL_COMPILE) $(CC) -c -o $@ $(ALL_CFLAGS) $(OBJC_GCFLAGS) \
169 $(LIBTOOL_COMPILE) $(CC) -c -o $@ $(ALL_CFLAGS) $(OBJC_GCFLAGS) \
172 encoding_gc.lo: encoding.c
173 $(LIBTOOL_COMPILE) $(CC) -c -o $@ $(ALL_CFLAGS) $(OBJC_GCFLAGS) \
177 $(LIBTOOL_COMPILE) $(CC) -c -o $@ $(ALL_CFLAGS) $(INCLUDES) $<
180 $(LIBTOOL_COMPILE) $(CC) -c -o $@ $(ALL_CFLAGS) $(OBJC_GCFLAGS) \
184 $(LIBTOOL_COMPILE) $(CC) -c -o $@ $(ALL_CFLAGS) $(OBJC_GCFLAGS) \
188 $(LIBTOOL_COMPILE) $(CC) -c -o $@ $(ALL_CFLAGS) $(OBJC_GCFLAGS) \
191 linking.lo: linking.m
192 $(LIBTOOL_COMPILE) $(CC) -fgnu-runtime -c -o $@ $(ALL_CFLAGS) \
195 linking_gc.lo: linking.m
196 $(LIBTOOL_COMPILE) $(CC) -fgnu-runtime -c -o $@ $(ALL_CFLAGS) \
197 $(OBJC_GCFLAGS) $(INCLUDES) $<
200 $(LIBTOOL_COMPILE) $(CC) -c $(ALL_CFLAGS) -o $@ $(OBJC_GCFLAGS) \
203 nil_method_gc.lo: nil_method.c
204 $(LIBTOOL_COMPILE) $(CC) -c $(ALL_CFLAGS) -o $@ $(OBJC_GCFLAGS) \
207 NXConstStr.lo: NXConstStr.m
208 $(LIBTOOL_COMPILE) $(CC) -fgnu-runtime -c -o $@ $(ALL_CFLAGS) \
211 NXConstStr_gc.lo: NXConstStr.m
212 $(LIBTOOL_COMPILE) $(CC) -fgnu-runtime -c -o $@ $(ALL_CFLAGS) \
213 $(OBJC_GCFLAGS) $(INCLUDES) $<
216 $(LIBTOOL_COMPILE) $(CC) -fgnu-runtime -c -o $@ $(ALL_CFLAGS) \
219 Object_gc.lo: Object.m
220 $(LIBTOOL_COMPILE) $(CC) -fgnu-runtime -c -o $@ $(ALL_CFLAGS) \
221 $(OBJC_GCFLAGS) $(INCLUDES) $<
223 objects_gc.lo: objects.c
224 $(LIBTOOL_COMPILE) $(CC) -c $(ALL_CFLAGS) -o $@ $(OBJC_GCFLAGS) \
227 Protocol.lo: Protocol.m
228 $(LIBTOOL_COMPILE) $(CC) -fgnu-runtime -c -o $@ $(ALL_CFLAGS) \
231 Protocol_gc.lo: Protocol.m
232 $(LIBTOOL_COMPILE) $(CC) -fgnu-runtime -c -o $@ $(ALL_CFLAGS) \
233 $(OBJC_GCFLAGS) $(INCLUDES) $<
235 sarray_gc.lo: sarray.c
236 $(LIBTOOL_COMPILE) $(CC) -c -o $@ $(ALL_CFLAGS) $(OBJC_GCFLAGS) \
239 selector_gc.lo: selector.c
240 $(LIBTOOL_COMPILE) $(CC) -c -o $@ $(ALL_CFLAGS) $(OBJC_GCFLAGS) \
243 sendmsg.lo: sendmsg.c runtime-info.h
244 $(LIBTOOL_COMPILE) $(CC) -c -o $@ $(ALL_CFLAGS) $(INCLUDES) $<
246 sendmsg_gc.lo: sendmsg.c runtime-info.h
247 $(LIBTOOL_COMPILE) $(CC) -c -o $@ $(ALL_CFLAGS) $(OBJC_GCFLAGS) \
251 $(LIBTOOL_COMPILE) $(CC) -c -o $@ $(ALL_CFLAGS) $(OBJC_GCFLAGS) \
254 $(OBJC_THREAD_FILE)_gc.lo: $(OBJC_THREAD_FILE).c
255 $(LIBTOOL_COMPILE) $(CC) -c -o $@ $(ALL_CFLAGS) $(OBJC_GCFLAGS) \
258 exception.lo: exception.c
259 $(LIBTOOL_COMPILE) $(CC) -c -o $@ $(ALL_CFLAGS) \
260 -fexceptions $(INCLUDES) $<
262 exception_gc.lo: exception.c
263 $(LIBTOOL_COMPILE) $(CC) -c -o $@ $(ALL_CFLAGS) $(OBJC_GCFLAGS) \
264 -fexceptions $(INCLUDES) $<
268 libobjc$(libext).la: $(OBJS)
269 $(LIBTOOL_LINK) $(CC) -o $@ $(OBJS) \
270 -rpath $(toolexeclibdir) \
271 -version-info $(LIBOBJC_VERSION)
273 libobjc_gc$(libext).la: $(OBJS_GC)
274 $(LIBTOOL_LINK) $(CC) -o $@ $(OBJS_GC) \
275 -rpath $(toolexeclibdir) \
276 -version-info $(LIBOBJC_GC_VERSION)
279 # FIXME -- The following part does not fit in the libtool context.
280 # Libtool is supposed to [going to] be able to create a win 32 DLL
281 # without extra code but since I don't have a win machine to test
282 # if it already works, I leave the old code here.
284 libobjc_s.a: libobjc.la
285 mv libobjc.a libobjc_s.a
287 # Create a relocatable DLL
288 libobjc.dll: libobjc_s.a libobjc_entry.o
289 $(CC) -mdll -Wl,--base-file -Wl,libobjc.base \
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) -mdll -Wl,--base-file libobjc.base libobjc.exp \
294 -o libobjc.dll libobjc_s.a libobjc_entry.o -lkernel32
295 $(DLLTOOL) --dllname libobjc.dll --def $(srcdir)/libobjc.def \
296 --base-file libobjc.base --output-exp libobjc.exp
297 $(GCC_FOR_TARGET) libobjc.exp -mdll \
298 -o libobjc.dll libobjc_s.a libobjc_entry.o -lkernel32
299 $(DLLTOOL) --dllname libobjc.dll --def $(srcdir)/libobjc.def \
300 --output-lib libobjc.a
311 Makefile: Makefile.in config.status
312 $(SHELL) config.status
314 config.status: configure
316 CONFIG_SITE=no-such-file CC='$(CC)' AR='$(AR)' CFLAGS='$(CFLAGS)' \
317 CPPFLAGS='$(CPPFLAGS)' $(SHELL) config.status --recheck
319 ${srcdir}/configure: @MAINT@ configure.ac
321 cd ${srcdir} && autoconf
323 install: install-libs install-headers
325 install-libs: installdirs
326 $(SHELL) $(toplevel_srcdir)/mkinstalldirs $(DESTDIR)$(toolexeclibdir)
327 $(LIBTOOL_INSTALL) $(INSTALL) libobjc$(libext).la $(DESTDIR)$(toolexeclibdir);
328 if [ "$(OBJC_BOEHM_GC)" ]; then \
329 $(LIBTOOL_INSTALL) $(INSTALL) libobjc_gc$(libext).la \
330 $(DESTDIR)$(toolexeclibdir);\
332 $(MULTIDO) $(FLAGS_TO_PASS) multi-do DO="$@"
333 @-$(LIBTOOL) --mode=finish $(DESTDIR)$(toolexeclibdir)
335 # Copy Objective C headers to installation include directory.
337 $(SHELL) $(toplevel_srcdir)/mkinstalldirs $(DESTDIR)$(libsubdir)/$(includedirname)/objc
338 for file in $(OBJC_H); do \
339 realfile=$(srcdir)/objc/$${file}; \
340 $(INSTALL_DATA) $${realfile} $(DESTDIR)$(libsubdir)/$(includedirname)/objc; \
343 check uninstall install-strip dist installcheck installdirs:
346 -$(LIBTOOL_CLEAN) rm -f libobjc$(libext).la libobjc_gc$(libext).la *.lo
347 -rm -f runtime-info.h tmp-runtime.s *.o *.lo libobjc* xforward \
348 fflags *.aux *.cp *.dvi *.fn *.info *.ky *.log *.pg \
349 *.toc *.tp *.vr *.html libobj.exp
350 @$(MULTICLEAN) multi-clean DO=mostlyclean
354 @$(MULTICLEAN) multi-clean DO=clean
357 @$(MULTICLEAN) multi-clean DO=distclean
358 rm -f config.cache config.status Makefile configure
360 maintainer-clean realclean: distclean
362 .PHONY: mostlyclean clean distclean maintainer-clean all check uninstall \
363 install-strip dist installcheck installdirs
365 # Don't export variables to the environment, in order to not confuse