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

2013-02-26 Thread Jian
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.
e.g. 
Don't use:
 File=AA Mgr/cpp1.cpp
 SrcDir=$(dir $(File))
insteads,
 SrcDir=$(shell dirname '$(File)')

3. use quotes when you call shell
e.g. 

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.

Jian

___

Reply to this item at:

  <http://savannah.gnu.org/bugs/?712>

___
  Message sent via/by Savannah
  http://savannah.gnu.org/


___
Bug-make mailing list
Bug-make@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-make


[bug #38437] cannot find the include file

2013-02-27 Thread Jian
URL:
  

 Summary: cannot find the include file
 Project: make
Submitted by: skyshore
Submitted on: Thu 28 Feb 2013 04:55:23 AM GMT
Severity: 3 - Normal
  Item Group: Bug
  Status: None
 Privacy: Public
 Assigned to: None
 Open/Closed: Open
 Discussion Lock: Any
   Component Version: 3.82
Operating System: POSIX-Based
   Fixed Release: None
   Triage Status: None

___

Details:

Supposing 2 makefiles in dir A: 1.mak, 2.mak, and 1.mak include 2.mak.
Now in dir B, 3.mak includes 'A/1.mak' (will auto include 2.mak). But error
shows that 2.mak cannot be found.

The make option "-I" can be the workaround like:
 cd B
 make -f 3.mak -IA

But it's not acceptable to tell user to uses "-I" to make every time. make
shall be able to find 2.mak.





___

Reply to this item at:

  

___
  Message sent via/by Savannah
  http://savannah.gnu.org/


___
Bug-make mailing list
Bug-make@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-make


[bug #38437] cannot find the include file

2013-02-28 Thread Jian
Follow-up Comment #2, bug #38437 (project make):

(just paste the mail with solution here for your reference)

Thanks Philip. It works for me, and now I can distribute my makefiles into
different path.

However, I still hope it can be improved as the expreience of C/C++ tells us
it shall be able to. When reading a makefile, the path of this file should be
added into the search path automaticallly.



2013/2/28 Philip Guenther 
On Wed, Feb 27, 2013 at 8:55 PM, Jian  wrote:
...
> Supposing 2 makefiles in dir A: 1.mak, 2.mak, and 1.mak include 2.mak.
> Now in dir B, 3.mak includes 'A/1.mak' (will auto include 2.mak). But error
> shows that 2.mak cannot be found.
>
> The make option "-I" can be the workaround like:
>  cd B
>  make -f 3.mak -IA
>
> But it's not acceptable to tell user to uses "-I" to make every time. make
> shall be able to find 2.mak.

So have 1.mak look for 2.mak in the same directory, by doing something like:

# Get the directory part of the path by which 1.mak was included
# This should be before any other includes in 1.mak
dir_of_1 = $(dir $(lastword $(MAKEFILE_LIST)))

...and then later:

# pull in 2.mak in the same directory as this file
include ${dir_of_1}2.mak

___

Reply to this item at:

  <http://savannah.gnu.org/bugs/?38437>

___
  Message sent via/by Savannah
  http://savannah.gnu.org/


___
Bug-make mailing list
Bug-make@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-make


Bug report: Make cannot handle the word or path that contains space

2013-01-29 Thread Liang, Jian
Hi,

Make cannot handle the word or path that contains space.
Here's a sample: (tested on 3.81 and 3.82)
--
INC=aa/hdr bb/hdr cc\ mgr/hdr
INC_FLAG=$(addprefix -I,$(INC))
N=$(words $(INC))

all: test
@echo INC_FLAG="$(INC_FLAG)"
@echo N=$(N)

test: $(INC)
@echo INC="$(INC)"
@echo INC="$^"

%: ;
--

Actual result:
--
INC="aa/hdr bb/hdr cc\ mgr/hdr"
INC="aa/hdr bb/hdr cc mgr/hdr"
INC_FLAG="-Iaa/hdr -Ibb/hdr -Icc\ -Imgr/hdr"
N=4
--

Expected result:
--
INC="aa/hdr bb/hdr cc\ mgr/hdr"
INC="aa/hdr bb/hdr cc\ mgr/hdr"
INC_FLAG="-Iaa/hdr -Ibb/hdr -Icc\ mgr/hdr"
N=3
--

Bug1: most internal function cannot deal with space that is escaped in the word.
Bug2: $^ loses the back-slash.

Best Regards

Liang, Jian

___
Bug-make mailing list
Bug-make@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-make