Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2004-06

Fix for Make / Error with space in PATH env var

1 message · 1 person ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Unknown author

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.