Automake变量整理Makefile.am [英] Automake Variables to tidy up Makefile.am
问题描述
我有一个目录/ src包含我的所有源文件,和/ bin在运行make命令后存储所有二进制文件。该目录如下所示:
I have a directory /src containing all of my source files, and /bin to store all binary after running make command. The directory is something like below:
/BuildDirectory
- - /src
- - /bin
- - configure
- - Makefile.am
- - configure.ac
- - ...
现在在Makefile.am中,我必须指定:
Now in Makefile.am, I have to specified:
bin_PROGRAMS = bin/x bin/y bin/z bin/k ...
bin_x_SOURCES = src/x.cpp
bin_y_SOURCES = src/y.cpp
bin_z_SOURCES = src/z.cpp
< ?
例如我只是指定:
Is there any variable that can help to get rid of all "bin/" and "src/" ? For example I just specify:
$BIN = bin
$SRC = src
他们会在正确的文件夹中查找正确的文件,并将其编译到正确的位置。
And they will look for the correct files in correct folders and compile it to the correct places.
感谢
推荐答案
您可以利用远程建设。将此makefile放在bin目录中:
You could take advantage of remote building. Place this makefile in the bin dir:
VPATH = ../src
bin_PROGRAMS = x y z k ...
x_SOURCES = x.cpp
y_SOURCES = y.cpp
z_SOURCES = z.cpp
现在用以下替换当前的Makefile.am:
Now replace the current Makefile.am with this one:
SUBDIRS = bin
现在调整configure.ac也可以生成bin / Makefile
Now tweak your configure.ac to also generate bin/Makefile
AC_CONFIG_FILES([Makefile
bin/Makefile])
你应该为生命而设。
这篇关于Automake变量整理Makefile.am的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!