java make[1]:输入目录错误信息

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/9967392/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-30 23:06:05  来源:igfitidea点击:

make[1]: Entering directory error message

javamakefile

提问by noobler

I have a simple Makefile:

我有一个简单的 Makefile:

default:
    @make build
    @make run

build:
    @javac Test.java > /dev/null

run:
    @java Test

During compilation, make outputs:

在编译期间,输出:

make[1]: Entering directory `<current directory'>
...
make[1]: Leaving directory `<current directory'>

I need make to build without printing these messages. Does anybody know what the problem or how to suppress these messages?

我需要在不打印这些消息的情况下进行构建。有谁知道问题是什么或如何抑制这些消息?

Thanks

谢谢



edit: this happens regardless of the code. e.g. it happens with:

编辑:无论代码如何,都会发生这种情况。例如它发生在:

class Test {

    public static void main(String[] args) {
        System.out.println("HELLO WORLD");
    }
}

回答by manav m-n

make -ssuppresses other makefile messages also which might be important for developers. If you want to suppress "Entering/Leaving directory messages" only run makewith

make -s抑制其他可能对开发人员很重要的 makefile 消息。如果要抑制“进入/离开目录的消息”只运行make

make --no-print-directory

make --no-print-directory

回答by Beta

Change maketo make -s:

更改makemake -s

default:
    @make -s build
    @make -s run

Better still:

更好的是:

default:
    @$(MAKE) -s build
    @$(MAKE) -s run

Even better:

更好的是:

default: run

build:
    @javac Test.java > /dev/null

run: build
    @java Test