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

igdfpc at igdsoftware.com igdfpc at igdsoftware.com
Sat Jun 26 15:28:58 CEST 2004


The problem where having spaces in the environmental variable will error
out the make process has been described.  I propose the following work
around:

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)

This seems to work fine for me over here.







More information about the fpc-pascal mailing list