I have a C ++ project that compiles into different versions, including release, debug, shared library and executable, with different compiler flags for each. I am trying to run Jam as an alternative to Make, because it looks like a simpler system.
Is it capable? The main problem is that it always puts the .o files in the same folder as the source file, so it overwrites them when creating multiple versions.
Update
I found a solution that seems to work. Using this file, I can create debug and final configurations of the library or executable file.
Command to create release library:
jam -s config=lib -s release=1
If you type only jam, it creates a debug executable. Here is the jamfile:
FILES =
main.cpp
;
BASENAME = steve ;
OBJ = obj ;
if $(release)
{
OBJ = $(OBJ)r ;
}
else
{
DEFINES += DEBUG ;
OBJ = $(OBJ)d ;
}
if $(config) = lib
{
OBJ = $(OBJ)_lib ;
OUTFILE = lib$(BASENAME).so ;
DEFINES += SHARED_LIBRARY ;
LINKFLAGS +=
-shared -Wl,-soname,$(OUTFILE) -fvisibility=hidden -fPICS
;
}
else
{
OUTFILE = $(BASENAME) ;
}
LOCATE_TARGET = $(OBJ) ;
MkDir $(LOCATE_TARGET) ;
Main $(OUTFILE) : $(FILES) ;
source
share