Find the answer to your Linux question:
Page 1 of 2 1 2 LastLast
Results 1 to 10 of 13
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 ...
  1. #1
    Just Joined!
    Join Date
    Aug 2007
    Posts
    8

    Question makefile 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 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!

  2. #2
    Linux Engineer Kieren's Avatar
    Join Date
    Aug 2007
    Location
    England
    Posts
    845
    Try using a \ before each space character. For instance:

    Code:
    C:\Documents\ and\ Settings\

  3. #3
    Super Moderator MikeTbob's Avatar
    Join Date
    Apr 2006
    Location
    Texas
    Posts
    7,144
    Kieren, is correct. Use the dir command to see exactly what's going on.
    I do not respond to private messages asking for Linux help, Please keep it on the forums only.
    All new users please read this.** Forum FAQS. ** Adopt an unanswered post.

  4. #4
    Just Joined!
    Join Date
    Aug 2007
    Posts
    8
    I know that but problem is that i dont know what path is it going to be
    i am using in code relative paths to the file position like
    ../../linux2.6.10 ../build and so on
    so when building project command make -c in makefile calls $$(pwd) aply to it ../../linux2.6.10 and do make all in linux2.6.10/Makefile.

    so i dont type anywhere apsolyte paths only using $$(pwd) on few places

    command that makes error is

    $(MAKE) -C .../../linux-2.6.10/ [options] M=$(FILEDIR)

    filedir = path to the file where this command is, it is found by '$$(pwd)'

    anything else

  5. #5
    Linux Engineer Kieren's Avatar
    Join Date
    Aug 2007
    Location
    England
    Posts
    845
    As found in http://tldp.org/LDP/abs/html/string-manipulation.html

    Code:
    stringZ=abcABC123ABCabc
    
    echo ${stringZ/abc/xyz}           # xyzABC123ABCabc
                                      # Replaces first match of 'abc' with 'xyz'.
    
    echo ${stringZ//abc/xyz}          # xyzABC123ABCxyz
                                      # Replaces all matches of 'abc' with # 'xyz'.
    So you would use something like:

    Code:
    ${$(FILEDIR)// /\}
    ?

  6. #6
    Just Joined!
    Join Date
    Aug 2007
    Posts
    8
    could work I will try

    should it look maybe like this

    ${$(FILEDIR)// /\ }
    with one space at end cause I am replacing ' ' with '\ ' ?

    thanks alot

    sorry how to put that code field in msg?

  7. #7
    Linux Engineer Kieren's Avatar
    Join Date
    Aug 2007
    Location
    England
    Posts
    845
    Yes, you need the space at the end, I missed it out.

    To format your code wrap it in:

    [code]Some code[code]

  8. #8
    Just Joined!
    Join Date
    Aug 2007
    Posts
    8
    thanks




  9. #9
    Just Joined!
    Join Date
    Aug 2007
    Posts
    8
    it 's not working

    cause it transforms something like "/usr/local/......................" to " "
    it seems like it doesn't work in makefiles

    i try it more tommorow.

  10. #10
    Linux Engineer Kieren's Avatar
    Join Date
    Aug 2007
    Location
    England
    Posts
    845
    Hmm, what about something like:

    Code:
    ${$(FILEDIR)//\ /\\\ }
    ?

Page 1 of 2 1 2 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...