help-make
[Top][All Lists]
Advanced

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

Re: GNU Make Windows: absolute path to the file that contains the Make f


From: Eli Zaretskii
Subject: Re: GNU Make Windows: absolute path to the file that contains the Make file that is currently being interpreted by Make.
Date: Sat, 01 Oct 2016 09:46:23 +0300

> From: Denis BEURIVE <address@hidden>
> Date: Fri, 30 Sep 2016 23:15:42 +0200
> 
> I use to use GNU Make under UNIX, but (unfortunately), I have to work under
> Windows. This is not my cup of tea… and I have the MSDOS, which is a
> prehistoric tool. However, I have no choice.

What do you mean by "I have the MSDOS"?  Are you using MSDOS tools on
Windows?  Or does it mean something else?

> Under UNIX, I use to use this construct in order to get the absolute path
> to the file that contains the Make file that is currently being interpreted
> by Make :
> 
> __DIR__ := $(dir $(abspath $(lastword $(MAKEFILE_LIST))))
> 
> This works fine under UNIX.
> 
> However, under Windows, it does not work… The result is totally unexpected.

What is the version of GNU Make you have installed on the Windows
machine?  With Make 4.2, the latest official release, your recipe
works for me.  Here's how I tried this (where "^Z" means Ctrl-Z, the
Windows EOF character):

  D:\usr\eli\data>make -f-
  DIR:=$(dir $(abspath $(lastword $(MAKEFILE_LIST))))
  all:
          echo $(DIR)
  ^Z
  echo D:/usr/tmp/
  D:/usr/tmp/

> Does somebody know a reliable way to get the absolute path to the file that
> contains the Make file that is currently being interpreted by Make, under
> Windows ?

The file-name related built-in functions should all work on MS-Windows
as you'd expect.  I suspect you have some old version of Make, which
perhaps didn't support some of these functions.



reply via email to

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