summaryrefslogtreecommitdiff
path: root/libobjc
diff options
context:
space:
mode:
authornicola <nicola@138bc75d-0d04-0410-961f-82ee72b054a4>2010-09-12 14:55:21 +0000
committernicola <nicola@138bc75d-0d04-0410-961f-82ee72b054a4>2010-09-12 14:55:21 +0000
commitdb7e33267fda5add42f0a51d27027732313bd97c (patch)
tree3eea0fc31fc22bc008c32ffdfb470e34e07e329e /libobjc
parent83c813acdbc5efa020220bd0eb01ac374155370f (diff)
downloadgcc-db7e33267fda5add42f0a51d27027732313bd97c.tar.gz
In libobjc/:
* Makefile.in (%_gc.lo): New pattern rules to build the garbage-collected version of the library. Removed rules for specific files that are no longer needed. Standardized all rules. (C_SOURCE_FILES, OBJC_SOURCE_FILES): New variables. (OBJS, OBJS_GC): Compute these from C_SOURCE_FILES and OBJC_SOURCE_FILES. (INCLUDES): Removed the unused include -I$(srcdir)/objc. * memory.c (objc_calloc): Fixed call to GC_malloc when building with Garbage Colletion. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@164231 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libobjc')
-rw-r--r--libobjc/ChangeLog15
-rw-r--r--libobjc/Makefile.in297
-rw-r--r--libobjc/memory.c2
3 files changed, 140 insertions, 174 deletions
diff --git a/libobjc/ChangeLog b/libobjc/ChangeLog
index c08d235ec5d..39bcd1626cf 100644
--- a/libobjc/ChangeLog
+++ b/libobjc/ChangeLog
@@ -1,5 +1,20 @@
2010-09-12 Nicola Pero <nicola.pero@meta-innovation.com>
+ * Makefile.in (%_gc.lo): New pattern rules to build the
+ garbage-collected version of the library. Removed rules for
+ specific files that are no longer needed. Standardized all rules.
+ (C_SOURCE_FILES, OBJC_SOURCE_FILES): New variables.
+ (OBJS, OBJS_GC): Compute these from C_SOURCE_FILES and
+ OBJC_SOURCE_FILES.
+ (INCLUDES): Removed the unused include -I$(srcdir)/objc.
+
+2010-09-12 Nicola Pero <nicola.pero@meta-innovation.com>
+
+ * memory.c (objc_calloc): Fixed call to GC_malloc when building
+ with Garbage Colletion.
+
+2010-09-12 Nicola Pero <nicola.pero@meta-innovation.com>
+
* memory.c: Do not include objc-private/runtime.h.
2010-09-12 Nicola Pero <nicola.pero@meta-innovation.com>
diff --git a/libobjc/Makefile.in b/libobjc/Makefile.in
index f4a6de19f9a..e5116a96780 100644
--- a/libobjc/Makefile.in
+++ b/libobjc/Makefile.in
@@ -97,52 +97,17 @@ OBJC_BOEHM_GC=@OBJC_BOEHM_GC@
OBJC_BOEHM_GC_INCLUDES=@OBJC_BOEHM_GC_INCLUDES@
OBJC_BOEHM_GC_LIBS=../boehm-gc/libgcjgc_convenience.la $(thread_libs_and_flags)
-INCLUDES = -I$(srcdir)/objc -I$(srcdir)/$(MULTISRCTOP)../gcc \
+INCLUDES = -I$(srcdir)/$(MULTISRCTOP)../gcc \
-I$(srcdir)/$(MULTISRCTOP)../gcc/config \
-I$(MULTIBUILDTOP)../../$(host_subdir)/gcc \
-I$(srcdir)/$(MULTISRCTOP)../include \
$(OBJC_BOEHM_GC_INCLUDES)
-
-.SUFFIXES:
-.SUFFIXES: .c .m .lo
-
-.c.lo:
- $(LIBTOOL_COMPILE) $(CC) -c $(ALL_CFLAGS) $(INCLUDES) $<
-
-.m.lo:
- $(LIBTOOL_COMPILE) $(CC) -c $(ALL_CFLAGS) $(INCLUDES) $<
-
-# Flags to pass to a recursive make.
-FLAGS_TO_PASS = \
- "AR=$(AR)" \
- "AR_FLAGS=$(AR_FLAGS)" \
- "CC=$(CC)" \
- "CFLAGS=$(CFLAGS)" \
- "DESTDIR=$(DESTDIR)" \
- "LIBCFLAGS=$(LIBCFLAGS)" \
- "EXTRA_OFILES=$(EXTRA_OFILES)" \
- "HDEFINES=$(HDEFINES)" \
- "INSTALL=$(INSTALL)" \
- "INSTALL_DATA=$(INSTALL_DATA)" \
- "INSTALL_PROGRAM=$(INSTALL_PROGRAM)" \
- "LDFLAGS=$(LDFLAGS)" \
- "LIBTOOL=$(LIBTOOL)" \
- "LOADLIBES=$(LOADLIBES)" \
- "PICFLAG=$(PICFLAG)" \
- "RANLIB=$(RANLIB)" \
- "SHELL=$(SHELL)" \
- "prefix=$(prefix)" \
- "exec_prefix=$(exec_prefix)" \
- "libdir=$(libdir)" \
- "libsubdir=$(libsubdir)" \
- "tooldir=$(tooldir)"
-
-all: libobjc$(libsuffix).la $(OBJC_BOEHM_GC)
- : $(MAKE) ; exec $(MULTIDO) $(FLAGS_TO_PASS) multi-do DO=all
+##
+## The list of header/source files
+##
# User-visible header files, from the objc/ directory
-
OBJC_H = \
objc.h \
objc-exception.h \
@@ -158,11 +123,11 @@ OBJC_H = \
objc-list.h \
sarray.h \
thr.h \
+ \
typedstream.h
# User-visible header files containing deprecated APIs, from the
# objc/deprecated directory
-
OBJC_DEPRECATED_H = \
MetaClass.h \
Object.h \
@@ -176,165 +141,151 @@ OBJC_DEPRECATED_H = \
struct_objc_selector.h \
typedstream.h
-# Modules that comprise the runtime library.
-
-OBJS = \
- NXConstStr.lo \
- Object.lo \
- Protocol.lo \
- archive.lo \
- class.lo \
- encoding.lo \
- error.lo \
- gc.lo \
- hash.lo \
- init.lo \
- linking.lo \
- memory.lo \
- nil_method.lo \
- objects.lo \
- sarray.lo \
- selector.lo \
- sendmsg.lo \
- thr.lo \
- exception.lo
-
+# Objective-C source files to compile
+OBJC_SOURCE_FILES = \
+ NXConstStr.m \
+ Object.m \
+ Protocol.m \
+ linking.m
+
+# C source files to compile
+C_SOURCE_FILES = \
+ archive.c \
+ class.c \
+ encoding.c \
+ error.c \
+ gc.c \
+ hash.c \
+ init.c \
+ memory.c \
+ nil_method.c \
+ objects.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 = \
- NXConstStr_gc.lo \
- Object_gc.lo \
- Protocol_gc.lo \
- archive_gc.lo \
- class_gc.lo \
- encoding_gc.lo \
- error_gc.lo \
- gc_gc.lo \
- hash_gc.lo \
- init_gc.lo \
- linking_gc.lo \
- memory_gc.lo \
- nil_method_gc.lo \
- objects_gc.lo \
- sarray_gc.lo \
- selector_gc.lo \
- sendmsg_gc.lo \
- thr_gc.lo \
- exception_gc.lo
+ $(patsubst %.m,%_gc.lo,$(OBJC_SOURCE_FILES)) \
+ $(patsubst %.c,%_gc.lo,$(C_SOURCE_FILES))
-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) -Wno-deprecated-declarations -c -o $@ $(ALL_CFLAGS) \
- $(OBJC_GCFLAGS) $(INCLUDES) $<
-
-archive.lo: archive.c
- $(LIBTOOL_COMPILE) $(CC) -Wno-deprecated-declarations -c $(ALL_CFLAGS) \
- $(INCLUDES) $<
+##
+## The rules to build
+##
-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) $<
+# Flags to pass to a recursive make.
+FLAGS_TO_PASS = \
+ "AR=$(AR)" \
+ "AR_FLAGS=$(AR_FLAGS)" \
+ "CC=$(CC)" \
+ "CFLAGS=$(CFLAGS)" \
+ "DESTDIR=$(DESTDIR)" \
+ "LIBCFLAGS=$(LIBCFLAGS)" \
+ "EXTRA_OFILES=$(EXTRA_OFILES)" \
+ "HDEFINES=$(HDEFINES)" \
+ "INSTALL=$(INSTALL)" \
+ "INSTALL_DATA=$(INSTALL_DATA)" \
+ "INSTALL_PROGRAM=$(INSTALL_PROGRAM)" \
+ "LDFLAGS=$(LDFLAGS)" \
+ "LIBTOOL=$(LIBTOOL)" \
+ "LOADLIBES=$(LOADLIBES)" \
+ "PICFLAG=$(PICFLAG)" \
+ "RANLIB=$(RANLIB)" \
+ "SHELL=$(SHELL)" \
+ "prefix=$(prefix)" \
+ "exec_prefix=$(exec_prefix)" \
+ "libdir=$(libdir)" \
+ "libsubdir=$(libsubdir)" \
+ "tooldir=$(tooldir)"
-error_gc.lo: error.c
- $(LIBTOOL_COMPILE) $(CC) -c $(ALL_CFLAGS) -o $@ $(OBJC_GCFLAGS) \
- $(INCLUDES) $<
+# 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
-gc.lo: gc.c
- $(LIBTOOL_COMPILE) $(CC) -c -o $@ $(ALL_CFLAGS) $(INCLUDES) $<
+.SUFFIXES:
+.SUFFIXES: .c .m .lo
-gc_gc.lo: gc.c
- $(LIBTOOL_COMPILE) $(CC) -c -o $@ $(ALL_CFLAGS) $(OBJC_GCFLAGS) \
- $(INCLUDES) $<
+%.lo: %.c
+ $(LIBTOOL_COMPILE) $(CC) $< -c \
+ $(ALL_CFLAGS) $(INCLUDES) \
+ -o $@
-hash_gc.lo: hash.c
- $(LIBTOOL_COMPILE) $(CC) -c -o $@ $(ALL_CFLAGS) $(OBJC_GCFLAGS) \
- $(INCLUDES) $<
+%_gc.lo: %.c
+ $(LIBTOOL_COMPILE) $(CC) $< -c \
+ $(ALL_CFLAGS) $(INCLUDES) $(OBJC_GCFLAGS) \
+ -o $@
-init_gc.lo: init.c
- $(LIBTOOL_COMPILE) $(CC) -c -o $@ $(ALL_CFLAGS) $(OBJC_GCFLAGS) \
- $(INCLUDES) $<
+%.lo: %.m
+ $(LIBTOOL_COMPILE) $(CC) $< -c \
+ $(ALL_CFLAGS) $(INCLUDES) -fgnu-runtime \
+ -o $@
-linking.lo: linking.m
- $(LIBTOOL_COMPILE) $(CC) -fgnu-runtime -c -o $@ $(ALL_CFLAGS) \
- $(INCLUDES) $<
+%_gc.lo: %.m
+ $(LIBTOOL_COMPILE) $(CC) $< -c \
+ $(ALL_CFLAGS) $(INCLUDES) $(OBJC_GCFLAGS) -fgnu-runtime \
+ -o $@
-linking_gc.lo: linking.m
- $(LIBTOOL_COMPILE) $(CC) -fgnu-runtime -c -o $@ $(ALL_CFLAGS) \
- $(OBJC_GCFLAGS) $(INCLUDES) $<
+# 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
-memory_gc.lo: memory.c
- $(LIBTOOL_COMPILE) $(CC) -c $(ALL_CFLAGS) -o $@ $(OBJC_GCFLAGS) \
- $(INCLUDES) $<
+sendmsg.lo: sendmsg.c runtime-info.h
+ $(LIBTOOL_COMPILE) $(CC) $< -c \
+ $(ALL_CFLAGS) $(INCLUDES) \
+ -o $@
-nil_method_gc.lo: nil_method.c
- $(LIBTOOL_COMPILE) $(CC) -c $(ALL_CFLAGS) -o $@ $(OBJC_GCFLAGS) \
- $(INCLUDES) $<
+sendmsg_gc.lo: sendmsg.c runtime-info.h
+ $(LIBTOOL_COMPILE) $(CC) $< -c \
+ $(ALL_CFLAGS) $(INCLUDES) $(OBJC_GCFLAGS) \
+ -o $@
-NXConstStr.lo: NXConstStr.m
- $(LIBTOOL_COMPILE) $(CC) -fgnu-runtime -c -o $@ $(ALL_CFLAGS) \
- $(INCLUDES) $<
+# These files have separate rules because they require special
+# compiler flags.
+archive.lo: archive.c
+ $(LIBTOOL_COMPILE) $(CC) $< -c \
+ $(ALL_CFLAGS) $(INCLUDES) -Wno-deprecated-declarations \
+ -o $@
-NXConstStr_gc.lo: NXConstStr.m
- $(LIBTOOL_COMPILE) $(CC) -fgnu-runtime -c -o $@ $(ALL_CFLAGS) \
- $(OBJC_GCFLAGS) $(INCLUDES) $<
+archive_gc.lo: archive.c
+ $(LIBTOOL_COMPILE) $(CC) $< -c \
+ $(ALL_CFLAGS) $(INCLUDES) $(OBJC_GCFLAGS) -Wno-deprecated-declarations \
+ -o $@
# -Wno-deprecated-declarations is for the objc/typedstream.h functions.
Object.lo: Object.m
- $(LIBTOOL_COMPILE) $(CC) -fgnu-runtime -Wno-deprecated-declarations \
- -c -o $@ $(ALL_CFLAGS) $(INCLUDES) $<
+ $(LIBTOOL_COMPILE) $(CC) $< -c \
+ $(ALL_CFLAGS) $(INCLUDES) -fgnu-runtime -Wno-deprecated-declarations \
+ -o $@
# -Wno-deprecated-declarations is for the objc/typedstream.h functions.
Object_gc.lo: Object.m
- $(LIBTOOL_COMPILE) $(CC) -fgnu-runtime -Wno-deprecated-declarations \
- -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) $<
-
-sarray_gc.lo: sarray.c
- $(LIBTOOL_COMPILE) $(CC) -c -o $@ $(ALL_CFLAGS) $(OBJC_GCFLAGS) \
- $(INCLUDES) $<
-
-selector_gc.lo: selector.c
- $(LIBTOOL_COMPILE) $(CC) -c -o $@ $(ALL_CFLAGS) $(OBJC_GCFLAGS) \
- $(INCLUDES) $<
-
-sendmsg.lo: sendmsg.c runtime-info.h
- $(LIBTOOL_COMPILE) $(CC) -c -o $@ $(ALL_CFLAGS) $(INCLUDES) $<
-
-sendmsg_gc.lo: sendmsg.c runtime-info.h
- $(LIBTOOL_COMPILE) $(CC) -c -o $@ $(ALL_CFLAGS) $(OBJC_GCFLAGS) \
- $(INCLUDES) $<
-
-thr_gc.lo: thr.c
- $(LIBTOOL_COMPILE) $(CC) -c -o $@ $(ALL_CFLAGS) $(OBJC_GCFLAGS) \
- $(INCLUDES) $<
+ $(LIBTOOL_COMPILE) $(CC) $< -c \
+ $(ALL_CFLAGS) $(INCLUDES) $(OBJC_GCFLAGS) -fgnu-runtime -Wno-deprecated-declarations \
+ -o $@
# -Wno-deprecated-declarations is to silence warnings from using
# _objc_unexpected_exception.
exception.lo: exception.c
- $(LIBTOOL_COMPILE) $(CC) -c -o $@ $(ALL_CFLAGS) \
- -fexceptions -Wno-deprecated-declarations $(INCLUDES) $<
+ $(LIBTOOL_COMPILE) $(CC) $< -c \
+ $(ALL_CFLAGS) $(INCLUDES) -fexceptions -Wno-deprecated-declarations \
+ -o $@
exception_gc.lo: exception.c
- $(LIBTOOL_COMPILE) $(CC) -c -o $@ $(ALL_CFLAGS) $(OBJC_GCFLAGS) \
- -fexceptions -Wno-deprecated-declarations $(INCLUDES) $<
+ $(LIBTOOL_COMPILE) $(CC) $< -c \
+ $(ALL_CFLAGS) $(INCLUDES) $(OBJC_GCFLAGS) -fexceptions -Wno-deprecated-declarations \
+ -o $@
doc: info dvi pdf html
@@ -403,7 +354,7 @@ install-libs: installdirs
$(MULTIDO) $(FLAGS_TO_PASS) multi-do DO="$@"
@-$(LIBTOOL) --mode=finish $(DESTDIR)$(toolexeclibdir)
-# Copy Objective C headers to installation include directory.
+# Copy Objective-C headers to installation include directory.
install-headers:
$(SHELL) $(multi_basedir)/mkinstalldirs $(DESTDIR)$(libsubdir)/$(includedirname)/objc
for file in $(OBJC_H); do \
diff --git a/libobjc/memory.c b/libobjc/memory.c
index 2ebd429293d..19a450ad860 100644
--- a/libobjc/memory.c
+++ b/libobjc/memory.c
@@ -78,7 +78,7 @@ objc_calloc (size_t nelem, size_t size)
{
/* Note that GC_malloc returns cleared memory (see documentation) so
there is no need to clear it. */
- void *res = (void *)(GC_malloc (nelem, size));
+ void *res = (void *)(GC_malloc (nelem * size));
if (! res)
_objc_abort ("Virtual memory exhausted\n");
return res;