Discussion:
Compile-Run Cycle
Anarchean
2016-12-28 03:30:42 UTC
Permalink
Hello,

I'm new to autotools and currently I'm using C++ with autotools
and vim. I was wondering how you usually run the programs.
My current workflow is the following:

My folder structure:

| project_home
| - configure.ac
| - Makefile.am
| - configure
| - build/
| - sandbox/
| - src/
| - Makefile.am
| - source1.c++
| - source2.c++

I use two terminals, one is running vim from inside the
src dir. The other one has a variable PREFIX=$project_root/sandbox,
and I use it to compile and run the program, which is usually the
follow command sequence:

Once in a while:
% ./configure --prefix="$PREFIX"

And then every modification:
% make
% make install
% "$PREFIX/bin/project_name"

Is there any way to automate this? How people usually do it?
Gavin Smith
2016-12-28 12:23:38 UTC
Permalink
Post by Anarchean
% ./configure --prefix="$PREFIX"
I only configure when I need to, for example when the configure script
has changed.
Post by Anarchean
% make
% make install
% "$PREFIX/bin/project_name"
I run from the build directory most of the time, without installing, e.g.

% make
% ./project_name
Eric Blake
2016-12-28 15:35:48 UTC
Permalink
Post by Anarchean
I use two terminals, one is running vim from inside the
src dir. The other one has a variable PREFIX=$project_root/sandbox,
and I use it to compile and run the program, which is usually the
% ./configure --prefix="$PREFIX"
% make
% make install
% "$PREFIX/bin/project_name"
Is there any way to automate this? How people usually do it?
That works. Another thing to try is to get your software to the point
that it will run when uninstalled, from a VPATH build tree. Then you
can shorten the steps to

% make
% ./src/project_name

assuming that the 'make install' step is what copies src/project_name to
$PREFIX/bin/project_name. If you have a good testsuite, and have
properly hooked it into automake, then 'make check' is a good way to
test the uninstalled project.
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
Loading...