new makefile scheme..

Dan Nicholson dbn.lists at
Sat Aug 26 10:44:24 PDT 2006

On 8/26/06, George Boudreau <georgeb at> wrote:
> .. I still have no method for making progress_bar run without fuser.
> Ideas anyone???

George, I think I finally figured out a way to do this. I'm a little
short on time, so I'll try to explain. No time for diff's but you
should be able to figure it out.

>From inside the script, I tried using $PPID, but it was coming out to
strange values. I also ran ps with a lot of args, and found that
sometimes the script parent was even pid 1. Seems there's an extra
level of parenting or 2 when make actually runs a shell command.

Then I found out that within the Makefile, each target command has a
PPID of the actual make process. Try this.

    @echo PPID=$$PPID

It will echo the PID of make itself. So, the answer to the problem is
to use $$PPID in the Makefile and pass it as an argument to Here's a simple example that I found to work.

$ cat Makefile
        @echo -n "Building $@"
        @./ $@ $$PPID &
        @sleep 2
        @touch $@
        @echo -n "Building $@"
        @./ $@ $$PPID &
        @sleep 2
        @touch $@
all: foo bar
        rm -f foo bar
$ cat


until [[ -f ${TARGET} ]] || [[ ! -e /proc/${MAKE_PPID} ]]; do
        echo -n '.'
        sleep .12
$ make all
Building foo.................
Building bar................

It works when I interrupted the process, too. What do you think?


More information about the alfs-discuss mailing list