delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/12/09/10:30:33

Date: Wed, 9 Dec 1998 17:05:25 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
X-Sender: eliz AT is
To: Jeff Williams <jeffw AT darwin DOT sfbr DOT org>
cc: djgpp AT delorie DOT com
Subject: Re: Environment variables with BASH
In-Reply-To: <199812091341.HAA06690@kendall.>
Message-ID: <Pine.SUN.3.91.981209165703.10851E-100000@is>
MIME-Version: 1.0
Reply-To: djgpp AT delorie DOT com

On Wed, 9 Dec 1998, Jeff Williams wrote:

> There is one problem, however, that I can't seem to fix by fiddling with the
> bash environment variables: a colon-delimited directory list in makefiles
> (e.g., in a vpath statement) will not be recognized, even if PATH_SEPARATOR=:
> For some reason I must use semicolons (or spaces).

The reason for this is that VPATH and vpath are processed by Make itself, 
and Make doesn't know anything about PATH_SEPARATOR.  That feature is
unique to Bash.

Obviously, you cannot use a colon in DOS-style VPATH/vpath variables, 
since they can legitimately include drive letters.

> Is it possible to use colon-delimited directory lists in makefiles (vpath
> and elsewhere) under bash simply by setting the environment variables
> appropriately, or will I need in this case to resort to the OS-dependent
> separator as you described?

One portable way to handle this nuisance is to say this in the Makefile:

  ifneq ($(COMSPEC),)
  sep = ;
  else
  sep = :
  endif

and then use $(sep) in VPATH and vpath.  (You might need to handle the 
blanks around the colon and semi-colon, I'm not sure.)

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019