Dave's Brain

Browse - Programming Tips - Makefiles are so tedious. Is there an alternative?

Date: 2008feb18
OS: Linux

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 RedHat/Fedora/CentOS
you can install it by doing:

dnf 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++ ; EXEMODE = 0755 ; 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-2017, dave - Code samples on Dave's Brain is licensed under the Creative Commons Attribution 2.5 License. However other material, including English text has all rights reserved.