[EMAIL PROTECTED] wrote:
Author: vitek
Date: Fri Jan 25 17:32:02 2008
New Revision: 615419

URL: http://svn.apache.org/viewvc?rev=615419&view=rev
Log:

2008-01-25  Travis Vitek  <[EMAIL PROTECTED]>

        STDCXX-573
        * etc/config/makefile.rules: Use WITH_PURIFY or WITH_CADVISE to enable
        or disable purify and cadvise tools
        * GNUmakefile: Document new parameters, and cache them in makefile.in


Modified:
    stdcxx/trunk/GNUmakefile
    stdcxx/trunk/etc/config/makefile.rules

Modified: stdcxx/trunk/GNUmakefile
URL: 
http://svn.apache.org/viewvc/stdcxx/trunk/GNUmakefile?rev=615419&r1=615418&r2=615419&view=diff
==============================================================================
--- stdcxx/trunk/GNUmakefile (original)
+++ stdcxx/trunk/GNUmakefile Fri Jan 25 17:32:02 2008
@@ -151,6 +151,12 @@
 #
 #   WARNFLAGS - any compiler warning options
 #
+#   WITH_PURIFY - set to `true' to build with purify. additional flags
+#                 can be specified in PURIFYFLAGS.
+#
+#   WITH_CADVISE - set to `true' to build with cadvise. additional flags
+#                  can be specified in CADVISEFLAGS.
+#
 ########################################################################
SHELL = /bin/sh
@@ -642,6 +648,10 @@
           && echo "BUILDTAG   = $(BUILDTAG)"             >> $(MAKEFILE_IN)  \
           && echo "PLATFORM   = $(PLATFORM)"             >> $(MAKEFILE_IN)  \
           && echo "DEFAULT_SHROBJ = $(DEFAULT_SHROBJ)"   >> $(MAKEFILE_IN)  \
+          && echo "WITH_CADVISE = $(WITH_CADVISE)"       >> $(MAKEFILE_IN)  \
+          && echo "CADVISEFLAGS = $(CADVISEFLAGS)"       >> $(MAKEFILE_IN)  \
+          && echo "WITH_PURIFY = $(WITH_PURIFY)"         >> $(MAKEFILE_IN)  \
+          && echo "PURIFYFLAGS = $(PURIFYFLAGS)"         >> $(MAKEFILE_IN)  \
           && echo "CXX_REPOSITORY = $(CXX_REPOSITORY)"        >> 
$(MAKEFILE_IN));
# creates the build directory tree and generates makefile.in

Modified: stdcxx/trunk/etc/config/makefile.rules
URL: 
http://svn.apache.org/viewvc/stdcxx/trunk/etc/config/makefile.rules?rev=615419&r1=615418&r2=615419&view=diff
==============================================================================
--- stdcxx/trunk/etc/config/makefile.rules (original)
+++ stdcxx/trunk/etc/config/makefile.rules Fri Jan 25 17:32:02 2008
@@ -70,6 +70,25 @@
        -gencat $@ $^
+ifeq ($(WITH_PURIFY),true)
+  ifeq ($(PURIFYFLAGS),)
+    PURIFYFLAGS  = -windows=no
+       PURIFYFLAGS += -log-file=stderr [EMAIL PROTECTED]

I don't think there's anything wrong with this, but for whatever it's
worth, I'm a little nervous about using the $@ variable outside a rule.
See http://issues.apache.org/jira/browse/STDCXX-302 for a problem that
this caused. I'm never sure about the exact rules for the expansion of
these variables and it looks like there are some subtle differences
(or maybe I just don't understand them).

+  endif
+
+  ifneq ($(OSNAME),AIX)
+       PURIFY = purify $(PURIFYFLAGS)
+  endif
+endif
+
+ifeq ($(WITH_CADVISE),true)
+  ifeq ($(CADVISEFLAGS),)
+    CADVISEFLAGS = +w
+  endif
+
+  CADVISE = cadvise $(CADVISEFLAGS)
+endif
+
 ########################################################################
 #  COMMON RULES
 ########################################################################
@@ -89,17 +108,17 @@

Wouldn't it be better to define CXX to cadvise $(CXX) and LD to
$(PURIFY) $(LD) instead of changing the rules below?

Also, FWIW, the "design goal" of makefile.rules is to just contain
very simple generic rule definitions using implicit make variables
set in makefile.common. Ideally, there would be no rules here and
we'd be using the implicit rules:

http://www.gnu.org/software/make/manual/make.html#Implicit-Variables
http://www.gnu.org/software/make/manual/make.html#toc_Implicit-Rules

Martin

# make the rule match for sources matching *.out.cpp
 %.out.o: %.out.cpp
-       $(CXX) -c $(CPPFLAGS) $(CXXFLAGS) $(call CXX.repo,$<) $<
+       $(CADVISE) $(CXX) -c $(CPPFLAGS) $(CXXFLAGS) $(call CXX.repo,$<) $<
%.o: %.cpp
-       $(CXX) -c $(CPPFLAGS) $(CXXFLAGS) $(call CXX.repo,$<) $<
+       $(CADVISE) $(CXX) -c $(CPPFLAGS) $(CXXFLAGS) $(call CXX.repo,$<) $<
# make the rule match for objects matching *.out.o
 %.out: %.out.o
-       $(LD) $< -o $@ $(LDFLAGS) $(LDLIBS) $(call CXX.repo,$<)
+       $(PURIFY) $(LD) $< -o $@ $(LDFLAGS) $(LDLIBS) $(call CXX.repo,$<)
%: %.o
-       $(LD) $< -o $@ $(LDFLAGS) $(LDLIBS) $(call CXX.repo,$<)
+       $(PURIFY) $(LD) $< -o $@ $(LDFLAGS) $(LDLIBS) $(call CXX.repo,$<)
# disable compilation and linking in the same step
 # %: %.cpp
@@ -108,8 +127,8 @@
# compile and link in one step to eliminate the space overhead of .o files
 %: %.cpp
-       $(CXX) $< -o $@ $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS) $(LDLIBS) \
-               $(call CXX.repo,$<)
+       $(CADVISE) $(PURIFY) $(CXX) $< -o $@ $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS) 
\
+               $(LDLIBS) $(call CXX.repo,$<)
endif # eq ($(NO_DOT_O),)



Reply via email to