سؤال

I am autotoolizing a library project, and this project has some example programs. I want the example programs to be distributed in the dist, but not installed.

Currently the demo programs are organized like thus:

src/*.cpp (library source)
include/*.h (library headers)
demos/demo.cpp (example program)
demos/RunDemo (script to run demo)

It is important that RunDemo be runnable after building the software, without requiring the "install" step.

So far I have been able to build the "demo" exectuable using a noinst_PROGRAMS target. However, after make in a VPATH build, the following is available:

build/src/.libs/libxxx.so  (etc..)
build/demos/demo

As you can see, the RunDemo script needed to execute "demo" is not copied to the $(builddir). I have tried a few things, e.g., adding RunDemo to dist_noinst_SCRIPTS, as well as adding my own copy targets and trying to hook all.. no matter what I try, I always get the output,

$ make RunDemo
make: Nothing to be done for `../../../projects/demo/RunDemo'.

I seem to be unable to create a target in the builddir that says "if this file is not in the builddir, copy it from the srcdir."

Is this possible with automake?

هل كانت مفيدة؟

المحلول

You can make files accessible in the build tree after the ./configure step using the AC_CONFIG_LINKS macro (provided with autoconf) in your configure.ac script. It will create a symbolic link if possible, otherwise it will copy the file.

In your case it would look like

AC_CONFIG_LINKS([demos/RunDemo:demos/RunDemo])

From the autoconf manual:

Macro: AC_CONFIG_LINKS (dest:source..., [cmds], [init-cmds])

Make AC_OUTPUT link each of the existing files source to the corresponding link name dest. Makes a symbolic link if possible, otherwise a hard link if possible, otherwise a copy. The dest and source names should be relative to the top level source or build directory

Using dist_noinst_SCRIPTS is still necessary for the file to be distributed.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top