ksherlock / mpw

Macintosh Programmer's Workshop (mpw) compatibility layer
238 stars 21 forks source link

Problem with Environment Path Variables #23

Closed jake-b closed 9 years ago

jake-b commented 9 years ago

Having a little weirdness with some paths in the Environment.text file. It could be something obvious or something specific to the Newton C++ Toolkit (ARMCpp) but I figure I'd mention it here. (Or it could be me)

I have the following paths in Environment.text:

Includes=${MPW}Interfaces:
NCT_Includes=${MPW}Interfaces:Includes:

I am trying to use mpw with ARMCpp and a series of include search paths (note this variable eventually gets included as a parameter to the compiler tool):

CPlusIncludes       =   \
    -i "{NCT_Includes}" \
    -i "{NCT_Includes}Frames:" \
    -i "{NCT_Includes}Utilities:" \
    -i "{NCT_Includes}CLibrary:"

What's odd is that first search path doesn't seem to work. I added some debug statements in MacToUnix() and found that mpw is expanding this first search path to:

 :{NCT_Includes}:NewtonScript.h

Resulting in a path of:

 usr/local/share/mpw/Interfaces/Includes/../NewtonScript.h

If I replace that first search path with -i "{Includes}Includes:" (which should expand to the same thing, unless I'm missing something silly) it works as expected. All other search paths seem to work. Seems to be isolated to when a search path is a single token.

Not sure why this is. I did some poking around, but didn't see anything obvious. Still poking around to do, since I'm not familiar with the lexer syntax.

Anyhow thanks.

ksherlock commented 9 years ago

Try using "{NCT_Includes}.:" so ARMcpp won't add an extra : to the path. Metrowerks compilers have a similar problem so I'd like to find après elegant fix someday.

On Wednesday, January 28, 2015, jake-b notifications@github.com wrote:

Having a little weirdness with some paths in the Environment.text file. It could be something obvious or something specific to the Newton C++ Toolkit (ARMCpp) but I figure I'd mention it here. (Or it could be me)

I have the following paths in Environment.text:

Includes=${MPW}Interfaces: NCT_Includes=${MPW}Interfaces:Includes:

I am trying to use mpw with ARMCpp and a series of include search paths (note this variable eventually gets included as a parameter to the compiler tool):

CPlusIncludes = \ -i "{NCT_Includes}" \ -i "{NCT_Includes}Frames:" \ -i "{NCT_Includes}Utilities:" \ -i "{NCT_Includes}CLibrary:"

What's odd is that first search path doesn't seem to work. I added some debug statements in MacToUnix() and found that mpw is expanding this first search path to:

:{NCT_Includes}:NewtonScript.h

Resulting in a path of:

usr/local/share/mpw/Interfaces/Includes/../NewtonScript.h

If I replace that first search path with -i "{Includes}Includes:" (which should expand to the same thing, unless I'm missing something silly) it works as expected. All other search paths seem to work. Seems to be isolated to when a search path is a single token.

Not sure why this is. I did some poking around, but didn't see anything obvious. Still poking around to do, since I'm not familiar with the lexer syntax.

Anyhow thanks.

— Reply to this email directly or view it on GitHub https://github.com/ksherlock/mpw/issues/23.

jake-b commented 9 years ago

Thanks for the reply. Adding a .: does work as expected. I'll add a comment in the Makefile explaining why the extra bit is necessary. Thanks for the prompt response!

ksherlock commented 9 years ago

I've updated the environment expansion logic so : after a variable won't accidentally expand to ::

42fe265dd2c4e6b4689ab14eaecaeebd1820da6b

jake-b commented 9 years ago

Thanks for this. Works as expected now.