Support for building OS 4.x applications.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/tools/make/trunk@2506 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
ovidiu 1997-10-14 22:54:35 +00:00
parent 24c02e15a6
commit d120d8af56
9 changed files with 221 additions and 111 deletions

View file

@ -1,3 +1,23 @@
Tue Oct 14 15:28:52 1997 Ovidiu Predescu <ovidiu@net-community.com>
* DESIGN: Wrote about the naming conventions for libraries and how they
are chosen by the package.
* Makefile.preamble: Use += instead of =.
* application.make (stamp-app-% rule): Added before-link target to
support building of OPENSTEP 4.x applications.
(internal-distclean): New target.
* common.make: Changed the order in which target.make gets included.
More support for building a native OPENSTEP 4.x application added.
* core.make: Write the correct linking flags for building an
application under OPENSTEP 4.x. Create the .iconheader file
automatically.
* openapp.in: Check to see if the application really exists before
checking for the binary. Correctly check for the binary under OS 4.x.
* target.make: On OS 4.x systems with NeXT's Foundation, use the native
compiler. If we don't use the native compiler don't pass the GNU ObjC
runtime library and libgcc to libtool.
* which_lib.c: Correctly skip the libraries with the same suffix.
Tue Oct 14 11:26:15 1997 Ovidiu Predescu <ovidiu@net-community.com>
* openapp.in: Add the possibility of passing arguments to the

58
DESIGN
View file

