OSDN Git Service

PR ada/60703
[pf3gnuchains/gcc-fork.git] / libobjc / Makefile.in
index 1e6c337..1427bac 100644 (file)
@@ -1,12 +1,12 @@
 # Makefile for GNU Objective C runtime library.
-# Copyright (C) 1993, 95-98, 1999, 2001, 2002, 2003
-# Free Software Foundation, Inc.
+# Copyright 1993, 1995, 1996, 1997, 1998, 1999, 2001, 2002, 2003, 2004,
+# 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
 
 #This file is part of GCC.
 
 #GCC is free software; you can redistribute it and/or modify
 #it under the terms of the GNU General Public License as published by
-#the Free Software Foundation; either version 2, or (at your option)
+#the Free Software Foundation; either version 3, or (at your option)
 #any later version.
 
 #GCC is distributed in the hope that it will be useful,
@@ -15,9 +15,8 @@
 #GNU General Public License for more details.
 
 #You should have received a copy of the GNU General Public License
-#along with GCC; see the file COPYING.  If not, write to
-#the Free Software Foundation, 59 Temple Place - Suite 330,
-#Boston, MA 02111-1307, USA.  */
+#along with GCC; see the file COPYING3.  If not see
+#<http://www.gnu.org/licenses/>.
 
 #This was cribbed from the libchill, libiberty and libstdc++
 #Makefile.in files.  Some of this stuff may be unnecessary and
@@ -32,19 +31,27 @@ srcdir = @glibcpp_srcdir@
 VPATH = @glibcpp_srcdir@
 prefix = @prefix@
 exec_prefix = @exec_prefix@
-target_alias = @target_alias@
-gcc_version = @gcc_version@
-gcc_version_trigger = @gcc_version_trigger@
+target_noncanonical = @target_noncanonical@
+gcc_version := $(shell cat $(srcdir)/../gcc/BASE-VER)
+host_subdir = @host_subdir@
 top_srcdir = @top_srcdir@
-toplevel_srcdir = @toplevel_srcdir@
-toolexecdir = @glibcpp_toolexecdir@
-glibcpp_toolexecdir = @glibcpp_toolexecdir@
-glibcpp_toolexeclibdir = @glibcpp_toolexeclibdir@
+multi_basedir = @multi_basedir@
+toolexecdir = @toolexecdir@
+# Toolexecdir is used only by toolexeclibdir
+toolexeclibdir = @toolexeclibdir@
+
+includedirname = @includedirname@
+libsuffix = @libsuffix@
+
+lt_host_flags = @lt_host_flags@
+extra_ldflags_libobjc = @extra_ldflags_libobjc@
 
 top_builddir = .
 
+-include ../boehm-gc/threads.mk
+
 libdir = $(exec_prefix)/lib
-libsubdir = $(libdir)/gcc/$(target_alias)/$(gcc_version)
+libsubdir = $(libdir)/gcc/$(target_noncanonical)/$(gcc_version)
 
 # Multilib support variables.
 MULTISRCTOP =
@@ -69,41 +76,98 @@ RANLIB = @RANLIB@
 CC = @CC@
 CFLAGS = @CFLAGS@
 WARN_CFLAGS = -W -Wall -Wwrite-strings -Wstrict-prototypes
-GTHREAD_FLAGS=@GTHREAD_FLAGS@
 ALL_CFLAGS = -I. -I$(srcdir) $(CPPFLAGS) $(DEFS) $(CFLAGS) $(WARN_CFLAGS) \
-       $(GTHREAD_FLAGS) -DIN_GCC -DIN_TARGET_LIBS
+       -DIN_GCC -DIN_TARGET_LIBS -fno-strict-aliasing -fexceptions
 
 # Libtool
 # The following strings describe the version of the obj-C library 
 # begin compiled and compatibility issues.
 # Please refer to Libtool documentation about how to manage these 
 # numbers.
