Re: Target Path Stripping Possible?
[email protected] (Paul Jarc) Sat, 06 Jun 2009 10:36:51 -0400
| Newsgroups | gmane.comp.gnu.utils |
|---|---|
| Organization | What did you have in mind? A short, blunt, human pyramid? |
| Message-ID | <[email protected]> |
Tom Browder <[email protected]> wrote: > On Fri, Jun 5, 2009 at 14:45, Paul Jarc <[email protected]> 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