Questions and answers

This is a small list of questions you might be wondering about...

Why does it only work on "int main", and not "void main"?

Because I say so? It's not normal to use void main, so just don't. Read this and that for more information. And if you think I should change the behaviour of ccbuild, post a feature request.

Why not output autotools scripts?

Currently there is no way of finding out what autoconf/automake information to add. This means that ccbuild can't automate this and I can't see how it could be implemented without it working like a hack.

Having said that, a hack is still possible. Here is a hack I'm currently testing, consisting of two files: bootstrap and configure.in. The configure.in file is just a standard configure.in file, however the bootstrap is a shell script which will overwrite your Makefile.am and insert all the sources your program uses. You can download these files from the metalink svn, which will also contain the newest version as long as I'm developing this. The key parts of this file are blue, everything around the blue parts is save to edit.

#!/bin/sh

## Generate Makefile.am using ccbuild
PSOURCE=src/metalink.cc
PNAME=`basename "${PSOURCE}" .cc`
echo "Generating Makefile.am from ccbuild"
SOURCES=`ccbuild md5 "${PSOURCE}" | sed  -r 's/^[a-z0-9]+  //; s/ /\\ /' | tr '\n' ' '`

#Overwrite Makefile.am
cat > Makefile.am <<EOF
AUTOMAKE_OPTIONS = subdir-objects

bin_PROGRAMS = ${PNAME}

#Sources, generated list from ccbuild md5 output
${PNAME}_SOURCES = ${SOURCES}
${PNAME}_LDFLAGS = @LIBGCRYPT_LIBS@ -l@BOOST_REGEX_LIB@ -l@BOOST_PROGRAM_OPTIONS_LIB@ -l@BOOST_FILESYSTEM_LIB@
${PNAME}_CXXFLAGS = @LIBGCRYPT_CFLAGS@ -D_LARGEFILE_SOURCE
EOF

echo "Running autotools:"
##BOOTSTRAP
echo " aclocal"
aclocal -I /usr/share/autoconf-archive
echo " autoconf"
autoconf
echo " automake"
automake --add-missing

It looks like I need GNU/Linux, where are the M$ Windows binaries?

Try Cygwin, if it doesn't work you can still post a feature request or bugreport. It is probably possible to create Windows binaries, however, I do not own a copy of Windows and won't afford one (that's not a typo, tis is). If you can and have created Windows binaries, mail me and I'll put up a link to them.

How do you use ccbuild?

During development, I often like to run ccbuild in a loop, like this:

while [[ 1 ]]; do sleep 2;A=`ccbuild 2>&1`;clear;echo "$A";done
It's not for everybody, but I like it. Don't forget that the ticks around ccbuild are back-ticks (under the "~" on your keyboard).

Copyright 2005 (C) A. Bram Neijt
Last update: 21st 2009f October 2009