[r1]: mk / jam / variant.jam Maximize Restore History

Download this file

variant.jam    53 lines (47 with data), 1.4 kB

#============================================================================
# Setup of compiler/linker flags for debug/optimize mode
#============================================================================

VARIANT ?= optimize ;
if $(VARIANT) != "debug" && $(VARIANT) != "optimize" && $(VARIANT) != "profile"
{
  exit "Invalid modus set, please set VARIANT to debug, profile or optimize" ;
}

switch $(VARIANT)
{
case optimize :
    SHORTVARIANT = opt ;
case debug :
    SHORTVARIANT = dbg ;
case profile :
    SHORTVARIANT = prof ;
}

# Set modus related flags
CCFLAGS += $(COMPILER_CFLAGS) $(COMPILER_CFLAGS_$(VARIANT)) ;
C++FLAGS += $(COMPILER_CFLAGS) $(COMPILER_C++FLAGS)
	    $(COMPILER_CFLAGS_$(VARIANT)) $(COMPILER_C++FLAGS_$(VARIANT)) ;
LINKLIBS += $(COMPILER_LFLAGS) $(COMPILER_LFLAGS_$(VARIANT)) ;
LOCATE_OBJECTS = $(LOCATE_OBJECTS)/$(SHORTVARIANT) ;

##  SubVariant variantname
##    Specify subvarianet which are placed in separate compilation directories.
SUBVARIANT ?= "" ;
rule SubVariant
{
  SUBVARIANT = $(<) ;
  if ! $(<)
  {
    SUBVARIANT = "" ;
    if $(SAVED_LOCATE_TARGET)
    {
      LOCATE_TARGET = $(SAVED_LOCATE_TARGET) ;
    }
    SAVED_LOCATE_TARGET = ;
  }
  else
  {
    if ! $(SAVED_LOCATE_TARGET)
    {
      SAVED_LOCATE_TARGET = $(LOCATE_TARGET) ;
    }
    LOCATE_TARGET = $(LOCATE_TARGET)/$(SUBVARIANT) ;
  }
}