1 # Makefile for GNU Objective C runtime library.
2 # Copyright 1993, 1995, 1996, 1997, 1998, 1999, 2001, 2002, 2003, 2004,
3 # 2005, 2006, 2007, 2008, 2009 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 3, 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 COPYING3. If not see
19 #<http://www.gnu.org/licenses/>.
21 #This was cribbed from the libchill, libiberty and libstdc++
22 #Makefile.in files. Some of this stuff may be unnecessary and
28 #### Start of system configuration section. ####
30 srcdir = @glibcpp_srcdir@
31 VPATH = @glibcpp_srcdir@
33 exec_prefix = @exec_prefix@
34 target_noncanonical = @target_noncanonical@
35 gcc_version := $(shell cat $(srcdir)/../gcc/BASE-VER)
36 host_subdir = @host_subdir@
37 top_srcdir = @top_srcdir@
38 multi_basedir = @multi_basedir@
39 toolexecdir = @toolexecdir@
40 # Toolexecdir is used only by toolexeclibdir
41 toolexeclibdir = @toolexeclibdir@
43 includedirname = @includedirname@
44 libsuffix = @libsuffix@
46 extra_ldflags_libobjc = @extra_ldflags_libobjc@
50 -include ../boehm-gc/threads.mk
52 libdir = $(exec_prefix)/lib
53 libsubdir = $(libdir)/gcc/$(target_noncanonical)/$(gcc_version)
55 # Multilib support variables.
63 # Not configured per top-level version, since that doesn't get passed
64 # down at configure time, but overrridden by the top-level install
67 INSTALL_PROGRAM = @INSTALL_PROGRAM@
68 INSTALL_DATA = @INSTALL_DATA@
77 WARN_CFLAGS = -W -Wall -Wwrite-strings -Wstrict-prototypes
78 ALL_CFLAGS = -I. -I$(srcdir) $(CPPFLAGS) $(DEFS) $(CFLAGS) $(WARN_CFLAGS) \
79 -DIN_GCC -DIN_TARGET_LIBS -fno-strict-aliasing -fexceptions
82 # The following strings describe the version of the obj-C library
83 # begin compiled and compatibility issues.
84 # Please refer to Libtool documentation about how to manage these
86 LIBOBJC_VERSION = @VERSION@
87 LIBOBJC_GC_VERSION = @VERSION@
88 LIBTOOL = @LIBTOOL@ $(LIBTOOLFLAGS)
89 LIBTOOL_COMPILE = $(LIBTOOL) --mode=compile
90 LIBTOOL_LINK = $(LIBTOOL) --mode=link
91 LIBTOOL_INSTALL = $(LIBTOOL) --mode=install
92 LIBTOOL_CLEAN = $(LIBTOOL) --mode=clean
93 #LIBTOOL_UNINSTALL = $(LIBTOOL) --mode=uninstall
95 OBJC_GCFLAGS=-DOBJC_WITH_GC=1
96 OBJC_BOEHM_GC=@OBJC_BOEHM_GC@
97 OBJC_BOEHM_GC_INCLUDES=@OBJC_BOEHM_GC_INCLUDES@
98 OBJC_BOEHM_GC_LIBS=../boehm-gc/libgcjgc_convenience.la $(thread_libs_and_flags)
100 INCLUDES = -I$(srcdir)/objc -I$(srcdir)/$(MULTISRCTOP)../gcc \
101 -I$(srcdir)/$(MULTISRCTOP)../gcc/config \
102 -I$(MULTIBUILDTOP)../../$(host_subdir)/gcc \
103 -I$(srcdir)/$(MULTISRCTOP)../include \
104 $(OBJC_BOEHM_GC_INCLUDES)
111 $(LIBTOOL_COMPILE) $(CC) -c $(ALL_CFLAGS) $(INCLUDES) $<
114 $(LIBTOOL_COMPILE) $(CC) -c $(ALL_CFLAGS) $(INCLUDES) $<
116 # Flags to pass to a recursive make.
119 "AR_FLAGS=$(AR_FLAGS)" \
122 "DESTDIR=$(DESTDIR)" \
123 "LIBCFLAGS=$(LIBCFLAGS)" \
124 "EXTRA_OFILES=$(EXTRA_OFILES)" \
125 "HDEFINES=$(HDEFINES)" \
126 "INSTALL=$(INSTALL)" \
127 "INSTALL_DATA=$(INSTALL_DATA)" \
128 "INSTALL_PROGRAM=$(INSTALL_PROGRAM)" \
129 "LDFLAGS=$(LDFLAGS)" \
130 "LIBTOOL=$(LIBTOOL)" \
131 "LOADLIBES=$(LOADLIBES)" \
132 "PICFLAG=$(PICFLAG)" \
136 "exec_prefix=$(exec_prefix)" \
138 "libsubdir=$(libsubdir)" \
141 all: libobjc$(libsuffix).la $(OBJC_BOEHM_GC)
142 : $(MAKE) ; exec $(MULTIDO) $(FLAGS_TO_PASS) multi-do DO=all
144 # User-visible header files, from the objc/ directory
163 # User-visible header files containing deprecated APIs, from the
164 # objc/deprecated directory
166 OBJC_DEPRECATED_H = \
171 objc_unexpected_exception.h \
172 struct_objc_class.h \
173 struct_objc_protocol.h \
174 struct_objc_selector.h \
177 # Modules that comprise the runtime library.
222 echo "" > tmp-runtime.m
223 echo "/* This file is automatically generated */" > $@
224 $(CC) $(MULTIFLAGS) -print-objc-runtime-info -S tmp-runtime.m >> $@
225 rm -f tmp-runtime.m tmp-runtime.s
227 archive_gc.lo: archive.c
228 $(LIBTOOL_COMPILE) $(CC) -Wno-deprecated-declarations -c -o $@ $(ALL_CFLAGS) \
229 $(OBJC_GCFLAGS) $(INCLUDES) $<
231 archive.lo: archive.c
232 $(LIBTOOL_COMPILE) $(CC) -Wno-deprecated-declarations -c $(ALL_CFLAGS) \
236 $(LIBTOOL_COMPILE) $(CC) -c -o $@ $(ALL_CFLAGS) $(OBJC_GCFLAGS) \
239 encoding_gc.lo: encoding.c
240 $(LIBTOOL_COMPILE) $(CC) -c -o $@ $(ALL_CFLAGS) $(OBJC_GCFLAGS) \
244 $(LIBTOOL_COMPILE) $(CC) -c $(ALL_CFLAGS) -o $@ $(OBJC_GCFLAGS) \
248 $(LIBTOOL_COMPILE) $(CC) -c -o $@ $(ALL_CFLAGS) $(INCLUDES) $<
251 $(LIBTOOL_COMPILE) $(CC) -c -o $@ $(ALL_CFLAGS) $(OBJC_GCFLAGS) \
255 $(LIBTOOL_COMPILE) $(CC) -c -o $@ $(ALL_CFLAGS) $(OBJC_GCFLAGS) \
259 $(LIBTOOL_COMPILE) $(CC) -c -o $@ $(ALL_CFLAGS) $(OBJC_GCFLAGS) \
262 linking.lo: linking.m
263 $(LIBTOOL_COMPILE) $(CC) -fgnu-runtime -c -o $@ $(ALL_CFLAGS) \
266 linking_gc.lo: linking.m
267 $(LIBTOOL_COMPILE) $(CC) -fgnu-runtime -c -o $@ $(ALL_CFLAGS) \
268 $(OBJC_GCFLAGS) $(INCLUDES) $<
270 memory_gc.lo: memory.c
271 $(LIBTOOL_COMPILE) $(CC) -c $(ALL_CFLAGS) -o $@ $(OBJC_GCFLAGS) \
274 nil_method_gc.lo: nil_method.c
275 $(LIBTOOL_COMPILE) $(CC) -c $(ALL_CFLAGS) -o $@ $(OBJC_GCFLAGS) \
278 NXConstStr.lo: NXConstStr.m
279 $(LIBTOOL_COMPILE) $(CC) -fgnu-runtime -c -o $@ $(ALL_CFLAGS) \
282 NXConstStr_gc.lo: NXConstStr.m
283 $(LIBTOOL_COMPILE) $(CC) -fgnu-runtime -c -o $@ $(ALL_CFLAGS) \
284 $(OBJC_GCFLAGS) $(INCLUDES) $<
286 # -Wno-deprecated-declarations is for the objc/typedstream.h functions.
288 $(LIBTOOL_COMPILE) $(CC) -fgnu-runtime -Wno-deprecated-declarations \
289 -c -o $@ $(ALL_CFLAGS) $(INCLUDES) $<
291 # -Wno-deprecated-declarations is for the objc/typedstream.h functions.
292 Object_gc.lo: Object.m
293 $(LIBTOOL_COMPILE) $(CC) -fgnu-runtime -Wno-deprecated-declarations \
294 -c -o $@ $(ALL_CFLAGS) $(OBJC_GCFLAGS) $(INCLUDES) $<
296 objects_gc.lo: objects.c
297 $(LIBTOOL_COMPILE) $(CC) -c $(ALL_CFLAGS) -o $@ $(OBJC_GCFLAGS) \
300 Protocol.lo: Protocol.m
301 $(LIBTOOL_COMPILE) $(CC) -fgnu-runtime -c -o $@ $(ALL_CFLAGS) \
304 Protocol_gc.lo: Protocol.m
305 $(LIBTOOL_COMPILE) $(CC) -fgnu-runtime -c -o $@ $(ALL_CFLAGS) \
306 $(OBJC_GCFLAGS) $(INCLUDES) $<
308 sarray_gc.lo: sarray.c
309 $(LIBTOOL_COMPILE) $(CC) -c -o $@ $(ALL_CFLAGS) $(OBJC_GCFLAGS) \
312 selector_gc.lo: selector.c
313 $(LIBTOOL_COMPILE) $(CC) -c -o $@ $(ALL_CFLAGS) $(OBJC_GCFLAGS) \
316 sendmsg.lo: sendmsg.c runtime-info.h
317 $(LIBTOOL_COMPILE) $(CC) -c -o $@ $(ALL_CFLAGS) $(INCLUDES) $<
319 sendmsg_gc.lo: sendmsg.c runtime-info.h
320 $(LIBTOOL_COMPILE) $(CC) -c -o $@ $(ALL_CFLAGS) $(OBJC_GCFLAGS) \
324 $(LIBTOOL_COMPILE) $(CC) -c -o $@ $(ALL_CFLAGS) $(OBJC_GCFLAGS) \
327 # -Wno-deprecated-declarations is to silence warnings from using
328 # _objc_unexpected_exception.
329 exception.lo: exception.c
330 $(LIBTOOL_COMPILE) $(CC) -c -o $@ $(ALL_CFLAGS) \
331 -fexceptions -Wno-deprecated-declarations $(INCLUDES) $<
333 exception_gc.lo: exception.c
334 $(LIBTOOL_COMPILE) $(CC) -c -o $@ $(ALL_CFLAGS) $(OBJC_GCFLAGS) \
335 -fexceptions -Wno-deprecated-declarations $(INCLUDES) $<
337 doc: info dvi pdf html
339 # No install-html or install-pdf support
340 .PHONY: install-html install-pdf install-info
345 LTLDFLAGS = $(shell $(SHELL) $(top_srcdir)/../libtool-ldflags $(LDFLAGS))
347 libobjc$(libsuffix).la: $(OBJS)
348 $(LIBTOOL_LINK) $(CC) -o $@ $(OBJS) \
349 -rpath $(toolexeclibdir) \
350 -version-info $(LIBOBJC_VERSION) $(extra_ldflags_libobjc) \
353 libobjc_gc$(libsuffix).la: $(OBJS_GC)
354 $(LIBTOOL_LINK) $(CC) -o $@ $(OBJS_GC) $(OBJC_BOEHM_GC_LIBS) \
355 -rpath $(toolexeclibdir) \
356 -version-info $(LIBOBJC_GC_VERSION) $(extra_ldflags_libobjc) \
364 Makefile: Makefile.in config.status
365 $(SHELL) config.status
367 config.status: configure
369 CONFIG_SITE=no-such-file CC='$(CC)' AR='$(AR)' CFLAGS='$(CFLAGS)' \
370 CPPFLAGS='$(CPPFLAGS)' $(SHELL) config.status --recheck
374 ACLOCAL_AMFLAGS = -I ../config -I ..
376 $(srcdir)/../config/multi.m4 \
377 $(srcdir)/../config/override.m4 \
378 $(srcdir)/../config/proginstall.m4 \
379 $(srcdir)/../ltoptions.m4 \
380 $(srcdir)/../ltsugar.m4 \
381 $(srcdir)/../ltversion.m4 \
382 $(srcdir)/../lt~obsolete.m4 \
383 $(srcdir)/acinclude.m4
385 $(srcdir)/configure: @MAINT@ configure.ac $(srcdir)/aclocal.m4
387 cd $(srcdir) && $(AUTOCONF)
389 $(srcdir)/aclocal.m4: @MAINT@ $(aclocal_deps)
390 cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
392 install: install-libs install-headers
394 install-libs: installdirs
395 $(SHELL) $(multi_basedir)/mkinstalldirs $(DESTDIR)$(toolexeclibdir)
396 $(LIBTOOL_INSTALL) $(INSTALL) libobjc$(libsuffix).la $(DESTDIR)$(toolexeclibdir);
397 if [ "$(OBJC_BOEHM_GC)" ]; then \
398 $(LIBTOOL_INSTALL) $(INSTALL) libobjc_gc$(libsuffix).la \
399 $(DESTDIR)$(toolexeclibdir);\
401 $(MULTIDO) $(FLAGS_TO_PASS) multi-do DO="$@"
402 @-$(LIBTOOL) --mode=finish $(DESTDIR)$(toolexeclibdir)
404 # Copy Objective C headers to installation include directory.
406 $(SHELL) $(multi_basedir)/mkinstalldirs $(DESTDIR)$(libsubdir)/$(includedirname)/objc
407 for file in $(OBJC_H); do \
408 realfile=$(srcdir)/objc/$${file}; \
409 $(INSTALL_DATA) $${realfile} $(DESTDIR)$(libsubdir)/$(includedirname)/objc; \
411 $(multi_basedir)/mkinstalldirs $(DESTDIR)$(libsubdir)/$(includedirname)/objc/deprecated
412 for file in $(OBJC_DEPRECATED_H); do \
413 realfile=$(srcdir)/objc/deprecated/$${file}; \
414 $(INSTALL_DATA) $${realfile} $(DESTDIR)$(libsubdir)/$(includedirname)/objc/deprecated; \
417 check uninstall install-strip dist installcheck installdirs:
420 -$(LIBTOOL_CLEAN) rm -f libobjc$(libsuffix).la libobjc_gc$(libsuffix).la *.lo
421 -rm -f runtime-info.h tmp-runtime.s *.o *.lo libobjc* xforward \
422 fflags *.aux *.cp *.dvi *.pdf *.fn *.info *.ky *.log *.pg \
423 *.toc *.tp *.vr *.html libobj.exp
424 @$(MULTICLEAN) multi-clean DO=mostlyclean
428 @$(MULTICLEAN) multi-clean DO=clean
431 @$(MULTICLEAN) multi-clean DO=distclean
432 rm -f config.cache config.status Makefile configure
434 maintainer-clean realclean: distclean
436 .PHONY: mostlyclean clean distclean maintainer-clean all check uninstall \
437 install-strip dist installcheck installdirs
439 # Don't export variables to the environment, in order to not confuse