bfdver.h fix doesn't work with hp-ux 'make'

Michael Elizabeth Chastain mec.gnu@mindspring.com
Thu May 27 17:33:00 GMT 2004


Hi Ben,

I'm building gdb HEAD on native hppa2.0w-hp-hpux11.11 using the hp-ux
version of 'make'.  I get this error (after I rip some '@' out of
Makefile.in so I can see it):

	  echo "creating bfdver.h"
  creating bfdver.h
	  bfd_version=`echo "2.15.91" | sed -e 's/\([^\.]*\)\.*\([^\.]*\)\.*\([^\.]*\)\.*\([^\.]*\)\.*\([^\.]*\).*/\1.00\2.00\3.00\4.00\5/' -e 's/\([^\.]*\)\..*\(..\)\..*\(..\)\..*\(..\)\..*\(..\)$/\1\2\3\4\5/'` ;\
	  bfd_version_string="\"2.15.91\"" ;\
	  if test "x" = x ; then \
	    bfd_version_date=`sed -n -e 's/.*DATE //p' < ` ;\
	    bfd_version_string="\"2.15.91 ${bfd_version_date}\"" ;\
	  fi ;\
	  sed -e "s/@bfd_version@/$bfd_version/" -e "s/@bfd_version_string@/$bfd_version_string/" <  > bfdver.h
  sh: Syntax error at line 7 : `>' is not expected.
  *** Error exit code 2

The problem is in the last line.  bfd/Makefile.in says:

  bfdver.h: version.h Makefile.in
	@echo "creating $@"
	@bfd_version=...
	...
	sed -e "s/@bfd_version@/$$bfd_version/" -e "s/@bfd_version_string@/$$bfd_version_string/" < $< > $@

hp-ux make has substituted $< to an empty string.

This behavior is allowed by the Single Unix Spec, version 3.
Here's the spec:

  http://www.opengroup.org/onlinepubs/009695399/utilities/make.html

    $<
      In an inference rule, the $< macro shall evaluate to the filename
      whose existence allowed the inference rule to be chosen for the
      target.  In the .DEFAULT rule, the $< macro shall evaluate to the
      current target name.  The meaning of the $< macro shall be
      otherwise unspecified.

I tried changing $< to ${srcdir}/version.h.  That fixes this problem,
but then another syntax error pops up right after that:

  sh[4]: Syntax error at line 1 : `end of file' is not expected.

I'll dig into this and come up with a SuSv3-compatible and hpux-compatible
bit of code.

Michael C



More information about the Binutils mailing list