On Sun, May 3, 2009 at 6:03 PM, Peng Yu <pengyu...@gmail.com> wrote: > Thank you for your reply. But what you pointed to me is not exactly > what I am looking for. > > I want the path of the directory where the Makefile is in. > > make -f some_makefile_in_another_directory > > If I use the above command, $CURDIR will not be the directory where > `some_makefile_in_another_directory' is in.
Ah, I see. First of all, section 3.5 we see a description of the MAKEFILE_LIST variable and how, at the start of a makefile, $(lastword $(MAKEFILE_LIST)) is the name of the makefile. Next, as search for 'absolute' turns up section 8.3, where we find this: `$(realpath NAMES...)' For each file name in NAMES return the canonical absolute name. A canonical name does not contain any `.' or `..' components, nor any repeated path separators (`/') or symlinks. In case of a failure the empty string is returned. Consult the `realpath(3)' documentation for a list of possible failure causes. So: $(realpath $(lastword $(MAKEFILE_LIST))) Make sense? Philip Guenther _______________________________________________ Help-make mailing list Help-make@gnu.org http://lists.gnu.org/mailman/listinfo/help-make