[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Target Path Stripping Possible?
From: |
Paul Jarc |
Subject: |
Re: Target Path Stripping Possible? |
Date: |
Sat, 06 Jun 2009 10:36:51 -0400 |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/22.1 (gnu/linux) |
Tom Browder <tom.browder@gmail.com> wrote:
> On Fri, Jun 5, 2009 at 14:45, Paul Jarc <prj@po.cwru.edu> wrote:
>> Change the subdirectory Makefile to use:
>> % :
>> ( cd $(MASTERDIR); $(MAKE) RUNDIR=`pwd` $@ )
>
> Thanks, Paul, but that didn't work, probably because in the top
> Makefile the RUNDIR is in relative form while your construction puts
> it in absolute form.
In that case:
% :
cd $(MASTERDIR) && \
pwd=`$(MASTERDIR)/relative-pwd` &&
$(MAKE) RUNDIR="$${pwd?}" $@
Where $(MASTERDIR)/relative-pwd is this script:
#!/bin/sh
topdir=`dirname "$0"` &&
topdir=`(cd "${topdir?}" && pwd -P)` &&
subdir=`pwd -P` &&
case ${subdir?}/ in
"${topdir?}"/*)
length=`wc -c <<EOT
${topdir?}
EOT
` &&
length=`expr ${length?} + 1` &&
cut -c "${length?}"- <<EOT
${subdir?}
EOT
;;
*)
echo "Sorry, you're outside my jurisdiction." >&2 &&
exit 1;;
esac