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.

From-SVN: r164231
This commit is contained in:
Nicola Pero 2010-09-12 14:55:21 +00:00 committed by Nicola Pero
parent 075abad5ee
commit 7e26828068
3 changed files with 143 additions and 177 deletions

View File

@ -1,3 +1,18 @@
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.

View File

@ -97,21 +97,89 @@ 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)
##
## The list of header/source files
##
.SUFFIXES:
.SUFFIXES: .c .m .lo
# User-visible header files, from the objc/ directory
OBJC_H = \
objc.h \
objc-exception.h \
\
NXConstStr.h \
Object.h \
Protocol.h \
encoding.h \
hash.h \
message.h \
objc-api.h \
objc-decls.h \
objc-list.h \
sarray.h \
thr.h \
\
typedstream.h
.c.lo:
$(LIBTOOL_COMPILE) $(CC) -c $(ALL_CFLAGS) $(INCLUDES) $<
# User-visible header files containing deprecated APIs, from the
# objc/deprecated directory
OBJC_DEPRECATED_H = \
MetaClass.h \
Object.h \
STR.h \
objc_error.h \
objc_malloc.h \
objc_unexpected_exception.h \
objc_valloc.h \
struct_objc_class.h \
struct_objc_protocol.h \
struct_objc_selector.h \
typedstream.h
.m.lo:
$(LIBTOOL_COMPILE) $(CC) -c $(ALL_CFLAGS) $(INCLUDES) $<
# 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 = \
$(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 = \
@ -138,203 +206,86 @@ FLAGS_TO_PASS = \
"libsubdir=$(libsubdir)" \
"tooldir=$(tooldir)"
# 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, from the objc/ directory
.SUFFIXES:
.SUFFIXES: .c .m .lo
OBJC_H = \
objc.h \
objc-exception.h \
\
NXConstStr.h \
Object.h \
Protocol.h \
encoding.h \
hash.h \
message.h \
objc-api.h \
objc-decls.h \
objc-list.h \
sarray.h \
thr.h \
typedstream.h
%.lo: %.c
$(LIBTOOL_COMPILE) $(CC) $< -c \
$(ALL_CFLAGS) $(INCLUDES) \
-o $@
# User-visible header files containing deprecated APIs, from the
# objc/deprecated directory
%_gc.lo: %.c
$(LIBTOOL_COMPILE) $(CC) $< -c \
$(ALL_CFLAGS) $(INCLUDES) $(OBJC_GCFLAGS) \
-o $@
OBJC_DEPRECATED_H = \
MetaClass.h \
Object.h \
STR.h \
objc_error.h \
objc_malloc.h \
objc_unexpected_exception.h \
objc_valloc.h \
struct_objc_class.h \
struct_objc_protocol.h \
struct_objc_selector.h \
typedstream.h
%.lo: %.m
$(LIBTOOL_COMPILE) $(CC) $< -c \
$(ALL_CFLAGS) $(INCLUDES) -fgnu-runtime \
-o $@
# 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
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
%_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) -Wno-deprecated-declarations -c -o $@ $(ALL_CFLAGS) \
$(OBJC_GCFLAGS) $(INCLUDES) $<
sendmsg.lo: sendmsg.c runtime-info.h
$(LIBTOOL_COMPILE) $(CC) $< -c \
$(ALL_CFLAGS) $(INCLUDES) \
-o $@
sendmsg_gc.lo: sendmsg.c runtime-info.h
$(LIBTOOL_COMPILE) $(CC) $< -c \
$(ALL_CFLAGS) $(INCLUDES) $(OBJC_GCFLAGS) \
-o $@
# These files have separate rules because they require special
# compiler flags.
archive.lo: archive.c
$(LIBTOOL_COMPILE) $(CC) -Wno-deprecated-declarations -c $(ALL_CFLAGS) \
$(INCLUDES) $<
$(LIBTOOL_COMPILE) $(CC) $< -c \
$(ALL_CFLAGS) $(INCLUDES) -Wno-deprecated-declarations \
-o $@
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) $<
error_gc.lo: error.c
$(LIBTOOL_COMPILE) $(CC) -c $(ALL_CFLAGS) -o $@ $(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) $<
memory_gc.lo: memory.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) $<
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 \

View File

@ -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;