[r66]: mk / jam / win32.jam Maximize Restore History

Download this file

win32.jam    74 lines (61 with data), 1.9 kB

#============================================================================
# Jam configuration and actions for Win32
#============================================================================
SHELL ?= "/bin/sh" ;

#----------------------------------------------------------------------------
# resource handling
# Unfortunately we can't simply specify resources on the source list, because
# Mingw/Cygwin have the limitation that they can only link 1 resource file
# in. So we have to concatenate all resourcefiles here before compiling them.

actions together CompileResources
{
    cat $(>) | $(WINDRES) $(WINDRES_FLAGS) --include-dir=$(>:D) -o $(<)
}

rule CompileResources
{
    Depends $(<) : $(>) ;
}

rule Win32Resource
{
    local target = $($(<)_TARGET) ;
    local rcobject = [ DoObjectGrist _resource.o ] ;
    LOCATE on $(rcobject) = $(LOCATE_TARGET) ;
    SEARCH on $(rcobject) = $(LOCATE_TARGET) ;
    
    # only add 1 resource object per target
    if ! $($(<)_HASWIN32RESOURCE)
    {
	$(<)_HASWIN32RESOURCE = yes ;
	ExtraObjects $(<) : $(rcobject) ;
    }

    CompileResources $(rcobject) : $(>) ;
}

#----------------------------------------------------------------------------
# linking part

##  ConstructApplicationTarget target : options
##    Constructs the application atrget name (ie. foo.exe for foo)
rule ConstructApplicationTarget
{
  return $(<).exe ;
}
rule ConstructLibraryTarget
{
  return lib$(<).a ;
}
rule ConstructPluginTarget
{
  return $(<).dll ;
}

# SystemLinkApplication target : objects : options
rule SystemLinkApplication
{
  local target = $($(<)_TARGET) ;

  Depends $(target) : $(>) ;
  LinkApplication $(target) : $(>) ;
  # setup clean rules
  Clean clean : $(target) ;
  Clean $(<)clean : $(target) ;
}

actions LinkApplication bind NEEDLIBS bind EXTRAOBJECTS
{
  $(LINK) $(C++FLAGS) $(LDFLAGS) -o $(<) $(>) $(EXTRAOBJECTS) $(NEEDLIBS) $(LFLAGS)
}