Fixes for choosing compilation and linking flags depending on shared=yes/no

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/tools/make/trunk@14435 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Nicola Pero 2002-09-12 13:59:04 +00:00
parent c06a6f2508
commit aafd6c32a3
4 changed files with 56 additions and 50 deletions

View file

@ -1,3 +1,19 @@
Thu Sep 12 15:53:50 2002 Nicola Pero <n.pero@mi.flashnet.it>
* target.make (ADDITIONAL_LDFLAGS): All concerned targets: do not
add -static when shared=no. We can't perform conditionals on the
value of shared in this file, since it has not yet been set up!
(STATIC_LDFLAGS): New variable. Set it to -static in all
concerned cases.
* rules.make (ALL_LDFLAGS): Add STATIC_LDFLAGS.
* target.make (BUNDLE_CFLAGS): This variable was no longer used, and
can't be fixed. Removed for all targets.
* common.make: Force shared=yes to be used whenever bundles are
built. Static bundles are meaningless, and we want the flags for
shared objects, such as -fPIC, to be automatically used when
compiling bundle object files, otherwise linking the bundle will
fail on some platforms.
Thu Sep 12 10:23:19 2002 Nicola Pero <n.pero@mi.flashnet.it>
* openapp.in: Implemented calling openapp with an application name

View file

@ -356,13 +356,29 @@ ifeq ($(OBJC_RUNTIME_LIB),nx)
RUNTIME_DEFINE = -DNeXT_RUNTIME=1
endif
#
# Now decide whether to build shared objects or not. Nothing depending
# on the value of the shared variable is allowed before this point!
#
#
# Fixup bundles to be always built as shared even when shared=no is given
#
ifeq ($(shared), no)
ifeq ($(GNUSTEP_TYPE), bundle)
$(warning "Static bundles are meaningless! I am using shared=yes!")
override shared = yes
export shared
endif
endif
# Enable building shared libraries by default. If the user wants to build a
# static library, he/she has to specify shared=no explicitly.
ifeq ($(HAVE_SHARED_LIBS), yes)
ifeq ($(shared), no)
shared=no
else
shared=yes
# Unless shared=no has been purposedly set ...
ifneq ($(shared), no)
# ... set shared = yes
shared = yes
endif
endif

View file

@ -243,8 +243,13 @@ $(AUXILIARY_JAVAHFLAGS)
ALL_JAVADOCFLAGS = $(INTERNAL_CLASSPATHFLAGS) $(INTERNAL_JAVADOCFLAGS) \
$(ADDITIONAL_JAVADOCFLAGS) $(AUXILIARY_JAVADOCFLAGS)
ALL_LDFLAGS = $(ADDITIONAL_LDFLAGS) $(AUXILIARY_LDFLAGS) $(GUI_LDFLAGS) \
$(BACKEND_LDFLAGS) $(SYSTEM_LDFLAGS) $(INTERNAL_LDFLAGS)
ifeq ($(shared),no)
ALL_LDFLAGS = $(STATIC_LDFLAGS)
else
ALL_LDFLAGS =
endif
ALL_LDFLAGS += $(ADDITIONAL_LDFLAGS) $(AUXILIARY_LDFLAGS) $(GUI_LDFLAGS) \
$(BACKEND_LDFLAGS) $(SYSTEM_LDFLAGS) $(INTERNAL_LDFLAGS)
ALL_LIB_DIRS = $(ADDITIONAL_FRAMEWORK_DIRS) $(AUXILIARY_FRAMEWORK_DIRS) \
$(ADDITIONAL_LIB_DIRS) $(AUXILIARY_LIB_DIRS) \

View file

