开发者

How similar/different are gnu make, microsoft nmake and posix standard make?

How similar/different are gnu make, microsoft nmake and posix standard make?

Obviously there's things like "which OS?", "which compiler?" and "which linker?", but I'm referring specifically to the syntax, semantics and command-line options of the makefiles themselves.

If I write makefiles based on manuals for gnu make, w开发者_高级运维hat are the most important portability issues that I need to be aware of?


GNU Make and POSIX Make share a common core so that GNU Make understands makefiles intended for POSIX Make and interprets them the same way - with very few exceptions. However, many GNU Makefiles use features that are only available in GNU Make. Sometimes this is deliberate and conscious; sometimes it isn't (and "sometimes isn't" is a problem). I'm less familiar with Microsoft nmake; I believe it is likely to hew close to the POSIX Make semantics at its core, but it will have its own divergent set of extensions.

Generally speaking, what the programs like autoconf produce are close to portable Makefiles.

The main things to be beware of using GNU Make are all the extended function notations for mapping file names (macros) into useful values. While they are undoubtedly useful, they are also a trap for portability.

The '%.x' notations for suffix rules are not defined by the POSIX specification for make — they are recognized as a common extension:

The interpretation of targets containing the characters '%' and '"' is implementation-defined.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