On Darwin, use Darwin specific code to get the list of class names in a framework

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/tools/make/trunk@19552 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Nicola Pero 2004-06-19 11:55:45 +00:00
parent 9ae06b0ad8
commit 7c76002834
3 changed files with 38 additions and 17 deletions

View file

@ -1,3 +1,11 @@
Fri Jun 19 13:01:02 2004 Nicola Pero <n.pero@mi.flashnet.it>,
Yves de Champlain <yves@gnu-darwin.org>
* target.make (EXTRACT_CLASS_NAMES_COMMAND): New variable, with
special value for darwin.
* Instance/framework.make: Use the new variable when building
the list of classes in the framework.
Fri Jun 18 18:49:16 2004 Nicola Pero <n.pero@mi.flashnet.it>
* configure.ac: Detect native exception handler support in the

View file

@ -312,30 +312,18 @@ OBJC_OBJ_FILES_TO_INSPECT = $(OBJC_OBJ_FILES) $(SUBPROJECT_OBJ_FILES)
# FRAMEWORK_INSTALL_DIR from the command line, not currently covered
# at the moment!
#
# To get the list of all classes, we run 'nm' on the object files, and
# retrieve all symbols of the form __objc_class_name_NSObject which
# are not 'U' (undefined) ... an __objc_class_name_NSObject is defined
# in the module implementing the class, and referenced by all other
# modules needing to use the class. So if we have an
# __objc_class_name_XXX which is not 'U' (which would be a reference
# to a class implemented elsewhere), it must be a class implemented in
# this module.
# To get the list of all classes, we use
# $(EXTRACT_CLASS_NAMES_COMMAND), which is defined in target.make
#
# The 'sed' command parses a set of lines, and extracts lines starting
# with __objc_class_name_XXXX Y, where XXXX is a string of characters
# from A-Za-z_. and Y is not 'U'. It then replaces the whole line
# with XXXX, and prints the result. '-n' disables automatic printing
# for portability, so we are sure we only print what we want on all
# platforms.
#
# The following rule will also build the DUMMY_FRAMEWORK_CLASS_LIST
# file. This file is always created/deleted at the same time as the
# DUMMY_FRAMEWORK_FILE.
$(DUMMY_FRAMEWORK_FILE): $(DERIVED_SOURCES_DIR) $(OBJ_FILES_TO_LINK) GNUmakefile
$(ECHO_CREATING) classes=""; \
for f in $(OBJC_OBJ_FILES_TO_INSPECT) __dummy__; do \
if [ "$$f" != "__dummy__" ]; then \
sym=`nm -Pg $$f | sed -n -e '/^__objc_class_name_[A-Za-z_.]* [^U]/ {s/^__objc_class_name_\([A-Za-z_.]*\) [^U].*/\1/p;}'`; \
for object_file in $(OBJC_OBJ_FILES_TO_INSPECT) __dummy__; do \
if [ "$$object_file" != "__dummy__" ]; then \
sym=`$(EXTRACT_CLASS_NAMES_COMMAND)`; \
classes="$$classes $$sym"; \
fi; \
done; \

View file

@ -113,6 +113,28 @@ endif
# AFTER_INSTALL_STATIC_LIB_CMD is similar.
#
# For frameworks on unusual platforms, you might also need to set
# EXTRACT_CLASS_NAMES_COMMAND. This should be a command which is
# evaluated on $(object_file) and returns a list of classes
# implemented in the object_file. Our default command is the
# following (you can override it with another one in your target's
# section if you need), which runs 'nm' on the object file, and
# retrieve all symbols of the form __objc_class_name_NSObject which
# are not 'U' (undefined) ... an __objc_class_name_NSObject is defined
# in the module implementing the class, and referenced by all other
# modules needing to use the class. So if we have an
# __objc_class_name_XXX which is not 'U' (which would be a reference
# to a class implemented elsewhere), it must be a class implemented in
# this module.
#
# The 'sed' command parses a set of lines, and extracts lines starting
# with __objc_class_name_XXXX Y, where XXXX is a string of characters
# from A-Za-z_. and Y is not 'U'. It then replaces the whole line
# with XXXX, and prints the result. '-n' disables automatic printing
# for portability, so we are sure we only print what we want on all
# platforms.
EXTRACT_CLASS_NAMES_COMMAND = nm -Pg $$object_file | sed -n -e '/^__objc_class_name_[A-Za-z_.]* [^U]/ {s/^__objc_class_name_\([A-Za-z_.]*\) [^U].*/\1/p;}'
#
# This is the generic version - if the target is not in the following list,
# this setup will be used. It the target does not override variables here
@ -237,6 +259,9 @@ endif
HAVE_SHARED_LIBS = yes
SHARED_LIBEXT = .dylib
# The output of nm is slightly different on Darwin, it doesn't support -P
EXTRACT_CLASS_NAMES_COMMAND = nm -g $$object_file | sed -n -e '/[^U] ___objc_class_name_/ {s/[0-9a-f]* [^U] ___objc_class_name_//p;}'
ifeq ($(CC_TYPE), apple)
# Not sure why, but without -no-cpp-precomp, it doesn't compile
# plain C files.