Menu

Appending with spaces in the directory path

Help
Dan Smith
2005-01-24
2013-03-15
  • Dan Smith

    Dan Smith - 2005-01-24

    I am using cygwin (gave up on ActivePerl) and am running into this little problem:

    VisualStudioRoot := "c:\Program Files\Microsoft Visual Studio\VC98"

    CPPCompiler := $(VisualStudioRoot)\cl.exe

    This expands to:
    "c:\Program\cl.exe Files\Microsoft\cl.exe Visual\cl.exe Studio\VC98\cl.exe".

    The best I can tell, the 'CPPCompiler' assignment statement thinks that 'VisualStudioRoot' is an array because of the spaces and is placing 'cl.exe' after every space.
    Can I tell the addsuffix command NOT to do this?  Or do I need to do 'c:\Progra~1\...'?

    Thanks
    Dan

     
    • Gary Holt

      Gary Holt - 2005-01-24

      You need to turn off rc-style expansion.  Put a line like this somewhere near the beginning of your makefile (before any expansions that involve spaces):

      rc_substitution := 0

      Alternatively, you can use the command line argument --norc-substitution to apply it to all makefiles.

       
    • Dan Smith

      Dan Smith - 2005-01-24

      can I do the following?

      # turn rc_substitution off
      rc_substitution := 0

      do my replacement stuff
      ...

      # turn rc_substitution back on
      rc_substitution := 1

       
      • Gary Holt

        Gary Holt - 2005-01-24

        One problem with this is that you have to have rc_substitution off during the time when it will cause problem.  This is not easy to do because the actions and dependency strings are evaluated when the action is needed, not when it is parsed.

        The rules for evaluation time are:

        1. Target strings are evaluated when they are first seen.

        2. Dependencies and actions are evaluated only when makepp decides it needs to build the target.

        3. If you use := for assignment, then the evaluation occurs right then; if you use just regular =, it occurs when the variable is actually referenced, which is hard to control.

        So if you do your replacement stuff using the := operator, then it's probably ok to turn rc_substitution off and back on in the same makefile.  Otherwise I'm afraid you may run into difficulties with the evaluation time.

        I think makepp needs a better design for this, but so far we haven't really addressed this issue.

         

Log in to post a comment.

MongoDB Logo MongoDB