LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   makefiles with spaces in path (https://www.linuxquestions.org/questions/programming-9/makefiles-with-spaces-in-path-580381/)

teuf 08-28-2007 07:22 AM

makefiles with spaces in path
 
need help about building make file that has spaces in path name

like Documents and setings, my folder........

problem arise in comands like

make -c ../linux ................M='current position'
and it makes makefile error536 no such file or directory cause it splits path in two parts
before space in name and after the space.
something like
entering directory 'c:/documents' no such.....
entering directory 'setings/something/somenthig...' no such .........

problem is that -c calls $$(pwd) somewhere and than aply it to M to find ../linux
so how to make that path looks okay
i can put " " on other $$(pwd) in other make files and that works okay but what to do whith this make -C????
any ideas how to solve this?
please don't answer like don't put spaces in names of folders. it supposed to work in situations like that!

MensaWater 08-28-2007 10:34 AM

Don't put spaces...

Just kidding.

You may need to do something like quote and escape.

e.g. "\""space file"\""

The first set of quotes is to quote the backslash - the backslace is to escape the quote - you repeate it for each quote you need for 'space file'. I once had to do something bizarre like that to get an rsync I was doing to work. You may not need all of above - the double quote may work where you r single quote didn't.

This happens because some things treat the " as a literal whereas others treat is a quoting and same for backslash. On running it strips out everything so you get a literal "space file" passed in rather than space and file.

teuf 08-28-2007 10:44 AM

problem is also that most of commands in makefile are like

install_lib= some options "$(pwd)/build";

is there a way to change a ' ' to '\ ' after pwd

i found something for strings like:

${$(DIR)// /\ } it should replace ' ' with '\ ' but for some reason
it replaces entire adress with " " and thats not what i want :)

thanks :)

teuf 08-29-2007 03:06 AM

thanks all on your help but i have decided not to go on with this
cause it is normal thing on linux not to make spaces in paths, folder names,
i will maybe later try make that this aplication works and on paths with spaces but not now at the momment cause of deadline for project.


thank again to all of you on your help :)

bigearsbilly 08-29-2007 03:45 AM

I have tried extensively in the past.
I tried all sorts of quoting and escaping.

I'm not sure if make can really handle it at all, I gave up too.

MensaWater 08-29-2007 08:29 AM

Sort of glad to hear it. Two things that rather annoy me about Oracle:
1) They actually create directories named "core".
2) They make many files with spaces in the name.

Number 1 caused issues because many people used to run cron jobs to automatically delete core files (memory dumps of failed programs).

Number 2 makes us have to do special quoting and escaping in scripts that really ought not to be necessary like the rsync example I mentioned above.

Funny - I was downloading pictures from my sister's Sony digital camera to my Windoze laptop and she asked why I named the directory with underscores between the words. I explained that God didn't intend for files to have spaces in their names. :rolleyes:

ta0kira 08-29-2007 12:41 PM

I think I misunderstand what the problem is. Do you mean make -C capital? As in make -C C:/"Documents and Settings"/yourname? That works fine for me. Are you talking about calling make -C for subdirs with spaces in their names? Can you post a short makefile and the command line you use to call it? I'm glad you decided on the non-space method, but I'm still curious about the problem.
ta0kira

teuf 08-30-2007 03:04 AM

@ta0kira: yes

but it is like this

Code:

$(MAKE) -C ../../linux-2.6.10 M='$$(pwd)' V=1
but nevermind it's not important any more :)


All times are GMT -5. The time now is 12:35 AM.