Dave's Brain

Browse - programming tips - jam quick start

Date: 2008feb18

Q.  Makefiles are so tedious.  Is there an alternative?

A.  I use Jam.  (There are several other alternatives like Ant.)
Here's how to get started.  If you are using Fedora, RedHat or Centos
you can install it by doing:

	yum install jam

Create a file called "Jamfile" in the same folder as
your source code.  This simple example shows a program composed
of "hello.cpp" and "extra.cpp" which is compiled into a binary called "hello".
I specify some compiler and linker options.

	C++ = gcc ;
	C++FLAGS = -g -I. -fno-rtti -fno-exceptions ;

	LINK = gcc ;
	LINKFLAGS = -L/usr/lib -lg -lstdc++ ;

	Main hello : hello.cpp extra.cpp ;

	InstallBin /usr/local/bin : hello ;

Notice that space is required around the punctuation.
Like the colons, semicolons and equals.

Now you can compile the program by doing:

	jam

At the command line.

	jam install

will install it.

Add a comment

Sign in to add a comment
Copyright © 2008, dave - Code on Dave's Brain is licensed under the Creative Commons Attribution 2.5 License.