help-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

possible realpath bug


From: Harvey Chapman
Subject: possible realpath bug
Date: Sat, 21 Mar 2009 03:49:55 -0400
User-agent: Postbox 1.0b9 (Macintosh/2009030821)

I think I may have found a bug in make 3.81. It seems that $(realpath path) does not work inside the commands for a target if path was created in a previous command for the same target. Ugh. The example will make it clearer.


OBJ_DIR=objects

.PHONY: all clean $(OBJ_DIR) make_obj_dir test1 test2
all:
    $(MAKE) test1
    @echo
    $(MAKE) test2

test1: clean $(OBJ_DIR)

test2: clean make_obj_dir $(OBJ_DIR)

clean:
    rm -rf $(OBJ_DIR)

make_obj_dir:
    @echo "======== $@ ========"
    [ -d $(OBJ_DIR) ] || mkdir -p $(OBJ_DIR)
    @echo " \$$(realpath $(OBJ_DIR)) is \""$(realpath $(OBJ_DIR))"\""
    @echo " \$$(abspath $(OBJ_DIR)) is \""$(abspath $(OBJ_DIR))"\""

$(OBJ_DIR):
    @echo "======== $@ ========"
    [ -d $@ ] || mkdir -p $@
    @echo " \$$(realpath $@) is \""$(realpath $@)"\""
    @echo " \$$(abspath $@) is \""$(abspath $@)"\""
@echo " \$$(realpath \$$(abspath $@)) is \""$(realpath $(abspath $@))"\""



harveybook:test hchapman$ make -v ; make
GNU Make 3.81
Copyright (C) 2006  Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.

This program built for i386-apple-darwin9.0
make test1
rm -rf objects
======== objects ========
[ -d objects ] || mkdir -p objects
 $(realpath objects) is ""
 $(abspath objects) is "/private/tmp/test/objects"
 $(realpath $(abspath objects)) is ""

make test2
rm -rf objects
======== make_obj_dir ========
[ -d objects ] || mkdir -p objects
 $(realpath objects) is ""
 $(abspath objects) is "/private/tmp/test/objects"
======== objects ========
[ -d objects ] || mkdir -p objects
 $(realpath objects) is "/private/tmp/test/objects"
 $(abspath objects) is "/private/tmp/test/objects"
 $(realpath $(abspath objects)) is "/private/tmp/test/objects"
harveybook:test hchapman$





reply via email to

[Prev in Thread] Current Thread [Next in Thread]