-LIBOBJC_VERSION = 1:0:0
-LIBOBJC_GC_VERSION = 1:0:0
-# @LIBTOOL@ does not get it right, so we hack it in - FIXME
-LIBTOOL = ./libtool
+LIBOBJC_VERSION = @VERSION@
+LIBOBJC_GC_VERSION = @VERSION@
+LIBTOOL = @LIBTOOL@ $(LIBTOOLFLAGS)
 LIBTOOL_COMPILE = $(LIBTOOL) --mode=compile
 LIBTOOL_LINK    = $(LIBTOOL) --mode=link 
 LIBTOOL_INSTALL = $(LIBTOOL) --mode=install
 LIBTOOL_CLEAN   = $(LIBTOOL) --mode=clean
 #LIBTOOL_UNINSTALL = $(LIBTOOL) --mode=uninstall
 
-INCLUDES = -I$(srcdir)/objc  -I$(srcdir)/$(MULTISRCTOP)../gcc \
-  -I$(srcdir)/$(MULTISRCTOP)../gcc/config -I$(MULTIBUILDTOP)../../gcc \
-  -I$(srcdir)/$(MULTISRCTOP)../include
-
-OBJC_GCFLAGS=-DOBJC_WITH_GC=1
-OBJC_THREAD_FILE=thr-objc
+OBJC_GCFLAGS=@OBJC_GCFLAGS@
 OBJC_BOEHM_GC=@OBJC_BOEHM_GC@
-
-.SUFFIXES:
-.SUFFIXES: .c .m .lo
-
-.c.lo:
-       $(LIBTOOL_COMPILE) $(CC) -c $(ALL_CFLAGS) $(INCLUDES) $<
-
-.m.lo:
-       $(LIBTOOL_COMPILE) $(CC) -c $(ALL_CFLAGS) $(INCLUDES) $<
+OBJC_BOEHM_GC_INCLUDES=@OBJC_BOEHM_GC_INCLUDES@
+OBJC_BOEHM_GC_LIBS=../boehm-gc/libgcjgc_convenience.la $(thread_libs_and_flags)
+
+INCLUDES = -I$(srcdir)/$(MULTISRCTOP)../gcc \
+  -I$(srcdir)/$(MULTISRCTOP)../gcc/config \
+  -I$(MULTIBUILDTOP)../../$(host_subdir)/gcc \
+  -I$(srcdir)/$(MULTISRCTOP)../libgcc \
+  -I$(MULTIBUILDTOP)../libgcc \
+  -I$(srcdir)/$(MULTISRCTOP)../include \
+  $(OBJC_BOEHM_GC_INCLUDES)
+
+##
+## The list of header/source files
+##
+
+# User-visible header files, from the objc/ directory
+OBJC_H = \
+  objc.h \
+  objc-exception.h \
+  objc-sync.h \
+  \
+  NXConstStr.h \
+  Object.h \
+  Protocol.h \
+  message.h \
+  objc-decls.h \
+  runtime.h \
+  thr.h
+
+# Objective-C source files to compile
+OBJC_SOURCE_FILES = \
+   NXConstStr.m \
+   Object.m \
+   Protocol.m \
+   accessors.m \
+   linking.m
+
+# C source files to compile
+C_SOURCE_FILES = \
+   class.c \
+   encoding.c \
+   error.c \
+   gc.c \
+   hash.c \
+   init.c \
+   ivars.c \
+   memory.c \
+   methods.c \
+   nil_method.c \
+   objc-foreach.c \
+   objc-sync.c \
+   objects.c \
+   protocols.c \
+   sarray.c \
+   selector.c \
+   sendmsg.c \
+   thr.c \
+   exception.c
+
+# Object files to link (when the library is linked with no GC (Garbage Collection))
+OBJS = \
+  $(patsubst %.m,%.lo,$(OBJC_SOURCE_FILES)) \
+  $(patsubst %.c,%.lo,$(C_SOURCE_FILES))
+
+# Object files to link (when the library is linked with GC (Garbage Collection))
+OBJS_GC = \
+  $(patsubst %.m,%_gc.lo,$(OBJC_SOURCE_FILES)) \
+  $(patsubst %.c,%_gc.lo,$(C_SOURCE_FILES))
+
+
+##
+## The rules to build
+##
 
 # Flags to pass to a recursive make.
 FLAGS_TO_PASS = \
@@ -130,171 +194,89 @@ FLAGS_TO_PASS = \
        "libsubdir=$(libsubdir)" \
        "tooldir=$(tooldir)"
 
