Jump to content

Talk:GNU Make

From EDM2

Personally I prefer GNU Make to the IBM provided NMAKE mostly because it is much more flexible if it comes to defining and manipulating macros.

Slashes handling

One major problem with this kind of Unix tools on OS/2 is the / (forward slash) and \ (backslash) handling:

  • On Unix systems the case is simple: / separates directory names in paths (full file names), while \ is used as an "escape" character for inserting special codes into strings, like \t for a TAB etc.
  • With OS/2 (like DOS and Windows) \ is the directory name separator character in paths, but Unix tools still interpret it as an "escape" character.

Two possible solutions:

  • In order to include a \ in a string just duplicate it: "C:\\Data\\File.dat". The problem is that it has to be duplicated for any instance of a Unix tool "touching" that string, so maybe you even need four or eight backslashes in order to get one at the end! In many cases only trial and error will bring you to a working make file - not very comfortable at all!
  • Using / as directory separator is not forbidden in OS/2 either, so the much simpler solution is to switch to always using / instead of \. However, even though this is OS/2 standard in principle, it still doesn't work for all tools that may be called from the make file!

My own preferred solution is: Use / instead of \ everywhere, and use a conversion macro from / to \\ when generating parameter lists for tools that would misinterpret / characters in their command lines.

Handling of long command lines

Complex projects may result in very long command lines being generated by the make tool, but the standard OS/2 command line interpreter (CMD.EXE) is only able to "digest" something like 1000 characters. In order to overcome that limitation I replaced CMD.EXE by the "32-bit Command Line Interpreter" by Jonathan deBoyne Pollard (Freeware) which can be obtained from [1].