Sunday, June 26, 2011

nmake postbuild.mak visual studio command failure backslash missing trailing space

one important contribution to programmers life from microsoft are the backslash path separators.

A really nice example of why this is so brain dead I discovered using Microsofts own  nmake tool which can be integrated into visual studio.

For example, if you use a rule like below and you forget to put a space behind the trailing backslash
suddenly the smart nmake semantics decides to use the backslash as a line continuation causing a syntax error.
As a trailing space is clearly not visible this is a nasty ditch to fall into.

Thanks Microsoft for such a smart choice for the path separator.

CopyFdoComponentsDebug : ..\..\..\Oem\FDO\*.*
    if NOT EXIST ..\..\bin\debug\FDO\nul mkdir ..\..\bin\debug\FDO
    if EXIST ..\..\..\Oem\FDO\bin\Release xcopy /r /d /y /s ..\..\..\Oem\FDO\bin\Release ..\..\bin\debug\FDO\[space] 
    if EXIST ..\..\..\Oem\FDO\bin\Debug xcopy /r /d /y /s ..\..\..\Oem\FDO\bin\Debug ..\..\bin\debug\FDO\

No comments: