How can I create different versions of a project using the Jam make tool?

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) ;
+3
source share
3 answers

I am not familiar with Perforce Jam, but bjam allows this - and it is trivially easy. bjamDoes not place intermediate files in the same directory as the source; it creates debug / release / static / shared directories depending on the type of project you are building.

For example, if you want to create a version and a debug version of a library, and you would like to statically set it:

bjam debug release link=static

bjam , . () msvc (8.0 9.0), gcc 4.3 x86, gcc 3.4 ARM gcc 4.3 PowerPC. .

+2

, . "", boost.build "debug" "release". , " ", link-incompatible :

feature magic: off on: ;

feature.compose on: USE_MAGIC;

, boost.build. , (, ); , , .

+1

, , ( ), , .

, . Jam. , -, , ? , Ant, , , . .

-2

Source: https://habr.com/ru/post/1704415/


All Articles