nmake学习笔记2

makefile中的“@<<”看起来很奇怪,查很多地方都没有结果。写了两个示例比较其结果:

如果makefile如下:

All:main.obj func.obj
    link $**
.cpp.obj:
    cl /c $<
    
clean:
  erase *.obj
  erase *.exe

输出为:

Microsoft (R) Program Maintenance Utility   Version 6.00.9782.0
Copyright (C) Microsoft Corp 1988-1998. All rights reserved.

        cl /c main.cpp
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 12.00.8804 for 80x86
Copyright (C) Microsoft Corp 1984-1998. All rights reserved.

main.cpp
        cl /c func.cpp
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 12.00.8804 for 80x86
Copyright (C) Microsoft Corp 1984-1998. All rights reserved.

func.cpp
        link main.obj func.obj
Microsoft (R) Incremental Linker Version 6.00.8447
Copyright (C) Microsoft Corp 1992-1998. All rights reserved.

在makefile中加入“@<<”,代码如下:

All:main.obj func.obj
    link $**
.cpp.obj:
    cl @<<
/c $<
<<
    
clean:
  erase *.obj
  erase *.exe

输入出:

Microsoft (R) Program Maintenance Utility   Version 6.00.9782.0
Copyright (C) Microsoft Corp 1988-1998. All rights reserved.

        cl @C:UsersADMINI~1AppDataLocalTemp
ma15980.
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 12.00.8804 for 80x86
Copyright (C) Microsoft Corp 1984-1998. All rights reserved.

cl /c main.cpp

main.cpp
        cl @C:UsersADMINI~1AppDataLocalTemp
mb15980.
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 12.00.8804 for 80x86
Copyright (C) Microsoft Corp 1984-1998. All rights reserved.

cl /c func.cpp

func.cpp
        link main.obj func.obj
Microsoft (R) Incremental Linker Version 6.00.8447
Copyright (C) Microsoft Corp 1992-1998. All rights reserved.
原文地址:https://www.cnblogs.com/licb/p/nmake.html