bug-automake
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#8880: Support for portland compilers in depcomp?


From: Daily, Jeff A
Subject: bug#8880: Support for portland compilers in depcomp?
Date: Thu, 16 Jun 2011 09:52:27 -0700

I’m using automake 1.11.1 and I was puzzled why “checking dependency style of pgcc” would result in “none”.  It’s a fairly modern compiler, right?  I dug a little deeper.  It  looks like pgcc has some options for generating Makefile output.

 

$ pgcc –V

 

pgcc 11.2-0 64-bit target on x86-64 Linux -tp k8e

Copyright 1989-2000, The Portland Group, Inc.  All Rights Reserved.

Copyright 2000-2011, STMicroelectronics, Inc.  All Rights Reserved.

 

Here’s the output from “man pgcc”:

       -M     Generate a list of make dependences and print them to stdout.

       -MD    Generate a list of make dependences and print them to the file

              file.d, where file is the root name of the file under

              compilation.

 

       -MM    Generate a list of make dependences and print them to stdout;

              ignore system includes.

 

       -MMD   Generate a list of make dependences and print them to the file

              file.d, where file is the root name of the file under

              compilation. Ignore system includes.

 

It doesn’t look like pgcc has anything fancier or more useful than that, for example I didn’t notice any -MF option.  I looked at depcomp and didn’t see any existing depmode for the -MD option alone.   Also, based on testing the output of pgcc, it looks like -MD creates the file.d based on the basename of the compiled file and will ignore subdirectories.  I also noticed that the file.d output wrapped long lines.  So I pieced together some of the other depmode cases within depcomp and came up with the following case:

 

pgcc)

  # Portland's C compiler understands `-MD'.

  # Will always output deps to `file.d' where file is the root name of the

  # file under compilation, even if file resides in a subdirectory.

  # pgcc 10.2 will output

  #    foo.o: sub/foo.c sub/foo.h

  # and will wrap long lines using \ :

  #    foo.o: sub/foo.c ... \

  #     sub/foo.h ... \

  #     ...

  dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`

  test "x$dir" = "x$object" && dir=

  base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`

  tmpdepfile="$base.d"

  "$@" -MD

  stat=$?

  if test $stat -eq 0; then :

  else

    rm -f "$tmpdepfile"

    exit $stat

  fi

  rm -f "$depfile"

  # Each line is of the form `foo.o: dependent.h',

  # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'.

  # Do two passes, one to just change these to

  # `$object: dependent.h' and one to simply `dependent.h:'.

  sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile"

  # Some versions of the HPUX 10.20 sed can't process this invocation

  # correctly.  Breaking it into two sed invocations is a workaround.

  sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" |

    sed -e 's/$/ :/' >> "$depfile"

  rm -f "$tmpdepfile"

  ;;

 

So does my hack seem legitimate?  I tried it on my project (which also uses libtool) and it appeared to do the right thing.  Is there any way to get this kind of support for Portland compilers into automake?  Thanks.

__________________________________________________
Jeff Daily
Scientist
DATA INTENSIVE SCIENTIFIC COMPUTING

Pacific Northwest National Laboratory
902 Battelle Boulevard
P.O. Box 999, MSIN K7-90
Richland, WA  99352 USA
Tel:  509-372-6548
Fax: 509-372-4720
address@hidden
www.pnnl.gov

 

 

 


reply via email to

[Prev in Thread] Current Thread [Next in Thread]