[Top][All Lists]

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

[bug #712] GNU make can't handle spaces in pathnames

From: Jian
Subject: [bug #712] GNU make can't handle spaces in pathnames
Date: Wed, 27 Feb 2013 04:55:13 +0000
User-agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.97 Safari/537.22

Follow-up Comment #12, bug #712 (project make):

What's a pity the bug/limitation has lasted more than 10 years! I'd like to
share my workaround here.

1. Replace all space by "+" before calling make functions and restore before
the real procssing logic, e.g.
SRC_NOSP=AA+Mgr/cpp1.cpp AA+Mgr/cpp2.cpp
$(info total $(words $(SRC_NOSP)) source files!)

OBJ_NOSP=$(patsubst %.cpp,$(ObjDir)/%.o,$(SRC_NOSP))
SRC=$(subst +, ,$(SRC_NOSP))
OBJ=$(subst +, ,$(OBJ_NOSP))

all: $(OBJ)

2. As shell supports space by quote or escape, you can choose to use shell
commands. And if necessary you can write your own script to handle words.
Don't use:
 File=AA Mgr/cpp1.cpp
 SrcDir=$(dir $(File))
 SrcDir=$(shell dirname '$(File)')

3. use quotes when you call shell
Src=AA Mgr/cpp1.cpp
%.o: %.cpp
   c++ '$<' -o '$@'

However, I wonder why supporting space breaking the compatibility if space is
escaped by ''? Was '' used as common char on old system? 

And how about the tradeoff that making new flag/switch to keep compatibility?

I'm looking forwards to the fix of this bug.



Reply to this item at:


  Message sent via/by Savannah

reply via email to

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