-all: libobjc.la $(OBJC_BOEHM_GC)
+# The 'all' rule must be the first one so that it is executed if
+# nothing is specified on the command-line.
+all: libobjc$(libsuffix).la $(OBJC_BOEHM_GC)
        : $(MAKE) ; exec $(MULTIDO) $(FLAGS_TO_PASS) multi-do DO=all
 
-# User-visible header files.
+.SUFFIXES:
+.SUFFIXES: .c .m .lo
 
-OBJC_H = hash.h objc-list.h sarray.h objc.h objc-api.h \
-        NXConstStr.h Object.h Protocol.h encoding.h typedstream.h \
-        thr.h
+%.lo: %.c
+       $(LIBTOOL_COMPILE) $(CC) $< -c \
+          $(ALL_CFLAGS) $(INCLUDES) \
+          -o $@
 
-# Modules that comprise the runtime library.
+%_gc.lo: %.c
+       $(LIBTOOL_COMPILE) $(CC) $< -c \
+          $(ALL_CFLAGS) $(INCLUDES) $(OBJC_GCFLAGS) \
+          -o $@
 
-OBJS =    archive.lo class.lo encoding.lo gc.lo hash.lo init.lo linking.lo \
-         misc.lo nil_method.lo NXConstStr.lo Object.lo objects.lo \
-         Protocol.lo sarray.lo selector.lo sendmsg.lo thr.lo \
-         $(OBJC_THREAD_FILE).lo
+%.lo: %.m
+       $(LIBTOOL_COMPILE) $(CC) $< -c \
+          $(ALL_CFLAGS) $(INCLUDES) -fgnu-runtime \
+          -o $@
 
-OBJS_GC = archive_gc.lo class_gc.lo encoding_gc.lo gc_gc.lo hash_gc.lo \
-         init_gc.lo linking_gc.lo misc_gc.lo nil_method_gc.lo \
-         NXConstStr_gc.lo Object_gc.lo objects_gc.lo Protocol_gc.lo \
-         sarray_gc.lo selector_gc.lo sendmsg_gc.lo thr_gc.lo \
-         $(OBJC_THREAD_FILE)_gc.lo
+%_gc.lo: %.m
+       $(LIBTOOL_COMPILE) $(CC) $< -c \
+          $(ALL_CFLAGS) $(INCLUDES) $(OBJC_GCFLAGS) -fgnu-runtime \
+          -o $@
 
+# sendmsg has a special rule because it depends on runtime-info.h.
 runtime-info.h: 
        echo "" > tmp-runtime.m
        echo "/* This file is automatically generated */" > $@
        $(CC) $(MULTIFLAGS) -print-objc-runtime-info -S tmp-runtime.m >> $@
        rm -f tmp-runtime.m tmp-runtime.s
 
