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 \
+ objc-sync.h \
+ \
+ NXConstStr.h \
+ Object.h \
+ Protocol.h \
+ encoding.h \
+ message.h \
+ objc-api.h \
+ objc-decls.h \
+ thr.h \
+ \
+ hash.h \
+ objc-list.h \
+ sarray.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 \
+ hash.h \
+ objc-list.h \
+ objc_error.h \
+ objc_malloc.h \
+ objc_unexpected_exception.h \
+ objc_valloc.h \
+ sarray.h \
+ struct_objc_class.h \
+ struct_objc_protocol.h \
+ struct_objc_selector.h \
+ typedstream.h
+
+# 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 \
+ objc-sync.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))
-.m.lo:
- $(LIBTOOL_COMPILE) $(CC) -c $(ALL_CFLAGS) $(INCLUDES) $<
+
+##
+## The rules to build
+##
# Flags to pass to a recursive make.
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
-
-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
+.SUFFIXES:
+.SUFFIXES: .c .m .lo
-# User-visible header files containing deprecated APIs, from the
-# objc/deprecated directory
+%.lo: %.c
+ $(LIBTOOL_COMPILE) $(CC) $< -c \
+ $(ALL_CFLAGS) $(INCLUDES) \
+ -o $@
-OBJC_DEPRECATED_H = \
- MetaClass.h \
- Object.h \
- STR.h \
- objc_error.h \
- objc_unexpected_exception.h \
- struct_objc_class.h \
- struct_objc_protocol.h \
- struct_objc_selector.h \
- typedstream.h
+%_gc.lo: %.c
+ $(LIBTOOL_COMPILE) $(CC) $< -c \
+ $(ALL_CFLAGS) $(INCLUDES) $(OBJC_GCFLAGS) \
+ -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
+%.lo: %.m
+ $(LIBTOOL_COMPILE) $(CC) $< -c \
+ $(ALL_CFLAGS) $(INCLUDES) -fgnu-runtime \
+ -o $@
-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) $<
-
-archive.lo: archive.c
- $(LIBTOOL_COMPILE) $(CC) -Wno-deprecated-declarations -c $(ALL_CFLAGS) \
- $(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) $<
-
-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) $<
+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
$(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 \