[fpc-devel]Fix for Make / Error with space in PATH env var

igdfpc at igdsoftware.com igdfpc at igdsoftware.com
Mon Jun 28 03:13:38 CEST 2004


I originally posted this to fpc-pascal but didn't get much of a response. 
The problem where having spaces in the environmental variable will error
out the Make process has been described.

Here is a work around I came up with:

It seems to work on my system.  Could someone check this out and add to
code base if okay?

Open Lazarus\Designer\Makefile
Find this text:

override PATH:=$(subst \,/,$(PATH))
ifeq ($(findstring ;,$(PATH)),)
inUnix=1
SEARCHPATH:=$(filter-out .,$(subst :, ,$(PATH)))
else
SEARCHPATH:=$(subst ;, ,$(PATH))
endif
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)

Replace with:

override PATH:=$(subst \,/,$(PATH))
# Empty variable
E :=
# Variable containing one space (space char between two empty vars) S :=
$E $E
# TEMPPATH is a variable contained the PATH environmental var with spaces
replaced with "*"
TEMPPATH:=$(subst $S,*,$(PATH))
# now, delimeters for directory names (:,;) are replaced with spaces ifeq
($(findstring ;,$(TEMPPATH)),)
inUnix=1
SEARCHPATH:=$(filter-out .,$(subst :, ,$(TEMPPATH)))
else
SEARCHPATH:=$(subst ;, ,$(TEMPPATH))
endif
# now, add the suffix "/pwd.exe" to the end of each space-delimted word in
the path
TEMPPWD:=$(addsuffix /pwd.exe, $(SEARCHPATH))
# change *'s back to spaces before continuing
TEMPPWD:=$(subst *, ,$(TEMPPWD))
PWD:=$(firstword $(wildcard $(TEMPPWD)))
ifeq ($(PWD),)
TEMPPWD:=$(addsuffix /pwd, $(SEARCHPATH)))
TEMPPWD:=$(subst *, ,$(TEMPPWD))
PWD:=$(firstword $(wildcard $(TEMPPWD)))
ifeq ($(PWD),)
$(error You need the GNU utils package to use this Makefile)





More information about the fpc-devel mailing list