@ -365,6 +365,62 @@ profile is turned on the output directory would be shared_profile_debug_obj.
Of course you also have to specify the library combo if it's different than the
default.
Naming conventions of the libraries
===================================
Sometimes you need to have different versions of a library compiled with
different options. Suppose you want to compile a library with profiling
information enabled so that you can profile your code. But you don't want to
overwrite your existing installed library so that only some of the applications
will work with the profile library, the rest will still use the normal library.
The makefile package supports such a schema by having different names for
different types of the same library. This works by appending an underscore
after the name of the library followed by a letter which indicates the type of
the library:
's' for a static library
'p' for a profile library
'd' for a debug library
So for example if you have the library 'example' compiled with debug
information as a shared library it would be named libexample_d.so. If the same
library is compiled as a static library its name would be named
libexample_sd.a. The reason why the 's' letter for the static library appears
in name of the library is for systems where the extensions of libraries don't
matter.
It is possible to compile a library with whatever combination of flags you
want. The letters are appended in the order specified above, so if you compile
the library as a static library, with profile and debug information enabled,
the library name will have the _spd suffix appended.
How a library is chosen
=======================
What happens if you compile an application with profile enabled and you don't
have a library compiled with profile info into it, but you do have a normal
library installed? It would be great if the normal library is chosen instead.
This is a problem because the library that should be chosen has a different
name than the profile library.
We do support this schema by requiring the libraries to be specified using the
short name, without any suffix appended to it. The `example' library in our
case should be passed to the linker using -lexample, and not using -lexample_p.
Based upon the shared, profile and debug variables, the makefile package will
identify which are the libraries that exist on the system and it will come with
the correct names when linking.
The search order of libraries depending on what type of library is required is
as follows. First of all an exact match is searched; if one is found it is
returned. If either debug or profile are required, a library that matches at
least one of these attributes is returned. For example if there is a
profile+debug version of a library but only debug is required this library will
match. If a static version is required but no static versions of the library
exist, then no library is chosen; in this case the system simply prints out the
name of the library, assuming a static library is somewhere else in the
libraries search path of the linker.
The structure of makefiles
==========================
@ -410,4 +466,4 @@ The makefile package is installed under $(GNUSTEP_SYSTEM_ROOT)/Makefiles.
Ovidiu Predescu
Last updated: September, 1997
Last updated: October, 1997

View file

@ -12,32 +12,32 @@
#
# Additional flags to pass to the preprocessor
ADDITIONAL_CPPFLAGS =
ADDITIONAL_CPPFLAGS +=
# Additional flags to pass to the Objective-C compiler
ADDITIONAL_OBJCFLAGS =
ADDITIONAL_OBJCFLAGS +=
# Additional flags to pass to the C compiler
ADDITIONAL_CFLAGS =
ADDITIONAL_CFLAGS +=
# Additional include directories the compiler should search
ADDITIONAL_INCLUDE_DIRS =
ADDITIONAL_INCLUDE_DIRS +=
# Additional LDFLAGS to pass to the linker
ADDITIONAL_LDFLAGS =
# ADDITIONAL_LDFLAGS +=
# Additional library directories the linker should search
ADDITIONAL_LIB_DIRS =
ADDITIONAL_LIB_DIRS +=
# Additional libraries when linking tools
ADDITIONAL_TOOL_LIBS =
ADDITIONAL_TOOL_LIBS +=
# Additional libraries when linking applications
ADDITIONAL_GUI_LIBS =
ADDITIONAL_GUI_LIBS +=
#
# Flags dealing with installing and uninstalling
#
# Additional directories to be created during installation
ADDITIONAL_INSTALL_DIRS =
ADDITIONAL_INSTALL_DIRS +=

View file

@ -29,7 +29,15 @@ include $(GNUSTEP_SYSTEM_ROOT)/Makefiles/rules.make
#
APP_DIR_NAME := $(APP_NAME:=.app)
APP_FILE = $(APP_DIR_NAME)/$(GNUSTEP_TARGET_DIR)/$(LIBRARY_COMBO)/$(APP_NAME)$(EXEEXT)
# Support building NeXT applications
ifneq ($(OBJC_COMPILER), NeXT)
APP_FILE = \
$(APP_DIR_NAME)/$(GNUSTEP_TARGET_DIR)/$(LIBRARY_COMBO)/$(APP_NAME)$(EXEEXT)
else
APP_FILE = $(APP_DIR_NAME)/$(APP_NAME)$(EXEEXT)
endif
APP_STAMPS := $(foreach app,$(APP_NAME),stamp-app-$(app))
APP_STAMPS := $(addprefix $(GNUSTEP_OBJ_DIR)/,$(APP_STAMPS))
@ -37,11 +45,16 @@ APP_STAMPS := $(addprefix $(GNUSTEP_OBJ_DIR)/,$(APP_STAMPS))
# Internal targets
#
$(GNUSTEP_OBJ_DIR)/stamp-app-% : $(C_OBJ_FILES) $(OBJC_OBJ_FILES)
$(GNUSTEP_OBJ_DIR)/stamp-app-% :: before-link $(C_OBJ_FILES) $(OBJC_OBJ_FILES)
$(LD) $(ALL_LDFLAGS) $(LDOUT)$(APP_FILE) \
$(C_OBJ_FILES) $(OBJC_OBJ_FILES) \
$(ALL_LIB_DIRS) $(ALL_GUI_LIBS)
touch $@
# This is a hack for OPENSTEP systems to remove the iconheader file
# automatically generated by the makefile package.
rm -f $(APP_NAME).iconheader
before-link::
#
# Compilation targets
@ -67,3 +80,12 @@ internal-clean::
rm -rf $$f ; \
done
rm -rf $(GNUSTEP_OBJ_PREFIX)
internal-distclean::
for f in $(APP_DIR_NAME); do \
rm -rf $$f ; \
done
rm -rf shared_obj static_obj shared_debug_obj shared_profile_obj \
static_debug_obj static_profile_obj shared_profile_debug_obj \
static_profile_debug_obj

View file

@ -46,14 +46,6 @@ INSTALL = $(GNUSTEP_SYSTEM_ROOT)/Makefiles/install-sh -c
INSTALL_DATA = $(INSTALL) -m 644
INSTALL_PROGRAM = $(INSTALL)
#
# Determine the compilation host and target
#
include $(GNUSTEP_SYSTEM_ROOT)/Makefiles/target.make
GNUSTEP_HOST_DIR = $(GNUSTEP_HOST_CPU)/$(GNUSTEP_HOST_OS)
GNUSTEP_TARGET_DIR = $(GNUSTEP_TARGET_CPU)/$(GNUSTEP_TARGET_OS)
#
# Get the config information
#
@ -64,6 +56,14 @@ include $(GNUSTEP_SYSTEM_ROOT)/Makefiles/$(GNUSTEP_TARGET_DIR)/config.make
#
include $(GNUSTEP_SYSTEM_ROOT)/Makefiles/core.make
#
# Determine the compilation host and target
#
include $(GNUSTEP_SYSTEM_ROOT)/Makefiles/target.make
GNUSTEP_HOST_DIR = $(GNUSTEP_HOST_CPU)/$(GNUSTEP_HOST_OS)
GNUSTEP_TARGET_DIR = $(GNUSTEP_TARGET_CPU)/$(GNUSTEP_TARGET_OS)
#
# Variables specifying the installation directory paths
#
@ -113,10 +113,9 @@ GNUSTEP_HEADERS_FND_FLAG = -I$(GNUSTEP_HEADERS_FND) \
endif
ifeq ($(FOUNDATION_LIB),nx)
GNUSTEP_FND_DIR = next
GNUSTEP_HEADERS_FND = $(GNUSTEP_HEADERS)/$(GNUSTEP_FND_DIR)
GNUSTEP_HEADERS_FND =
#GNUSTEP_HEADERS_FND_FLAG = -framework Foundation
FOUNDATION_LIBRARY_DEFINE = -DNeXT_Foundation_LIBRARY=1
GNUSTEP_HEADERS_FND_FLAG = -I$(GNUSTEP_HEADERS_FND)
endif
ifeq ($(FOUNDATION_LIB),sun)
@ -126,13 +125,6 @@ FOUNDATION_LIBRARY_DEFINE = -DSun_Foundation_LIBRARY=1
GNUSTEP_HEADERS_FND_FLAG = -I$(GNUSTEP_HEADERS_FND)
endif
ifeq ($(OBJC_COMPILER), NeXT)
ifeq ($(FOUNDATION_LIB),nx)
GNUSTEP_HEADERS_FND =
GNUSTEP_HEADERS_FND_FLAG = -framework Foundation
endif
endif
#
# Determine AppKit header subdirectory based upon library combo
#
@ -141,11 +133,9 @@ GNUSTEP_HEADERS_GUI = $(GNUSTEP_HEADERS)/gnustep/gui
GNUSTEP_HEADERS_GUI_FLAG = -I$(GNUSTEP_HEADERS_GUI)
endif
ifeq ($(OBJC_COMPILER), NeXT)
ifeq ($(FOUNDATION_LIB),nx)
GNUSTEP_HEADERS_GUI =
GNUSTEP_HEADERS_GUI_FLAG = -framework AppKit
endif
ifeq ($(GUI_LIB),nx)
GNUSTEP_HEADERS_GUI =
#GNUSTEP_HEADERS_GUI_FLAG = -framework AppKit
endif
#
@ -161,7 +151,9 @@ RUNTIME_DEFINE = -DGNU_RUNTIME=1
endif
ifeq ($(OBJC_RUNTIME_LIB),nx)
RUNTIME_FLAG = -fnext-runtime
ifneq ($(OBJC_COMPILER), NeXT)
RUNTIME_FLAG = -fnext-runtime
endif
RUNTIME_DEFINE = -DNeXT_RUNTIME=1
endif

View file

@ -112,8 +112,22 @@ GUI_LIBS = -lgnustep-gui
endif
ifeq ($(GUI_LIB),nx)
GUI_LDFLAGS = -framework AppKit
GUI_LIBS =
ifneq ($(APP_NAME),)
# If we're building an application pass the following additional flags to
# the linker
GUI_LDFLAGS = -sectcreate __ICON __header $(APP_NAME).iconheader \
-segprot __ICON r r -sectcreate __ICON app \
/NextLibrary/Frameworks/AppKit.framework/Resources/NSDefaultApplicationIcon.tiff \
-framework AppKit
GUI_LIBS =
before-link:: $(APP_NAME).iconheader
$(APP_NAME).iconheader:
@echo "F $(APP_NAME).app $(APP_NAME) app" >$@
@echo "F $(APP_NAME) $(APP_NAME) app" >>$@
endif
endif
BACKEND_LDFLAGS =

View file

@ -58,11 +58,16 @@ case $app in
done;;
esac
if [ -z "$full_appname" ]; then
echo "Can't find the required application: $app!"
exit 1
fi
appname=`echo $app | sed 's/\.[a-z]*$//'`
export_variable=yes . $GNUSTEP_SYSTEM_ROOT/Makefiles/ld_lib_path.sh
if [ "$library_combo" = nx_nx_nx_nil -a $GNUSTEP_HOST_OS = nextstep4 ]; then
if [ ! -d $full_appname/$appname ]; then
if [ ! -f $full_appname/$appname ]; then
echo "$full_appname application does not have a binary for this kind of machine and operating system."
exit 1
fi

View file

@ -113,18 +113,35 @@ ifeq ($(GNUSTEP_TARGET_OS), nextstep4)
HAVE_BUNDLES = yes
HAVE_SHARED_LIBS = yes
ifeq ($(FOUNDATION_LIB),nx)
# Use the NeXT compiler
CC = cc
OBJC_COMPILER = NeXT
endif
TARGET_LIB_DIR = \
Libraries/$(GNUSTEP_TARGET_CPU)/$(GNUSTEP_TARGET_OS)/$(LIBRARY_COMBO)
ifneq ($(OBJC_COMPILER), NeXT)
SHARED_LIB_LINK_CMD = \
/bin/libtool -dynamic -read_only_relocs suppress -o $@ \
/NextLibrary/Frameworks/System.framework/System \
-framework System \
-L$(GNUSTEP_USER_ROOT)/$(TARGET_LIB_DIR) \
-L$(GNUSTEP_LOCAL_ROOT)/$(TARGET_LIB_DIR) \
-L$(GNUSTEP_SYSTEM_ROOT)/$(TARGET_LIB_DIR) \
$(LIBRARIES_DEPEND_UPON) -lobjc -lgcc $^; \
(cd $(GNUSTEP_OBJ_DIR); rm -f $(LIBRARY_FILE); \
$(LN_S) $(VERSION_LIBRARY_FILE) $(LIBRARY_FILE))
else
SHARED_LIB_LINK_CMD = \
/bin/libtool -dynamic -read_only_relocs suppress -o $@ \
-framework System \
-L$(GNUSTEP_USER_ROOT)/$(TARGET_LIB_DIR) \
-L$(GNUSTEP_LOCAL_ROOT)/$(TARGET_LIB_DIR) \
-L$(GNUSTEP_SYSTEM_ROOT)/$(TARGET_LIB_DIR); \
(cd $(GNUSTEP_OBJ_DIR); rm -f $(LIBRARY_FILE); \
$(LN_S) $(VERSION_LIBRARY_FILE) $(LIBRARY_FILE))
endif
STATIC_LIB_LINK_CMD = \
/bin/libtool -static -o $@ $^; \
@ -138,7 +155,9 @@ AFTER_INSTALL_STATIC_LIB_COMMAND =
SHARED_CFLAGS += -dynamic
SHARED_LIBEXT = .a
ifneq ($(OBJC_COMPILER), NeXT)
TARGET_SYSTEM_LIBS += -lgcc
endif
HAVE_BUNDLES = yes
BUNDLE_CFLAGS =

View file

@ -247,80 +247,62 @@ int search_for_library_with_type_in_directory(char type, char* path, char* ext)
/* The extension matches. Do a check to see if the suffix of the
library matches the library type we are looking for. */
for (i = library_name_len + 3; i < filelen - extlen; i++)
{
for (i = library_name_len + 3; i < filelen - extlen; i++) {
/* Possibly a match */
if (type == dirbuf->d_name[i])
found = 1;
if (dirbuf->d_name[i] == '_') { /* Only one dash allowed */
/* Found another dash or one of the letters first */
if (dash || dfound || sfound || pfound) {
found = 0;
break;
}
else {
dash = 1;
continue;
}
}
else if (dirbuf->d_name[i] == 'd') { /* Only one d allowed */
/* We must have found the dash already */
if (!dash || dfound) {
found = 0;
break;
}
else {
dfound = 1;
continue;
}
}
else if (dirbuf->d_name[i] == 'p') { /* Only one p allowed */
/* We must have found the dash already */
if (!dash || pfound) {
found = 0;
break;
}
else {
pfound = 1;
continue;
}
}
else if (dirbuf->d_name[i] == 's') { /* Only one s allowed */
/* We must have found the dash already */
if (!dash || sfound) {
found = 0;
break;
}
else {
sfound = 1;
continue;
}
}
else {
/* Skip the libraries that begin with the same name but have
different suffix, eg libobjc.a libobjc-test.a. */
/* Possibly a match */
if (type == dirbuf->d_name[i]) {
found = 1;
}
/* Only one dash allowed */
if (dirbuf->d_name[i] == '_')
{
/* Found another dash or one of the letters first */
if (dash || dfound || sfound || pfound)
{
found = 0;
break;
}
else
{
dash = 1;
continue;
}
}
/* Only one d allowed */
if (dirbuf->d_name[i] == 'd')
{
/* We must have found the dash already */
if (!dash || dfound)
{
found = 0;
break;
}
else
{
dfound = 1;
continue;
}
}
/* Only one p allowed */
if (dirbuf->d_name[i] == 'p')
{
/* We must have found the dash already */
if (!dash || pfound)
{
found = 0;
break;
}
else
{
pfound = 1;
continue;
}
}
/* Only one s allowed */
if (dirbuf->d_name[i] == 's')
{
/* We must have found the dash already */
if (!dash || sfound)
{
found = 0;
break;
}
else
{
sfound = 1;
continue;
}
}
found = 0;
break;
}
}
if (found) {
char filename[PATH_MAX + 1];