Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/linux/24.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Linux 用另一个makefile包装GNU makefile_Linux_Compilation_Makefile_Gnu Make - Fatal编程技术网

Linux 用另一个makefile包装GNU makefile

Linux 用另一个makefile包装GNU makefile,linux,compilation,makefile,gnu-make,Linux,Compilation,Makefile,Gnu Make,这是下面的内容 我有Makefile.real(Makefile来自上一篇): 现在我想创建Makefile,它是Makefile.real的简单包装: 它使用与调用时相同的参数调用Makefile.real 它应该打印错误消息idMakefile.real失败 这是我的目标-在并行生成结束时打印错误消息 (见附件) 因此,以下命令应以错误消息终止: make -j1 a b (1) make -j2 a b (2) 我怀疑Makefile应该与以下内容接近: %: $(MAK

这是下面的内容

我有
Makefile.real
Makefile
来自上一篇):

现在我想创建
Makefile
,它是
Makefile.real的简单包装:

  • 它使用与调用时相同的参数调用
    Makefile.real
  • 它应该打印错误消息id
    Makefile.real
    失败 这是我的目标-在并行生成结束时打印错误消息 (见附件)
因此,以下命令应以错误消息终止:

make -j1 a b (1)
make -j2 a b (2)
我怀疑
Makefile
应该与以下内容接近:

%:
      $(MAKE) -f Makefile.real $(MAKECMDGOALS); \
      res=$$?; if [ $$res != 0 ]; then echo "Failed!!!"; fi; exit $$res
问题是对
a
b
分别调用两次目标“%”(2)


有什么想法吗?

这是我最后提出的解决方案

ifneq ($(REAL_MAKE),1)
# run_make will be called once (it's .PHONY target), 
# even if make is called with several targets
%: run_make
        @:

.PHONY: run_make
run_make:
        $(MAKE) $(MAKECMDGOALS) REAL_MAKE=1; \
        if [ $$? -ne 0 ]; then               \
            echo "*** Error ***" >&2;        \
            exit 1;                          \
        fi

else  # REAL_MAKE defined (actual makefile)

### HERE comes original make we want to wrap ###

endif  # # REAL_MAKE defined (actual makefile)

您是否考虑过
包含Makefile.real
?@Beta不知道它如何解决我的问题-我试图克服的是,在并行编译的情况下,make结束时没有错误消息。问题编辑
ifneq ($(REAL_MAKE),1)
# run_make will be called once (it's .PHONY target), 
# even if make is called with several targets
%: run_make
        @:

.PHONY: run_make
run_make:
        $(MAKE) $(MAKECMDGOALS) REAL_MAKE=1; \
        if [ $$? -ne 0 ]; then               \
            echo "*** Error ***" >&2;        \
            exit 1;                          \
        fi

else  # REAL_MAKE defined (actual makefile)

### HERE comes original make we want to wrap ###

endif  # # REAL_MAKE defined (actual makefile)