在学习autotools遇到一个问题:make没有按照VPATH给的目录进行搜索,请大家指导一下。
来源:互联网 发布:从入门到精通java 编辑:程序博客网 时间:2024/05/20 13:05
CSDN的同学们好,在按照autotools一书进行学习时,有遇到make不按照VPATH设定的目录进行搜索的情况,将情况简述如下:
1、目录树如下所示:
.
├── autom4te.cache
│ ├── output.0
│ ├── output.1
│ ├── requests
│ ├── traces.0
│ └── traces.1
├── build
│ ├── config.log
│ ├── config.status
│ ├── jupiter-1.0.tar.gz
│ ├── Makefile
│ └── src
│ └── Makefile
├── configure
├── configure.ac
├── Makefile.in
└── src
├── main.c
└── Makefile.in
4 directories, 15 files
2、在build目录下面进行相应的操作,build/src/Makefile文件的内容为:
# src/Makefile. Generated from Makefile.in by configure.
# Package-specific substitution variables
package = Jupiter
version = 1.0
tarname = jupiter
distdir = $(tarname)-$(version)
# Prefix-specific substitution variables
prefix = /usr/local
exec_prefix = ${prefix}
bindir = ${exec_prefix}/bin
# VPATH-related substitution variables
srcdir = ../../src
VPATH = ../../src
CFLAGS = -g -O0
all: jupiter
jupiter: main.c
$(CC) $(CPPFLAGS) $(CFLAGS) -o $@ main.c
clean:
-rm jupiter
check: all
./jupiter | grep "Hello from .*jupiter!"
@echo "*** ALL TESTS PASSED ***"
install:
install -d $(DESTDIR)$(bindir)
install -m 0755 jupiter $(DESTDIR)$(bindir)
uninstall:
-rm $(DESTDIR)$(bindir)/jupiter
Makefile: Makefile.in ../config.status
cd .. && ./config.status src/$@
../config.status: ../configure
cd .. && ./config.status --recheck
.PHONY: all clean check install uninstall
3、如2所示编译main.c的命令为:
$(CC) $(CPPFLAGS) $(CFLAGS) -o $@ main.c
VPATH被赋值为: ../../src
真正的main.c文 件是../../src/main.c按照VPATH的设置应该是可以找到main.c的,但我在make jupiter的时候,却遇到了错误输出,输出的信息为:
cd src && make jupiter
make[1]: 正在进入目录 `/home/BTN/BTN/autotools/jupiter/build/src'
cc -g -O0 -o jupiter main.c
cc: error: main.c: 没有那个文件或目录
cc: fatal error: no input files
compilation terminated.
make[1]: *** [jupiter] 错误 4
make[1]:正在离开目录 `/home/BTN/BTN/autotools/jupiter/build/src'
make: *** [jupiter] 错误 2
4 请教一下大家,这个问题是什么原固导致的,又要怎样解决?谢谢。
20150128143800:
我后来,在网络上面搜索,没有看到直接关于这个问题的描述,但有一个类似的,在一个博客中看到有说他依懒的一个文件说没有找到,将依懒的文件换成$<就可以了,他的理解是make有对$<展开,而没有对直接写出来文件名的进行扩展,所以我的修改是:
将 $(CC) $(CPPFLAGS) $(CFLAGS) -o $@ main.c换为:
$(CC) $(CPPFLAGS) $(CFLAGS) -o $@ $^
成功。
Hello John Calcote:
You can call me BTNZ, I'm Chinese. My English is not good, I have to rely on a translator to communicate with you. I follow the example of your book which title is "AutoTools A Practitioner's Guide to GNU Autoconf, Automake, and Libtool". At page of 70 I got a problem it's about VPATH, I added srcdir = @srcdir@ and VPATH = @srcdir@ into jupiter/src/Makefile.in then executive ../configure in the "build" directory, it generate several file and directory under "build" directory, I typed "make jupiter" and Enter but the output information of the terminal is:
BTN@BT:~/BTN/autotools/jupiter/build$ make jupiter
cd src && make jupiter
make[1]: 正在进入目录 `/home/BTN/BTN/autotools/jupiter/build/src'
cc -g -O0 -o jupiter main.c
cc: error: main.c: 没有那个文件或目录
cc: fatal error: no input files
compilation terminated.
make[1]: *** [jupiter] 错误 4
make[1]:正在离开目录 `/home/BTN/BTN/autotools/jupiter/build/src'
make: *** [jupiter] 错误 2
BTN@BT:~/BTN/autotools/jupiter/build$
I checked jupiter/build/src/Makefile check the command of "make jupiter" it is: $(CC) $(CPPFLAGS) $(CFLAGS) -o $@ main.c, I search on the web and find the right solution, it is: $(CC) $(CPPFLAGS) $(CFLAGS) -o $@ $^
I send this email to let you know how this thing.
Thank you.
- 在学习autotools遇到一个问题:make没有按照VPATH给的目录进行搜索,请大家指导一下。
- 有问题 请大家一句话指导一下
- 遇到的一个问题和大家分享一下
- 大家指导一下shellcode问题
- 将保存在数据库中的图片信息生成缩略图的问题,请大家指导!
- 大家好,我是新手,请大家指导一下
- 导师给的题目,大家有没有好的解决方案,指导指导
- java -- 写时间的时候遇到一个问题,大家有没有遇到过
- 给大家分享一下最近开发遇到的一些坑
- 遇到的一个关于NULL小问题,请大家帮忙看下,求个解释
- 好久没更新博客了,今天给大家分享一下Android中的资源与国际化的问题,通常我们新建一个Android工程,目录结构如下图所示: 我们主要看一下layout与values目录,layou
- 请大家看一下一个c语言中的链表问题,下面的代码是有错误的!!请大家说出错误的原因,以及修改的方法!!!
- 今天在写程序中遇到的问题与大家分享一下
- 今天老师给了我一个毕业设计课题,让我试着做,请大家看一下
- 两个小问题请大家注意一下
- 请大家帮忙找一下问题啊
- 我在开发AJAX过程中遇到的问题及解决方案,分享给大家~
- 大家好!我是一个菜鸟!!遇到问题了,请教大家帮我一下,急,谢谢了!!!
- codeforces #508B# Anton and currency you all know(贪心)
- 自动清除日期目录shell脚本
- 亿级用户下的新浪微博平台架构
- Android如何监控本应用被卸载
- 【PS】浅谈PS颜色模式-RGB模式
- 在学习autotools遇到一个问题:make没有按照VPATH给的目录进行搜索,请大家指导一下。
- C# 的Brush 及相关颜色的操作
- 灰度图像--图像增强 平滑之均值滤波、高斯滤波
- 背包系统(二)
- 自己实现的输入框控件
- 在服务端接收和发送数据
- Excel两列数据去重
- 卖相好,才卖的好,你的玻璃瓶包装够精美吗?
- iOS 录音pcm获取当前音量