Solved Debugging Makefiles

Hi everybody,

I encounter difficulties to locate commands executed in their respective makefiles.

I have tried for instance :

$ make -d p

I obtain something like this :

Code:
ParseReadLine (121): 'CDIAGFLAGS+=      -Wshadow'
ParseReadLine (128): 'GNUSYSTEM_AUX_DIR?=${BSDSRCDIR}/share/gnu'
ParseReadLine (130): 'INSTALL_COPY?=    -c'
ParseReadLine (132): 'INSTALL_STRIP?=   -s'
ParseReadLine (135): 'STATIC?=  -static ${STATICPIE}'
ParseReadLine (147): 'PICFLAG?=-fpic'
ParseReadLine (156): 'DEFAULT_PIE_DEF=-DPIE_DEFAULT=1'
ParseReadLine (165): 'BUILDUSER?= build'
ParseReadLine (166): 'WOBJGROUP?= wobj'
ParseReadLine (167): 'WOBJUMASK?= 007'
ParseReadLine (169): 'BSD_OWN_MK=Done'
ParseReadLine (174): '.PHONY: spell clean cleandir obj manpages print all  depend beforedepend afterdepend cleandepend subdirdepend  all clean
man includes  beforeinstall realinstall maninstall afterinstall install'
ParseDoDependency(.PHONY: spell clean cleandir obj manpages print all  depend beforedepend afterdepend cleandepend subdirdepend  all cleanman
includes  beforeinstall realinstall maninstall afterinstall install)
ParseEOF: returning to file /usr/src/share/mk/bsd.obj.mk, line 65
ParseSetParseFile: ${.PARSEDIR} = `/usr/src/share/mk' ${.PARSEFILE} = `bsd.obj.mk'
ParseEOF: returning to file /usr/src/sys/arch/amd64/compile/Makefile.inc, line 18
ParseSetParseFile: ${.PARSEDIR} = `/usr/src/sys/arch/amd64/compile' ${.PARSEFILE} = `Makefile.inc'
ParseEOF: returning to file /usr/src/sys/arch/amd64/compile/GENERIC.MP/Makefile, line 1
ParseSetParseFile: ${.PARSEDIR} = `/usr/src/sys/arch/amd64/compile/GENERIC.MP' ${.PARSEFILE} = `Makefile'
/bin/sh: [[: not found
/bin/sh: [[: not found
/bin/sh: [[: not found
/bin/sh: [[: not found
/bin/sh: [[: not found
As you can guess, what causes trouble is the last 5 shell errors.
I don't know where they are raised.

Is someone has a trick to locate this ?

Thanks a lot for your suggestions.

Cheers

Didier.
 
Yes, you're right. I was searching a way to change shell invocation too.

$ make -n

gives a good beginning for grep :
Code:
cd /usr/src/sys/arch/amd64/compile/GENERIC.MP;  umask 007;  here=`/bin/pwd`; bsdsrcdir=`cd /usr/src; /bin/pwd`;  subdir=${here#${bsdsrcdir}/};
  if [[ `id -u` -eq 0 && build != root ]]; then  SETOWNER="chown -h build:wobj";  if [[ $here != $subdir ]]; then  _mkdirs() {  su build -c "m
kdir -p $1";  };  MKDIRS=_mkdirs;  fi;  elif [[ `id` == *'('wobj')'* && $here == $subdir ]]; then  SETOWNER="chown :wobj";  else  SETOWNER=:;
fi;  [[ -z $MKDIRS ]] && MKDIRS="mkdir -p";  if [[ $here != $subdir ]]; then  dest=/usr/obj/$subdir ;  echo "$here/obj -> $dest";  if [[ ! -L
obj || `readlink obj` != $dest ]];  then  [[ -e obj ]] && rm -rf obj;  ln -sf $dest obj;  $SETOWNER obj;  fi;  if [[ -d /usr/obj ]]; then  [[
-d $dest ]] || $MKDIRS $dest;  else  if [[ -e /usr/obj ]]; then  echo "/usr/obj is not a directory";  else  echo "/usr/obj does not exist";  
fi;  fi;  else  dest=$here/obj ;  if [[ ! -d obj ]]; then  echo "making $dest" ;  $MKDIRS $dest;  $SETOWNER $dest;  fi ;  fi;

OK. Found with a find . -name '*.mk' -exec grep ...

And now ... I'm going to try to wrap the makefile command in bash
 
Back
Top