Browse - Programming Tips - Makefiles are so tedious. Is there an alternative?
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:
At the command line.
will install it.
Sadly, Jam is no longer maintained.
Boost Jam (Red Hat package "boost-jam" and command "bjam") is an alternative.