-archive_gc.lo: archive.c
-       $(LIBTOOL_COMPILE) $(CC) -c  -o $@ $(ALL_CFLAGS) $(OBJC_GCFLAGS) \
-               $(INCLUDES) $<
-
-class_gc.lo: class.c
-       $(LIBTOOL_COMPILE) $(CC) -c -o $@ $(ALL_CFLAGS) $(OBJC_GCFLAGS) \
-               $(INCLUDES) $<
-
-encoding_gc.lo: encoding.c
-       $(LIBTOOL_COMPILE) $(CC) -c -o $@ $(ALL_CFLAGS) $(OBJC_GCFLAGS) \
-               $(INCLUDES) $<
-
-gc.lo: gc.c
-       $(LIBTOOL_COMPILE) $(CC) -c -o $@ $(ALL_CFLAGS) $(INCLUDES) $<
-
-gc_gc.lo: gc.c
-       $(LIBTOOL_COMPILE) $(CC) -c -o $@ $(ALL_CFLAGS) $(OBJC_GCFLAGS) \
-               $(INCLUDES) $<
-
-hash_gc.lo: hash.c
-       $(LIBTOOL_COMPILE) $(CC) -c -o $@ $(ALL_CFLAGS) $(OBJC_GCFLAGS) \
-               $(INCLUDES) $<
-
-init_gc.lo: init.c
-       $(LIBTOOL_COMPILE) $(CC) -c -o $@ $(ALL_CFLAGS) $(OBJC_GCFLAGS) \
-               $(INCLUDES) $<
-
-linking.lo: linking.m
-       $(LIBTOOL_COMPILE) $(CC) -fgnu-runtime -c -o $@ $(ALL_CFLAGS) \
-               $(INCLUDES) $<
-
-linking_gc.lo: linking.m
-       $(LIBTOOL_COMPILE) $(CC) -fgnu-runtime -c -o $@ $(ALL_CFLAGS) \
-               $(OBJC_GCFLAGS) $(INCLUDES) $<
-
-misc_gc.lo: misc.c
-       $(LIBTOOL_COMPILE) $(CC) -c $(ALL_CFLAGS) -o $@ $(OBJC_GCFLAGS) \
-               $(INCLUDES) $<
-
-nil_method_gc.lo: nil_method.c
-       $(LIBTOOL_COMPILE) $(CC) -c $(ALL_CFLAGS) -o $@ $(OBJC_GCFLAGS) \
-               $(INCLUDES) $<
-
-NXConstStr.lo: NXConstStr.m
-       $(LIBTOOL_COMPILE) $(CC) -fgnu-runtime -c -o $@ $(ALL_CFLAGS) \
-               $(INCLUDES) $<
-
-NXConstStr_gc.lo: NXConstStr.m
-       $(LIBTOOL_COMPILE) $(CC) -fgnu-runtime -c -o $@ $(ALL_CFLAGS) \
-               $(OBJC_GCFLAGS) $(INCLUDES) $<
-
-Object.lo: Object.m
-       $(LIBTOOL_COMPILE) $(CC) -fgnu-runtime -c -o $@ $(ALL_CFLAGS) \
-               $(INCLUDES) $<
-
-Object_gc.lo: Object.m
-       $(LIBTOOL_COMPILE) $(CC) -fgnu-runtime -c -o $@ $(ALL_CFLAGS) \
-               $(OBJC_GCFLAGS) $(INCLUDES) $<
-
-objects_gc.lo: objects.c
-       $(LIBTOOL_COMPILE) $(CC) -c $(ALL_CFLAGS) -o $@ $(OBJC_GCFLAGS) \
-               $(INCLUDES) $<
-
-Protocol.lo: Protocol.m
-       $(LIBTOOL_COMPILE) $(CC) -fgnu-runtime -c -o $@ $(ALL_CFLAGS) \
-               $(INCLUDES) $<
-
-Protocol_gc.lo: Protocol.m
-       $(LIBTOOL_COMPILE) $(CC) -fgnu-runtime -c -o $@ $(ALL_CFLAGS) \
-               $(OBJC_GCFLAGS) $(INCLUDES) $<
+sendmsg.lo: sendmsg.c runtime-info.h
+       $(LIBTOOL_COMPILE) $(CC) $< -c \
+          $(ALL_CFLAGS) $(INCLUDES) \
+          -o $@
 
-sarray_gc.lo: sarray.c
-       $(LIBTOOL_COMPILE) $(CC) -c -o $@ $(ALL_CFLAGS) $(OBJC_GCFLAGS) \
-               $(INCLUDES) $<
+sendmsg_gc.lo: sendmsg.c runtime-info.h
+       $(LIBTOOL_COMPILE) $(CC) $< -c \
+          $(ALL_CFLAGS) $(INCLUDES) $(OBJC_GCFLAGS) \
+          -o $@
 
-selector_gc.lo: selector.c
-       $(LIBTOOL_COMPILE) $(CC) -c -o $@ $(ALL_CFLAGS) $(OBJC_GCFLAGS) \
-               $(INCLUDES) $<
+# These files have separate rules because they require special
+# compiler flags.
 
-sendmsg.lo: sendmsg.c runtime-info.h
-       $(LIBTOOL_COMPILE) $(CC) -c -o $@ $(ALL_CFLAGS) $(INCLUDES) $<
+exception.lo: exception.c
+       $(LIBTOOL_COMPILE) $(CC) $< -c \
+          $(ALL_CFLAGS) $(INCLUDES) -fexceptions \
+          -o $@
 