@ -20,6 +20,10 @@
# If not, write to the Free Software Foundation,
# 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
# This file should not contain any conditional based on the value of
# the 'shared' variable, because we have not set it up yet when this
# file is processed!
#
# Host and target specific settings
#
@ -197,7 +201,6 @@ SHARED_CFLAGS += -dynamic
SHARED_LIBEXT = .dylib
BUNDLE_LD = $(CC)
BUNDLE_CFLAGS +=
BUNDLE_LDFLAGS += -bundle -undefined suppress $(ARCH_FLAGS)
endif
#
@ -297,7 +300,6 @@ SHARED_CFLAGS += -dynamic -fno-common
SHARED_LIBEXT = .dylib
BUNDLE_LD = $(CC)
BUNDLE_CFLAGS +=
BUNDLE_LDFLAGS += -bundle -undefined suppress $(ARCH_FLAGS)
endif
#
@ -369,7 +371,6 @@ SHARED_LIB_LINK_CMD = \
HAVE_BUNDLES = no
BUNDLE_LD = /usr/bin/ld
BUNDLE_CFLAGS += -fno-common
BUNDLE_LDFLAGS += -dynamic -flat_namespace -undefined warning $(ARCH_FLAGS)
else
@ -397,7 +398,6 @@ SHARED_LIB_LINK_CMD = \
SHARED_CFLAGS += -dynamic
BUNDLE_LD = $(CC)
BUNDLE_CFLAGS +=
BUNDLE_LDFLAGS += -bundle -undefined error $(ARCH_FLAGS)
endif # OBJC_COMPILER
@ -484,7 +484,6 @@ SHARED_CFLAGS += -dynamic
SHARED_LIBEXT = .a
BUNDLE_LD = ld
BUNDLE_CFLAGS +=
BUNDLE_LDFLAGS += -r $(ARCH_FLAGS)
endif
#
@ -549,7 +548,6 @@ SHARED_CFLAGS += -dynamic
SHARED_LIBEXT = .a
BUNDLE_LD = ld
BUNDLE_CFLAGS +=
BUNDLE_LDFLAGS += -r $(ARCH_FLAGS)
endif
#
@ -600,12 +598,10 @@ SHARED_LIBEXT = .so
HAVE_BUNDLES = yes
BUNDLE_LD = $(CC)
BUNDLE_CFLAGS += -fPIC
BUNDLE_LDFLAGS += -shared
ADDITIONAL_LDFLAGS += -rdynamic
ifeq ($(shared), no)
ADDITIONAL_LDFLAGS += -static
endif
STATIC_LDFLAGS += -static
endif
#
# end Linux ELF
@ -639,12 +635,9 @@ SHARED_LIBEXT = .so
HAVE_BUNDLES = yes
BUNDLE_LD = $(CC)
BUNDLE_CFLAGS += -fPIC
BUNDLE_LDFLAGS += -shared
ADDITIONAL_LDFLAGS += -rdynamic
ifeq ($(shared), no)
ADDITIONAL_LDFLAGS += -static
endif
STATIC_LDFLAGS += -static
endif
#
# end FreeBSD A.out
@ -694,12 +687,9 @@ SHARED_LIBEXT = .so
HAVE_BUNDLES = yes
BUNDLE_LD = $(CC)
BUNDLE_CFLAGS += -fPIC
BUNDLE_LDFLAGS += -shared
ADDITIONAL_LDFLAGS += -rdynamic
ifeq ($(shared), no)
ADDITIONAL_LDFLAGS += -static
endif
STATIC_LDFLAGS += -static
endif
endif
#
@ -739,12 +729,9 @@ SHARED_LIBEXT = .so
HAVE_BUNDLES = yes
BUNDLE_LD = $(CC)
#BUNDLE_CFLAGS +=
BUNDLE_LDFLAGS += -shared -fpic
#ADDITIONAL_LDFLAGS += -rdynamic
ifeq ($(shared), no)
ADDITIONAL_LDFLAGS += -static
endif
STATIC_LDFLAGS += -static
endif
#
# end NetBSD
@ -784,13 +771,10 @@ SHARED_LIBEXT = .so
HAVE_BUNDLES = yes
BUNDLE_LD = $(CC)
BUNDLE_CFLAGS += -fPIC
BUNDLE_LDFLAGS += -shared
ADDITIONAL_LDFLAGS += -rdynamic -Wl,-R/usr/pkg/lib -L/usr/pkg/lib
ADDITIONAL_INCLUDE_DIRS += -I/usr/pkg/include
ifeq ($(shared), no)
ADDITIONAL_LDFLAGS += -static -L/usr/pkg/lib
endif
STATIC_LDFLAGS += -static
endif
#
# end NetBSD
@ -828,12 +812,9 @@ SHARED_LIBEXT = .so
HAVE_BUNDLES = no
BUNDLE_LD = $(CC)
#BUNDLE_CFLAGS +=
BUNDLE_LDFLAGS += -shared -fpic
#ADDITIONAL_LDFLAGS += -rdynamic
ifeq ($(shared), no)
ADDITIONAL_LDFLAGS += -static
endif
STATIC_LDFLAGS += -static
endif
#
# end OpenBSD 2.x
@ -867,12 +848,9 @@ SHARED_LIBEXT = .so
HAVE_BUNDLES = yes
BUNDLE_LD = $(CC)
BUNDLE_CFLAGS += -fPIC
BUNDLE_LDFLAGS += -shared
ADDITIONAL_LDFLAGS += -rdynamic
ifeq ($(shared), no)
ADDITIONAL_LDFLAGS += -static
endif
STATIC_LDFLAGS += -static
# Newer gcc's don't define this in Objective-C programs:
AUXILIARY_CPPFLAGS += -D__LANGUAGES_C__
endif
@ -906,7 +884,6 @@ OBJ_MERGE_CMD = \
HAVE_BUNDLES = yes
BUNDLE_LD = $(CC)
BUNDLE_CFLAGS += -fPIC
BUNDLE_LDFLAGS += -shared
endif
@ -934,7 +911,6 @@ OBJ_MERGE_CMD = \
HAVE_BUNDLES = yes
BUNDLE_LD = $(CC)
BUNDLE_CFLAGS =
BUNDLE_LDFLAGS += -nodefaultlibs -Xlinker -r
endif
@ -962,7 +938,6 @@ OBJ_MERGE_CMD = \
HAVE_BUNDLES = yes
BUNDLE_LD = $(CC)
BUNDLE_CFLAGS =
BUNDLE_LDFLAGS += -nodefaultlibs -Xlinker -r
endif
@ -1014,7 +989,6 @@ SHARED_LIBEXT = .so
HAVE_BUNDLES = yes
BUNDLE_LD = $(CC)
BUNDLE_CFLAGS += -fPIC
BUNDLE_LDFLAGS = -shared -mimpure-text
#BUNDLE_LDFLAGS = -nodefaultlibs -Xlinker -r
endif
@ -1050,7 +1024,6 @@ SHARED_LIBEXT = .so
HAVE_BUNDLES = yes
BUNDLE_LD = $(CC)
BUNDLE_CFLAGS += -fPIC
#BUNDLE_LDFLAGS += -shared -mimpure-text
BUNDLE_LDFLAGS += -nodefaultlibs -Xlinker -r
endif
@ -1077,10 +1050,8 @@ SHARED_LIB_LINK_CMD = \
ifeq ($(CC), cc)
SHARED_CFLAGS += +z
BUNDLE_CFLAGS += +z
else
SHARED_CFLAGS += -fPIC
BUNDLE_CFLAGS += -fPIC
endif
ifeq ($(GNUSTEP_HOST_CPU), ia64)
@ -1093,9 +1064,7 @@ HAVE_BUNDLES = yes
BUNDLE_LD = $(CC)
BUNDLE_LDFLAGS += -nodefaultlibs -Xlinker -r
ADDITIONAL_LDFLAGS += -Xlinker +s
ifeq ($(shared), no)
ADDITIONAL_LDFLAGS += -static
endif
STATIC_LDFLAGS += -static
endif
# end HP-UX