1 # Makefile for GNU Objective C runtime library.
2 # Copyright 1993, 1995, 1996, 1997, 1998, 1999, 2001, 2002, 2003, 2004,
3 # 2005, 2006 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, 51 Franklin Street, Fifth Floor,
20 #Boston, MA 02110-1301, 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 := $(shell cat $(srcdir)/../gcc/BASE-VER)
37 host_subdir = @host_subdir@
38 top_srcdir = @top_srcdir@
39 multi_basedir = @multi_basedir@
40 toolexecdir = @toolexecdir@
41 # Toolexecdir is used only by toolexeclibdir
42 toolexeclibdir = @toolexeclibdir@
44 includedirname = @includedirname@
46 extra_ldflags_libobjc = @extra_ldflags_libobjc@
50 libdir = $(exec_prefix)/lib
51 libsubdir = $(libdir)/gcc/$(target_noncanonical)/$(gcc_version)
53 # Multilib support variables.
61 # Not configured per top-level version, since that doesn't get passed
62 # down at configure time, but overrridden by the top-level install
65 INSTALL_PROGRAM = @INSTALL_PROGRAM@
66 INSTALL_DATA = @INSTALL_DATA@
75 WARN_CFLAGS = -W -Wall -Wwrite-strings -Wstrict-prototypes
76 ALL_CFLAGS = -I. -I$(srcdir) $(CPPFLAGS) $(DEFS) $(CFLAGS) $(WARN_CFLAGS) \
77 -DIN_GCC -DIN_TARGET_LIBS -fno-strict-aliasing -fexceptions
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 OBJC_GCFLAGS=-DOBJC_WITH_GC=1
94 OBJC_THREAD_FILE=thr-objc
95 OBJC_BOEHM_GC=@OBJC_BOEHM_GC@
96 OBJC_BOEHM_GC_INCLUDES=@OBJC_BOEHM_GC_INCLUDES@
98 INCLUDES = -I$(srcdir)/objc -I$(srcdir)/$(MULTISRCTOP)../gcc \
99 -I$(srcdir)/$(MULTISRCTOP)../gcc/config \
100 -I$(MULTIBUILDTOP)../../$(host_subdir)/gcc \
101 -I$(srcdir)/$(MULTISRCTOP)../include \
102 $(OBJC_BOEHM_GC_INCLUDES)
109 $(LIBTOOL_COMPILE) $(CC) -c $(ALL_CFLAGS) $(INCLUDES) $<
112 $(LIBTOOL_COMPILE) $(CC) -c $(ALL_CFLAGS) $(INCLUDES) $<
114 # Flags to pass to a recursive make.
117 "AR_FLAGS=$(AR_FLAGS)" \
120 "DESTDIR=$(DESTDIR)" \
121 "LIBCFLAGS=$(LIBCFLAGS)" \
122 "EXTRA_OFILES=$(EXTRA_OFILES)" \
123 "HDEFINES=$(HDEFINES)" \
124 "INSTALL=$(INSTALL)" \
125 "INSTALL_DATA=$(INSTALL_DATA)" \
126 "INSTALL_PROGRAM=$(INSTALL_PROGRAM)" \
127 "LDFLAGS=$(LDFLAGS)" \
128 "LIBTOOL=$(LIBTOOL)" \
129 "LOADLIBES=$(LOADLIBES)" \
130 "PICFLAG=$(PICFLAG)" \
134 "exec_prefix=$(exec_prefix)" \
136 "libsubdir=$(libsubdir)" \
139 all: libobjc.la $(OBJC_BOEHM_GC)
140 : $(MAKE) ; exec $(MULTIDO) $(FLAGS_TO_PASS) multi-do DO=all
142 # User-visible header files.
144 OBJC_H = hash.h objc-list.h sarray.h objc.h objc-api.h \
145 NXConstStr.h Object.h Protocol.h encoding.h typedstream.h \
148 # Modules that comprise the runtime library.
150 OBJS = archive.lo class.lo encoding.lo gc.lo hash.lo init.lo linking.lo \
151 misc.lo nil_method.lo NXConstStr.lo Object.lo objects.lo \
152 Protocol.lo sarray.lo selector.lo sendmsg.lo thr.lo \
153 $(OBJC_THREAD_FILE).lo exception.lo
155 OBJS_GC = archive_gc.lo class_gc.lo encoding_gc.lo gc_gc.lo hash_gc.lo \
156 init_gc.lo linking_gc.lo misc_gc.lo nil_method_gc.lo \
157 NXConstStr_gc.lo Object_gc.lo objects_gc.lo Protocol_gc.lo \
158 sarray_gc.lo selector_gc.lo sendmsg_gc.lo thr_gc.lo \
159 $(OBJC_THREAD_FILE)_gc.lo exception_gc.lo
162 echo "" > tmp-runtime.m
163 echo "/* This file is automatically generated */" > $@
164 $(CC) $(MULTIFLAGS) -print-objc-runtime-info -S tmp-runtime.m >> $@
165 rm -f tmp-runtime.m tmp-runtime.s
167 archive_gc.lo: archive.c
168 $(LIBTOOL_COMPILE) $(CC) -c -o $@ $(ALL_CFLAGS) $(OBJC_GCFLAGS) \
172 $(LIBTOOL_COMPILE) $(CC) -c -o $@ $(ALL_CFLAGS) $(OBJC_GCFLAGS) \
175 encoding_gc.lo: encoding.c
176 $(LIBTOOL_COMPILE) $(CC) -c -o $@ $(ALL_CFLAGS) $(OBJC_GCFLAGS) \
180 $(LIBTOOL_COMPILE) $(CC) -c -o $@ $(ALL_CFLAGS) $(INCLUDES) $<
183 $(LIBTOOL_COMPILE) $(CC) -c -o $@ $(ALL_CFLAGS) $(OBJC_GCFLAGS) \
187 $(LIBTOOL_COMPILE) $(CC) -c -o $@ $(ALL_CFLAGS) $(OBJC_GCFLAGS) \
191 $(LIBTOOL_COMPILE) $(CC) -c -o $@ $(ALL_CFLAGS) $(OBJC_GCFLAGS) \
194 linking.lo: linking.m
195 $(LIBTOOL_COMPILE) $(CC) -fgnu-runtime -c -o $@ $(ALL_CFLAGS) \
198 linking_gc.lo: linking.m
199 $(LIBTOOL_COMPILE) $(CC) -fgnu-runtime -c -o $@ $(ALL_CFLAGS) \
200 $(OBJC_GCFLAGS) $(INCLUDES) $<
203 $(LIBTOOL_COMPILE) $(CC) -c $(ALL_CFLAGS) -o $@ $(OBJC_GCFLAGS) \
206 nil_method_gc.lo: nil_method.c
207 $(LIBTOOL_COMPILE) $(CC) -c $(ALL_CFLAGS) -o $@ $(OBJC_GCFLAGS) \
210 NXConstStr.lo: NXConstStr.m
211 $(LIBTOOL_COMPILE) $(CC) -fgnu-runtime -c -o $@ $(ALL_CFLAGS) \
214 NXConstStr_gc.lo: NXConstStr.m
215 $(LIBTOOL_COMPILE) $(CC) -fgnu-runtime -c -o $@ $(ALL_CFLAGS) \
216 $(OBJC_GCFLAGS) $(INCLUDES) $<
219 $(LIBTOOL_COMPILE) $(CC) -fgnu-runtime -c -o $@ $(ALL_CFLAGS) \
222 Object_gc.lo: Object.m
223 $(LIBTOOL_COMPILE) $(CC) -fgnu-runtime -c -o $@ $(ALL_CFLAGS) \
224 $(OBJC_GCFLAGS) $(INCLUDES) $<
226 objects_gc.lo: objects.c
227 $(LIBTOOL_COMPILE) $(CC) -c $(ALL_CFLAGS) -o $@ $(OBJC_GCFLAGS) \
230 Protocol.lo: Protocol.m
231 $(LIBTOOL_COMPILE) $(CC) -fgnu-runtime -c -o $@ $(ALL_CFLAGS) \
234 Protocol_gc.lo: Protocol.m
235 $(LIBTOOL_COMPILE) $(CC) -fgnu-runtime -c -o $@ $(ALL_CFLAGS) \
236 $(OBJC_GCFLAGS) $(INCLUDES) $<
238 sarray_gc.lo: sarray.c
239 $(LIBTOOL_COMPILE) $(CC) -c -o $@ $(ALL_CFLAGS) $(OBJC_GCFLAGS) \
242 selector_gc.lo: selector.c
243 $(LIBTOOL_COMPILE) $(CC) -c -o $@ $(ALL_CFLAGS) $(OBJC_GCFLAGS) \
246 sendmsg.lo: sendmsg.c runtime-info.h
247 $(LIBTOOL_COMPILE) $(CC) -c -o $@ $(ALL_CFLAGS) $(INCLUDES) $<
249 sendmsg_gc.lo: sendmsg.c runtime-info.h
250 $(LIBTOOL_COMPILE) $(CC) -c -o $@ $(ALL_CFLAGS) $(OBJC_GCFLAGS) \
254 $(LIBTOOL_COMPILE) $(CC) -c -o $@ $(ALL_CFLAGS) $(OBJC_GCFLAGS) \
257 $(OBJC_THREAD_FILE)_gc.lo: $(OBJC_THREAD_FILE).c
258 $(LIBTOOL_COMPILE) $(CC) -c -o $@ $(ALL_CFLAGS) $(OBJC_GCFLAGS) \
261 exception.lo: exception.c
262 $(LIBTOOL_COMPILE) $(CC) -c -o $@ $(ALL_CFLAGS) \
263 -fexceptions $(INCLUDES) $<
265 exception_gc.lo: exception.c
266 $(LIBTOOL_COMPILE) $(CC) -c -o $@ $(ALL_CFLAGS) $(OBJC_GCFLAGS) \
267 -fexceptions $(INCLUDES) $<
269 doc: info dvi pdf html
271 # No install-html or install-pdf support
272 .PHONY: install-html install-pdf
277 $(LIBTOOL_LINK) $(CC) -o $@ $(OBJS) \
278 -rpath $(toolexeclibdir) \
279 -version-info $(LIBOBJC_VERSION) $(extra_ldflags_libobjc)
281 libobjc_gc.la: $(OBJS_GC)
282 $(LIBTOOL_LINK) $(CC) -o $@ $(OBJS_GC) \
283 -rpath $(toolexeclibdir) \
284 -version-info $(LIBOBJC_GC_VERSION) $(extra_ldflags_libobjc)
287 # FIXME -- The following part does not fit in the libtool context.
288 # Libtool is supposed to [going to] be able to create a win 32 DLL
289 # without extra code but since I don't have a win machine to test
290 # if it already works, I leave the old code here.
292 libobjc_s.a: libobjc.la
293 mv libobjc.a libobjc_s.a
295 # Create a relocatable DLL
296 libobjc.dll: libobjc_s.a libobjc_entry.o
297 $(CC) -mdll -Wl,--base-file -Wl,libobjc.base \
298 -o libobjc.dll libobjc_s.a libobjc_entry.o -lkernel32
299 $(DLLTOOL) --dllname libobjc.dll --def $(srcdir)/libobjc.def \
300 --base-file libobjc.base --output-exp libobjc.exp
301 $(GCC_FOR_TARGET) -mdll -Wl,--base-file libobjc.base libobjc.exp \
302 -o libobjc.dll libobjc_s.a libobjc_entry.o -lkernel32
303 $(DLLTOOL) --dllname libobjc.dll --def $(srcdir)/libobjc.def \
304 --base-file libobjc.base --output-exp libobjc.exp
305 $(GCC_FOR_TARGET) libobjc.exp -mdll \
306 -o libobjc.dll libobjc_s.a libobjc_entry.o -lkernel32
307 $(DLLTOOL) --dllname libobjc.dll --def $(srcdir)/libobjc.def \
308 --output-lib libobjc.a
320 Makefile: Makefile.in config.status
321 $(SHELL) config.status
323 config.status: configure
325 CONFIG_SITE=no-such-file CC='$(CC)' AR='$(AR)' CFLAGS='$(CFLAGS)' \
326 CPPFLAGS='$(CPPFLAGS)' $(SHELL) config.status --recheck
328 ${srcdir}/configure: @MAINT@ configure.ac
330 cd ${srcdir} && autoconf
332 install: install-libs install-headers
334 install-libs: installdirs
335 $(SHELL) $(multi_basedir)/mkinstalldirs $(DESTDIR)$(toolexeclibdir)
336 $(LIBTOOL_INSTALL) $(INSTALL) libobjc.la $(DESTDIR)$(toolexeclibdir);
337 if [ "$(OBJC_BOEHM_GC)" ]; then \
338 $(LIBTOOL_INSTALL) $(INSTALL) libobjc_gc.la \
339 $(DESTDIR)$(toolexeclibdir);\
341 $(MULTIDO) $(FLAGS_TO_PASS) multi-do DO="$@"
342 @-$(LIBTOOL) --mode=finish $(DESTDIR)$(toolexeclibdir)
344 # Copy Objective C headers to installation include directory.
346 $(SHELL) $(multi_basedir)/mkinstalldirs $(DESTDIR)$(libsubdir)/$(includedirname)/objc
347 for file in $(OBJC_H); do \
348 realfile=$(srcdir)/objc/$${file}; \
349 $(INSTALL_DATA) $${realfile} $(DESTDIR)$(libsubdir)/$(includedirname)/objc; \
352 check uninstall install-strip dist installcheck installdirs:
355 -$(LIBTOOL_CLEAN) rm -f libobjc.la libobjc_gc.la *.lo
356 -rm -f runtime-info.h tmp-runtime.s *.o *.lo libobjc* xforward \
357 fflags *.aux *.cp *.dvi *.pdf *.fn *.info *.ky *.log *.pg \
358 *.toc *.tp *.vr *.html libobj.exp
359 @$(MULTICLEAN) multi-clean DO=mostlyclean
363 @$(MULTICLEAN) multi-clean DO=clean
366 @$(MULTICLEAN) multi-clean DO=distclean
367 rm -f config.cache config.status Makefile configure
369 maintainer-clean realclean: distclean
371 .PHONY: mostlyclean clean distclean maintainer-clean all check uninstall \
372 install-strip dist installcheck installdirs
374 # Don't export variables to the environment, in order to not confuse