-sendmsg_gc.lo: sendmsg.c runtime-info.h
-       $(LIBTOOL_COMPILE) $(CC) -c -o $@ $(ALL_CFLAGS) $(OBJC_GCFLAGS) \
-               $(INCLUDES) $<
+exception_gc.lo: exception.c
+       $(LIBTOOL_COMPILE) $(CC) $< -c \
+          $(ALL_CFLAGS) $(INCLUDES) $(OBJC_GCFLAGS) -fexceptions \
+          -o $@
 
-thr_gc.lo: thr.c
-       $(LIBTOOL_COMPILE) $(CC) -c -o $@ $(ALL_CFLAGS) $(OBJC_GCFLAGS) \
-               $(INCLUDES) $<
+doc: info dvi pdf html
 
-$(OBJC_THREAD_FILE)_gc.lo: $(OBJC_THREAD_FILE).c
-       $(LIBTOOL_COMPILE) $(CC) -c -o $@ $(ALL_CFLAGS) $(OBJC_GCFLAGS) \
-               $(INCLUDES) $<
+# No install-html or install-pdf support
+.PHONY: install-html install-pdf install-info
+install-html:
+install-pdf:
+install-info:
 
-doc: info dvi html
+LTLDFLAGS = $(shell $(SHELL) $(top_srcdir)/../libtool-ldflags $(LDFLAGS))
 
-libobjc.la: $(OBJS)
+libobjc$(libsuffix).la: $(OBJS)
        $(LIBTOOL_LINK) $(CC) -o $@ $(OBJS) \
-               -rpath $(glibcpp_toolexeclibdir) \
-               -version-info $(LIBOBJC_VERSION)
-
-libobjc_gc.la: $(OBJS_GC)
-       $(LIBTOOL_LINK) $(CC) -o $@ $(OBJS_GC) \
-               -rpath $(glibcpp_toolexeclibdir) \
-               -version-info $(LIBOBJC_GC_VERSION)
-
-#
-# FIXME -- The following part does not fit in the libtool context. 
-# Libtool is supposed to [going to] be able to create a win 32 DLL 
-# without extra code but since I don't have a win machine to test 
-# if it already works, I leave the old code here.
-#
-libobjc_s.a: libobjc.la
-       mv libobjc.a libobjc_s.a
-
-# Create a relocatable DLL
-libobjc.dll: libobjc_s.a libobjc_entry.o
-       $(CC) -mdll -Wl,--base-file -Wl,libobjc.base \
-               -o libobjc.dll libobjc_s.a libobjc_entry.o -lkernel32
-       $(DLLTOOL) --dllname libobjc.dll --def $(srcdir)/libobjc.def \
-               --base-file libobjc.base --output-exp libobjc.exp
-       $(GCC_FOR_TARGET) -mdll -Wl,--base-file libobjc.base libobjc.exp \
-               -o libobjc.dll libobjc_s.a libobjc_entry.o -lkernel32
-       $(DLLTOOL) --dllname libobjc.dll --def $(srcdir)/libobjc.def \
-               --base-file libobjc.base --output-exp libobjc.exp
-       $(GCC_FOR_TARGET) libobjc.exp -mdll \
-               -o libobjc.dll libobjc_s.a libobjc_entry.o -lkernel32
-       $(DLLTOOL) --dllname libobjc.dll --def $(srcdir)/libobjc.def \
-               --output-lib libobjc.a
-#
-#
-#
-#
-#
+               -Wc,-shared-libgcc -rpath $(toolexeclibdir) \
+               -version-info $(LIBOBJC_VERSION) $(extra_ldflags_libobjc) \
+               $(LTLDFLAGS)
+
+libobjc_gc$(libsuffix).la: $(OBJS_GC)
+       $(LIBTOOL_LINK) $(CC) -o $@ $(OBJS_GC) $(OBJC_BOEHM_GC_LIBS) \
+               -Wc,-shared-libgcc -rpath $(toolexeclibdir) \
+               -version-info $(LIBOBJC_GC_VERSION) $(extra_ldflags_libobjc) \
+               $(LTLDFLAGS)
 
 info:
 dvi:
+pdf:
 html:
 
 Makefile: Makefile.in config.status
@@ -305,36 +287,52 @@ config.status: configure
        CONFIG_SITE=no-such-file CC='$(CC)' AR='$(AR)' CFLAGS='$(CFLAGS)' \
        CPPFLAGS='$(CPPFLAGS)' $(SHELL) config.status --recheck
 
