help-make
[Top][All Lists]
Advanced

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

Re: Get full pathname for file


From: Greg Chicares
Subject: Re: Get full pathname for file
Date: Sun, 21 Nov 2010 16:34:04 +0000
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.12) Gecko/20101027 Thunderbird/3.1.6

On 2010-11-21 12:22Z, MiltonSv wrote:
> 
> ---------8<----------------
> APPL_OBJ := $(DOBJ)\SourceFile.o
> 
> SOURCENAMES = $(addsuffix .c,$(notdir $(basename $(APPL_OBJ))))
> ---------8<----------------
> 
> This makes $(SOURCENAMES) contain:
> SourceFile.c
> 
> All good so far. Now, assume SourceFile.c is located in C:\Source. Is there
> a way to make Gnu Make
> find the path to this file so that I can get a variable containing:
> C:\Source\SourceFile.c ?

I think you want 'vpath'--see example below.

> I am building this on WindowsXP.

Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

C:\opt>type Makefile
vpath %.c /Source

# Note that you don't actually need $(realpath) here:
all: SourceFile.c
        @echo $(realpath $<)
        @echo $<

C:\opt>make
/Source/SourceFile.c
/Source/SourceFile.c

C:\opt>make --version
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 i686-pc-mingw32



reply via email to

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