[Top][All Lists]

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

Spacing in environmental variable

From: igdmake
Subject: Spacing in environmental variable
Date: Sun, 20 Jun 2004 21:37:36 -0500 (CDT)
User-agent: SquirrelMail/1.4.3a-0.e3.1

I'm working to improve an open source project that utilizes Make on
Windows systems.  In a nutshell, if the user's PATH environmental variable
contains spaces, the make process errors out.  For example, if the path
contains C:\Program Files\... the make process will choke.  Unfortunately,
it seems almost every Windows system in the world has paths like this.

I posted a section of the Makefile below where I believe an easy
workaround with string manipulation good be added:

override PATH:=$(subst \,/,$(PATH))
ifeq ($(findstring ;,$(PATH)),)
SEARCHPATH:=$(filter-out .,$(subst :, ,$(PATH)))
SEARCHPATH:=$(subst ;, ,$(PATH))
PWD:=$(strip $(wildcard $(addsuffix /pwd.exe,$(SEARCHPATH))))
ifeq ($(PWD),)
PWD:=$(strip $(wildcard $(addsuffix /pwd,$(SEARCHPATH))))
ifeq ($(PWD),)
$(error You need the GNU utils package to use this Makefile, $(PATHH))
PWD:=$(firstword $(PWD))
PWD:=$(firstword $(PWD))

On a Windows box, all semi-colons are replaced with spaces.  Then below
that section, addsuffix adds a path suffix everwhere there is a space. 
The result is something like:

C:\Program\pwd.exe Files\pwd.exe instead of C:\Program Files\pwd.exe.

One possible workaround I was thinking about was to temporarily replace
the spaces with a different character, like TEMPPATH:=$(subst ,*,$(PATH). 
That would replace all spaces with "*" char.  However, subst doesn't seem
to like it if the from string is a space.

I would appreciate any help in this matter.  Solving this little problem
might increase adoption of our software by Windows users:)

reply via email to

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