You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stdcxx.apache.org by se...@apache.org on 2007/07/10 21:54:27 UTC
svn commit: r555061 - in /incubator/stdcxx/trunk: GNUmakefile
etc/config/GNUmakefile.cfg etc/config/makefile.rules etc/config/sunpro.config
Author: sebor
Date: Tue Jul 10 12:54:26 2007
New Revision: 555061
URL: http://svn.apache.org/viewvc?view=rev&rev=555061
Log:
2007-07-10 Michael van der Westhuizen <r1...@gmail.com>
Martin Sebor <se...@roguewave.com>
STDCXX-470
STDCXX-479
STDCXX-481
* sunpro.config (CCMAJOR, CCMINOR): New variables for the major
and minor version of the compiler.
(DEPENDFLAGS.cpp, DEPENDFLAGS.S): New variables for compiler options
to generate makefile dependencies from C++ and assembly source files,
respectively.
(wide_flags): Set to -m64 for Sun C++ 5.9 and beyond, and for 5.8
and prior to -xarch=v9 on SPARC and to -xarch=amd64 on AMD64.
(narrow_flags): Set to -m32 for Sun C++ 5.9 and beyond, and for C++
5.8 and prior to -xarch=v8 on SPARC, -xarch=386 on AMD64, and to
-xarch=generic otherwise.
* makefile.rules (makedep): Used DEPENDFLAGS$(depsuffix) to set
compiler options to generate makefile dependencies.
(depsuffix): Defined a target-specific variable to the suffix of
the first prerequisite of the %.d pattern rule used to generate
makefile dependencies.
(DEPENDFLAGS, DEPENDFLAGS.cpp, DEPENDFLAGS.S, DEPENDFLAGS.s): Set
appropriately when not defined or empty, and guarded .d: %.cpp and
%.d: %$(AS_EXT) pattern rules.
(GNUmakefile.cfg): Commented out make variables whose names do not
form valid shell variable names (i.e., those containing periods)
from the gernerated vars.sh file.
* GNUmakefile (DEPENDFLAGS, DEPENDFLAGS.cpp, DEPENDFLAGS$(AS_EXT):
Wrote definitions to the generated makefile.in.
Modified:
incubator/stdcxx/trunk/GNUmakefile
incubator/stdcxx/trunk/etc/config/GNUmakefile.cfg
incubator/stdcxx/trunk/etc/config/makefile.rules
incubator/stdcxx/trunk/etc/config/sunpro.config
Modified: incubator/stdcxx/trunk/GNUmakefile
URL: http://svn.apache.org/viewvc/incubator/stdcxx/trunk/GNUmakefile?view=diff&rev=555061&r1=555060&r2=555061
==============================================================================
--- incubator/stdcxx/trunk/GNUmakefile (original)
+++ incubator/stdcxx/trunk/GNUmakefile Tue Jul 10 12:54:26 2007
@@ -588,7 +588,10 @@
&& echo "PICFLAGS = $(PICFLAGS)" >> $(MAKEFILE_IN) \
&& echo "CPPFLAGS = $(CPPFLAGS)" >> $(MAKEFILE_IN) \
&& echo "WARNFLAGS = $(WARNFLAGS)" >> $(MAKEFILE_IN) \
- && echo "DEPENDFLAGS = $(DEPENDFLAGS)" >> $(MAKEFILE_IN) \
+ && echo "DEPENDFLAGS = $(DEPENDFLAGS)" >> $(MAKEFILE_IN) \
+ && echo "DEPENDFLAGS.cpp = $(DEPENDFLAGS.cpp)" >> $(MAKEFILE_IN) \
+ && echo "DEPENDFLAGS$(AS_EXT) = $(value DEPENDFLAGS$(AS_EXT))" \
+ >> $(MAKEFILE_IN) \
&& echo "AS_EXT = $(AS_EXT)" >> $(MAKEFILE_IN) \
&& echo "LD = $(LD)" >> $(MAKEFILE_IN) \
&& echo "LDFLAGS = $(LDFLAGS)" >> $(MAKEFILE_IN) \
Modified: incubator/stdcxx/trunk/etc/config/GNUmakefile.cfg
URL: http://svn.apache.org/viewvc/incubator/stdcxx/trunk/etc/config/GNUmakefile.cfg?view=diff&rev=555061&r1=555060&r2=555061
==============================================================================
--- incubator/stdcxx/trunk/etc/config/GNUmakefile.cfg (original)
+++ incubator/stdcxx/trunk/etc/config/GNUmakefile.cfg Tue Jul 10 12:54:26 2007
@@ -145,6 +145,11 @@
# (re)create config.h; do not change timestamp if the new file is the same
# make .o first to make sure the %.o: %.cpp rule gets invoked (make bug?)
# run a configure script as the last step (e.g., to remove unwanted files)
+
+# creates a file named vars.sh, containing shell assignments corresponding
+# to makefile variables defined in $(BUILDDIR)/makefile.in (variables with
+# invalid names (those containing periods) are commented out); vars.sh is
+# used in libc_decl.sh to invoke the compiler and linker
config: clean sane
@([ -f config.h ] && mv config.h config.h.~ ; \
echo "// configured for $(CCNAME) on `uname -sr`" >config.h ; \
@@ -163,6 +168,7 @@
if [ ! -f vars.sh ] ; then \
cat ../makefile.in \
| sed -e "s/= *\([^ ][^ ]* .*\)/=\"\1\"/" \
+ -e "s/^\( *[^=]*\.[^=]*=.*\)/# \1/" \
-e "s/^\([^ ]*\) *= *\(.*\)/\1=\2 ; export \1/" \
-e 's/$$(\([^)]*\))/${\1}/g' >vars.sh ; \
fi ; \
Modified: incubator/stdcxx/trunk/etc/config/makefile.rules
URL: http://svn.apache.org/viewvc/incubator/stdcxx/trunk/etc/config/makefile.rules?view=diff&rev=555061&r1=555060&r2=555061
==============================================================================
--- incubator/stdcxx/trunk/etc/config/makefile.rules (original)
+++ incubator/stdcxx/trunk/etc/config/makefile.rules Tue Jul 10 12:54:26 2007
@@ -166,8 +166,6 @@
endif # eq ($(findstring clean,$(MAKECMDGOALS)),)
-ifneq ($(DEPENDFLAGS),)
-
# generate dependencies only if they don't yet exist, removing anything
# not under $(TOPDIR) or $(BUILDDIR) (e.g., system headers) from the list
# this is done by splitting up dependencies using tr so that there is just
@@ -188,8 +186,9 @@
s:$$RWTSRCDIR:$$""(TOPDIR)/\.\./rwtest:gp; \
s:$(TOPDIR):$$""(TOPDIR):gp; \
s:$(BUILDDIR):$$""(BUILDDIR):gp" ; \
- \
- $(CXX) $(DEPENDFLAGS) $(CPPFLAGS) $(CXXFLAGS) $< \
+ depflags=$(value DEPENDFLAGS$(depsuffix)); \
+ echo "$(CXX) $$depflags $(CPPFLAGS) $(CXXFLAGS) $<"; \
+ $(CXX) $$depflags $(CPPFLAGS) $(CXXFLAGS) $< \
| sed "$$sedexp1" | tr "@" "\n" | sed -n "$$sedexp2" >$@ ; \
if [ ! -s $@ ]; then \
depfile=$*.u; \
@@ -207,14 +206,36 @@
$(DEPENDDIR):
@[ ! -d $(DEPENDDIR) ] && mkdir -p $(DEPENDDIR)
+
+ifeq ($(DEPENDFLAGS),)
+ # if DEPENDFLAGS is empty or not defined, set it to the concatenation
+ # of the variables specific to each type of a source file
+ DEPENDFLAGS = $(DEPENDFLAGS.cpp) $(value DEPENDFLAGS$(AS_EXT))
+else
+ DEPENDFLAGS.cpp := $(DEPENDFLAGS)
+ DEPENDFLAGS.S := $(DEPENDFLAGS)
+ DEPENDFLAGS.s := $(DEPENDFLAGS)
+endif
+
+ifneq ($(DEPENDFLAGS),)
+
+# set depsuffix to the suffix of the first prerequisite
+$(DEPENDDIR)/%.d: depsuffix = $(suffix $<)
+
+ ifneq ($(DEPENDFLAGS.cpp),)
+
# rule to make dependencies for C++ source files
$(DEPENDDIR)/%.d: %.cpp $(DEPENDDIR)
$(makedep)
+ endif # DEPENDFLAGS.cpp
+ ifneq ($(value DEPENDFLAGS$(AS_EXT)),)
+
# rule to make dependencies for assembly files
$(DEPENDDIR)/%.d: %$(AS_EXT) $(DEPENDDIR)
$(makedep)
+ endif # DEPENDFLAGS.as
else # ifeq ($(DEPENDFLAGS),)
Modified: incubator/stdcxx/trunk/etc/config/sunpro.config
URL: http://svn.apache.org/viewvc/incubator/stdcxx/trunk/etc/config/sunpro.config?view=diff&rev=555061&r1=555060&r2=555061
==============================================================================
--- incubator/stdcxx/trunk/etc/config/sunpro.config (original)
+++ incubator/stdcxx/trunk/etc/config/sunpro.config Tue Jul 10 12:54:26 2007
@@ -10,9 +10,24 @@
# extract the "C++ m.n" substring from version string (whcih changes
# from one release of the compiler to another)
-CCVER := $(shell $(CXX) -V 2>&1 | head -n1 | sed 's/.*C\+\+ *\([^ ]*\).*/\1/')
+CCVER := $(shell $(CXX) -V 2>&1 | head -n1 \
+ | sed 's/.*C\+\+ *\([^ ]*\).*/\1/')
+CCMAJOR := $(shell echo $(CCVER) | cut -f1 -d'.')
+CCMINOR := $(shell echo $(CCVER) | cut -f2 -d'.')
+
+ifeq ($(shell expr $(CCMAJOR) = 5 \& $(CCMINOR) = 9),1)
+ # in Sun C++ 5.9 -xM can only be used with C and C++ files
+ # and it produces the wrong results with .{S,s} files
+ DEPENDFLAGS.cpp = -xM
+
+ # deliberately undefined:
+ # DEPENDFLAGS.S =
+ # DEPENDFLAGS =
+else
+ DEPENDFLAGS = -xM
+endif
+
WARNFLAGS = +w
-DEPENDFLAGS = -xM
PICFLAGS = -KPIC
LDSOFLAGS =
CXXFLAGS = -library=%none
@@ -77,21 +92,38 @@
SINGL_CPPFLAGS =
SINGL_LDFLAGS =
-# (try to) determine the architecture via the (non-standard) -p option
-# recognized on (at least) Linux and Solaris
-arch=$(shell uname -p 2>/dev/null)
-
-ifeq ($(arch),sparc)
- # wide (64-bit) flags -- must be set explicitly
- # narrow (32-bit) flags are implicit on SPARC
- wide_flags = -xarch=v9
- narrow_flags = -xarch=v8
+ifeq ($(shell expr $(CCMAJOR) \>= 5 \& $(CCMINOR) \>= 9),1)
+
+ # starting with Sun C++ 5.9, the compiler prefers the generic
+ # -m32 and -m64 options to the architecture specific -xarch
+ # options some of which have been deprecated
+ wide_flags = -m64
+ narrow_flags = -m32
else
- # wide (64-bit) flags -- must be set explicitly
- # narrow (32-bit) flags are implicit on AMD64
- ifeq ($(arch),amd64)
- wide_flags = -xarch=amd64
- narrow_flags =
+ # (try to) determine the architecture via the (non-standard)
+ # -p option recognized on (at least) Linux and Solaris
+ arch := $(shell uname -p 2>/dev/null)
+
+ ifeq ($(arch),sparc)
+ # wide (64-bit) flags -- must be set explicitly
+ # narrow (32-bit) flags are implicit on SPARC
+ wide_flags = -xarch=v9
+ narrow_flags = -xarch=v8
+ else
+ # wide (64-bit) flags -- must be set explicitly
+ # narrow (32-bit) flags are implicit on AMD64
+ ifeq ($(OSNAME),SunOS)
+ # Solaris uname -p prints i386 on AMD64, use the optisa
+ # command to deterrmine "the best" architecture
+ arch := $(shell optisa amd64)
+ endif
+ ifeq ($(arch),amd64)
+ wide_flags = -xarch=amd64
+ narrow_flags = -xarch=386 # the default (same as generic)
+ else
+ wide_flags = -xarch=generic64
+ narrow_flags = -xarch=generic # the default (same as 386)
+ endif
endif
endif