如何使makefile中的目标调用makefile中的另一个目标 [英] How do I make a target in a makefile invoke another target in the makefile

查看:1204
本文介绍了如何使makefile中的目标调用makefile中的另一个目标的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我有这个makefile,我想目标所有只是调用目标专家,但显然我的做法是错误的,因为我得到错误
make:exprtest:Command not发现
make: * [all]错误127

这是makefile:

So I have this makefile and I want the target all just to invoke the target expertest, but apparently the way I'm doing it is wrong because i'm getting the error "make: exprtest: Command not found make: * [all] Error 127 " this is the makefile:

all:
    exprtest
exprtest: exptrtest.o driver.o parser.tab.o scanner.o
    g++ -Wall -g -o exprtest exptrtest.o driver.o parser.tab.o scanner.o
driver.o: driver.cpp scanner.hpp driver.hpp
    g++ -Wall -g -c driver.cpp
parser.tab.o: parser.tab.hpp parser.tab.cpp
    bison parser.ypp
    g++ -Wall -g -c parser.tab.cpp
scanner.o: scanner.cpp scanner.hpp
    flex -t scanner.ll > scanner.cpp
    g++ -Wall -g -c scanner.cpp
clean:
    rm parser.tab.hpp parser.tab.cpp scanner.cpp


推荐答案

exprtest all 。依赖关系在冒号之后,命令来自下面的行,缩进。

Put exprtest on the same line as all. Dependencies come after the colon, commands come on the following lines, indented.

target: dependencies
[tab] system command

所以在你的情况下这一切都变成:

So in your case it all becomes:

all: exprtest
exprtest: exptrtest.o driver.o parser.tab.o scanner.o
    g++ -Wall -g -o exprtest exptrtest.o driver.o parser.tab.o scanner.o

这篇关于如何使makefile中的目标调用makefile中的另一个目标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