制作而不运行任何食谱

时间:2016-09-26 18:10:37

标签: makefile gnu-make

考虑以下非常愚蠢的makefile:

# makefile
foo :
    @$(MAKE) -C other
# other/makefile
bar :
    @echo HELLO

没什么复杂的。当我运行$make时,我得到了预期的结果:

$ make
make[1]: Entering directory `[...]/other'
HELLO
make[1]: Leaving directory `[...]/other'

但是,当我运行make -pn时,我的输出带有:

# GNU Make 3.82
# Built for x86_64-redhat-linux-gnu
# Copyright (C) 2010  Free Software Foundation, Inc.
# License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
# This is free software: you are free to change and redistribute it.
# There is NO WARRANTY, to the extent permitted by law.
make -C other
# GNU Make 3.82
# Built for x86_64-redhat-linux-gnu
# Copyright (C) 2010  Free Software Foundation, Inc.
# License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
# This is free software: you are free to change and redistribute it.
# There is NO WARRANTY, to the extent permitted by law.
# make[1]: Entering directory `[...]/other'
echo HELLO

为什么make-pn的递归调用?我认为配方不应该被调用。如何让make转储完整的规则数据库,而不运行任何

1 个答案:

答案 0 :(得分:3)

几乎仅限链接的简短回答是Set objExcel = CreateObject("Excel.Application") 'Bind to the Excel object objExcel.Workbooks.Add 'Create a new workbook. Sheet = 1 'Select the first sheet Set objSheet = objExcel.ActiveWorkbook.Worksheets(Sheet) 'Bind to worksheet. objSheet.Name = "InfoBook" 'Name the worksheet strExcelPath = "c:\scripts\InfoBook.xlsx" 'Set the save location objSheet.Range("A1:C1").Font.Bold = True objExcel.Columns(3).AutoFit() objSheet.Cells(1, 1).Value = "Date" 'Row 1 Column 1 (A) objSheet.Cells(1, 2).Value = "Time" 'Row 1 Column 2 (B) objSheet.Cells(1, 3).Value = "Category" 'Row 1 Column 3 (C) objExcel.ActiveWorkbook.SaveAs strExcelPath objExcel.ActiveWorkbook.Close objExcel.Application.Quit 变量及其在配方行中的外观由GNU Make treated specially构成:

  

&#34;包含MAKE的配方行正常执行,尽管存在导致大多数食谱无法运行的标志。&#34;

正在执行该配方行,因为它包含MAKE。尝试添加其他种类的食谱线;你会看到他们没有被处决。

正如您所看到的,这是有充分理由的。由于您使用递归调用的多个不相交的makefile来组织项目,而不是一个大的规则库,为了查看&#34;完整的规则数据库&#34;,您实际上必须递归处理所有的makefile。仅来自顶级$(MAKE)的规则不是完整的规则数据库。