【编译工具】几种常用make的介绍和分析(gmake,nmake,cmake,dmake,bmake)
DATE:2018.12.21
1、參考
http://www.it610.com/article/2154508.htm
https://blog.csdn.net/tsaiyong_ahnselina/article/details/17554337
https://en.wikipedia.org/wiki/Make_(software)
2、幾種常用make的介紹
1). gmake: GNU make,也是Linux/Unix系統下通用的make
2). bmake:BSD make,freebsd系統自帶的make是BSD make。
3). dmake:是同GNU Make類似的一個工具。其命令格式自成一體,但是可以適用于Linux, Solaris, and Win32 and other platforms。Dmake有一個變種,被OpenOffice.org使用。dmake 是一個命令行工具,與 make(1) 兼容。dmake 能夠以網格、分布、并行或串行模式生成目標。如果使用的是標準 make(1) 實用程序,在對 makefile 進行任何更改時可以毫不費力地過渡到使用 dmake。dmake 是 make 實用程序的超集。
4). nmake: Windows系統下自帶的make,一般在$(VCInstallDir)/bin目錄下面。
5).cmake: CMake是一個跨平臺的安裝(編譯)工具,可以用簡單的語句來描述所有平臺的安裝(編譯過程)。他能夠輸出各種各樣的makefile或者project文件,能測試編譯器所支持的C++特性,類似UNIX下的automake。只是 CMake 的組態檔取名為 CMakeLists.txt。Cmake 并不直接建構出最終的軟件,而是產生標準的建構檔(如 Unix 的 Makefile 或 Windows Visual C++ 的 projects/workspaces),然后再依一般的建構方式使用。這使得熟悉某個集成開發環境(IDE)的開發者可以用標準的方式建構他的軟件,這種可以使用各平臺的原生建構系統的能力是 CMake 和 SCons 等其他類似系統的區別之處。
詳細參考:https://en.wikipedia.org/wiki/Make_(software)
3、GNU make與Windows Nmake的異同點
參考自:https://blog.csdn.net/tsaiyong_ahnselina/article/details/17554337
3.1、自動變量的區別
| GNU make的自動變量 | Windows Nmake自動變量 |
|---|---|
| $@:The file name of the target of the rule. | |
| $%: The target member name, when the target is an archive member. | $(@): Current target’s full name (path, base name, extension), as currently specified. |
| $$@ | $$@: Current target’s full name (path, base name, extension), as currently specified. Valid only as a dependent in a dependency. |
| $*: 這個變量表示目標模式中"%"及其之前的部分 (少用) | $*: Current target’s path and base name except file extension. |
| $?: The names of all the prerequisites that are newer than the target, with spaces between them. | |
| $^: The names of all the prerequisites, with spaces between them. | |
| $|: The names of all the order-only prerequisites, with spaces between them. | $?: All dependent files in the dependency with a later timestamp than the target |
| $**: All dependents of the current target. | |
| $<: The name of the first prerequisite. If the target got its recipe from an implicit rule, this will be the first prerequisite added by the implicit rule | $<: Dependent file with a later timestamp than the current target. Valid only in commands in inference rules. |
3.2、內置宏的一些區別
NMAKE GNU MAKE
========== ==============
!MESSAGE hello world $(info hello world)
!ERROR message $(error message)
!INCLUDE filename include filename
$(MAKEDIR) $(CURDIR)
$(@D) $(@D:=)
$(@F) $(@F)
$(@B) $(basename $(@F))
$(@R) $(basename $@)
$(var:find=replace) $(subst find,replace,$(var))
!IF "a" == "b" (also !=) ifeq (a, b) (also ifneq)
... ...
!ELSE else
... ...
!ENDIF endif
!IFDE var (also !IFNDEF) ifdef var (also ifndef)
... ...
!ELSE else
... ...
!ENDIF endif
!IF EXIST("filename") ifeq ($(wildcard filename), filename) (NOTE: Case-sensitive!)
... ...
!ELSE else
... ...
!ENDIF endif
doit: define runit_cmd
@echo <<runit.cmd >nul ...$(1), $(2), $(3),...
...%1,%2,%3,... endef
<< doit:
@call runit.cmd x y z $(call runit_cmd, x, y, z)
THE END!
總結
以上是生活随笔為你收集整理的【编译工具】几种常用make的介绍和分析(gmake,nmake,cmake,dmake,bmake)的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 关于学习的时间定律-21小时、1000小
- 下一篇: 给ubuntu的docky添加可以直接打