Many occam-pi programs (including all the components of KRoC and the CoSMoS demos, and a lot of other open-source software) are built using the GNU "autotools" system. If you've just checked out one of these programs from a version control system, you're probably peering at a directory containing a Makefile.am
file and wondering how to use it to compile the program. The quick answer to your question is:
autoreconf -f -i
./configure
make
If you make changes to the program and want to recompile it, you can then just do:
make
without needing to go through the "configuration" steps again (they'll be redone automatically if necessary).
(If you get an error from autoreconf saying error: possibly undefined macro: AC_MSG_ERROR
, then you've forgotten to source kroc-setup.sh
.)
Why do we do this rather than just writing a Makefile? Because autoconf/automake take a lot of the hassle out of packaging software so that it can be distributed and installed, and allows us to write software that works sensibly across multiple platforms.
You're probably still a bit bemused as to what those commands above are doing, though. The full story is:
- "autoreconf" is actually a wrapper that runs autoconf and automake.
- "autoconf" reads configure.ac and generates a configure program (which is actually a big shell script).
- "automake" reads Makefile.am and generates Makefile.in (which is a template for a Makefile).
- "configure" does a whole bunch of tests to see how to compile stuff on your machine, and checks that all the libraries you need are present, and then fills in the template fields in Makefile.in to produce a Makefile.
- "make" then follows the rules in the Makefile to actually compile your program (by running the appropriate compiler commands).
If you were distributing the program to other people, you'd normally do so after running autoreconf -- so the normal way of installing a program that's built this way is ./configure; make; make install
. The extra step is necessary when you've checked the software out of Subversion because you generally don't want to keep all the generated files in version control.
If you want to package your own occam-pi software this way, then you probably want to have a look at the OccBuild documentation.