-${srcdir}/configure: configure.in
+AUTOCONF = autoconf
+ACLOCAL = aclocal
+ACLOCAL_AMFLAGS = -I ../config -I ..
+aclocal_deps = \
+       $(srcdir)/../config/multi.m4 \
+       $(srcdir)/../config/override.m4 \
+       $(srcdir)/../config/proginstall.m4 \
+       $(srcdir)/../ltoptions.m4 \
+       $(srcdir)/../ltsugar.m4 \
+       $(srcdir)/../ltversion.m4 \
+       $(srcdir)/../lt~obsolete.m4 \
+       $(srcdir)/acinclude.m4
+
+$(srcdir)/configure: @MAINT@ configure.ac $(srcdir)/aclocal.m4
        rm -f config.cache
-       cd ${srcdir} && autoconf
+       cd $(srcdir) && $(AUTOCONF)
+
+$(srcdir)/aclocal.m4: @MAINT@ $(aclocal_deps)
+       cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
 
 install: install-libs install-headers
 
 install-libs: installdirs
-       $(SHELL) $(toplevel_srcdir)/mkinstalldirs $(DESTDIR)$(glibcpp_toolexeclibdir)
-       $(LIBTOOL_INSTALL) $(INSTALL) libobjc.la $(DESTDIR)$(glibcpp_toolexeclibdir);
+       $(SHELL) $(multi_basedir)/mkinstalldirs $(DESTDIR)$(toolexeclibdir)
+       $(LIBTOOL_INSTALL) $(INSTALL) libobjc$(libsuffix).la $(DESTDIR)$(toolexeclibdir);
        if [ "$(OBJC_BOEHM_GC)" ]; then \
-         $(LIBTOOL_INSTALL) $(INSTALL) libobjc_gc.la \
-                               $(DESTDIR)$(glibcpp_toolexeclibdir);\
+         $(LIBTOOL_INSTALL) $(INSTALL) libobjc_gc$(libsuffix).la \
+                               $(DESTDIR)$(toolexeclibdir);\
        fi
        $(MULTIDO) $(FLAGS_TO_PASS) multi-do DO="$@"
-       @-$(LIBTOOL) --mode=finish $(DESTDIR)$(glibcpp_toolexeclibdir)
+       @-$(LIBTOOL) --mode=finish $(DESTDIR)$(toolexeclibdir)
 
-# Copy Objective C headers to installation include directory.
+# Copy Objective-C headers to installation include directory.
 install-headers:
-       $(SHELL) $(toplevel_srcdir)/mkinstalldirs $(DESTDIR)$(libsubdir)/include/objc
+       $(SHELL) $(multi_basedir)/mkinstalldirs $(DESTDIR)$(libsubdir)/$(includedirname)/objc
        for file in $(OBJC_H); do \
          realfile=$(srcdir)/objc/$${file}; \
-         $(INSTALL_DATA) $${realfile} $(DESTDIR)$(libsubdir)/include/objc; \
+         $(INSTALL_DATA) $${realfile} $(DESTDIR)$(libsubdir)/$(includedirname)/objc; \
        done
 
 check uninstall install-strip dist installcheck installdirs:
 
 mostlyclean:
-       -$(LIBTOOL_CLEAN) rm -f libobjc.la libobjc_gc.la *.lo
+       -$(LIBTOOL_CLEAN) rm -f libobjc$(libsuffix).la libobjc_gc$(libsuffix).la *.lo
        -rm -f runtime-info.h tmp-runtime.s *.o *.lo libobjc* xforward \
-               fflags *.aux *.cp *.dvi *.fn *.info *.ky *.log *.pg \
+               fflags *.aux *.cp *.dvi *.pdf *.fn *.info *.ky *.log *.pg \
                *.toc *.tp *.vr *.html libobj.exp
        @$(MULTICLEAN) multi-clean DO=mostlyclean
 
@@ -350,3 +348,7 @@ maintainer-clean realclean: distclean
 
 .PHONY: mostlyclean clean distclean maintainer-clean all check uninstall \
        install-strip dist installcheck installdirs 
+
+# Don't export variables to the environment, in order to not confuse
+# configure.
+.NOEXPORT: