我被一个奇怪的变量扩展困住了。让我解释。
我有一个使用 automake 的项目,由 ,configure.ac
组成Makefile.am
。基本上,在Makefile.am
我正在做的事情中:
ARCH = $(shell ${CURDIR}/./arch.sh)
...
noinst_HEADERS = license/${ARCH}/lchecker.h
proj_SOURCES = main.c license/${ARCH}/lchecker.c
proj_LDFLAGS = -avoid-version -Llicense/${ARCH}
./arch 只是uname -m
为了确定所需的架构,因为我必须输入正确的目录。
当我运行构建时,我有这个错误:
Makefile:622: license/x86_64/.deps/lchecker.Po: No such file or directory
make[1]: *** No rule to make target 'license/x86_64/.deps/lchecker.Po'. Stop.
如果我进入该license
目录,我会注意到创建了一个新目录,名为${ARCH}/
where I find the missing .deps
from license/x86_64
。
我很确定这是一个不正确的扩展问题;我尝试了很多方法,但我失败了。
谁能向我解释这样做的正确方法?在网上阅读,我发现它Makefile.am
的语法与Makefile
.
更新:
我尝试添加一些更改以查看变量是否正确定义:
AC_DEFINE([ARCH], ["$ARCH"], [arch check])
echo ARCH = "$ARCH"
printfx86_64
所以在configure.ac 中定义的变量,但在Makefile.am 中扩展又不正确。