Use the same makefile for make (Linux) and nmake (Windows)

前端 未结 8 1311
星月不相逢
星月不相逢 2020-12-13 19:26

I have a simple C program (one source file) which I want to compile on Linux and on Windows via make and nmake, respectively. Is there a possibility to accomplish this with

8条回答
  •  遥遥无期
    2020-12-13 20:16

    My solution is to use two different filenames. (since the Makefile name searching priority in different OSes will not be the same)

    For Windows, I use normal "Makefile."

    For Linux, I use the special "GNUmakefile" according to this article.

    So that nmake (Win) will find "Makefile," and make (Linux) will find "GNUmakefile."

提交回复
热议问题