# Boost.Iostreams Library Build Jamfile

# (C) Copyright Jonathan Turkanis 2004
# Distributed under the Boost Software License, Version 1.0. (See accompanying 
# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt.)

# See http://www.boost.org/libs/iostreams for documentation.

subproject libs/iostreams/build ;

import ./bzip2 ;
import ./zlib ;

SOURCES = file_descriptor mapped_file ;

template iostreams
    : # sources
          ../src/$(SOURCES).cpp
      <template>bzip2
      <template>zlib
    : # build requirements
    : # build variants
    ;

lib boost_iostreams
    : # sources
      <template>iostreams
    : # build requirements
      [ cond $(BZIP2_SOURCE) : <lib>boost_bzip2 : ]
      [ cond $(ZLIB_SOURCE) : <lib>boost_zlib : ]
      [ common-names ] # magic for install and auto-link features
      <include>$(BOOST_ROOT) <sysinclude>$(BOOST_ROOT)
    : # build variants
      debug release  
    ;

dll boost_iostreams
    : # sources
      <template>iostreams
    : # build requirements
      [ common-names ]  # magic for install and auto-link features
      <define>BOOST_IOSTREAMS_DYN_LINK=1  # tell source we're building dll's
      <runtime-link>dynamic  # build only for dynamic runtimes
      <include>$(BOOST_ROOT) <sysinclude>$(BOOST_ROOT)
    : # build variants
      debug release 
    ;

install iostreams lib
     : <lib>boost_iostreams <dll>boost_iostreams
     ;

stage stage/lib 
    : <lib>boost_iostreams <dll>boost_iostreams 
      [ cond $(BZIP2_SOURCE) 
        : <lib>boost_bzip2 
          #<dll>boost_bzip2 
        : ] 
      [ cond $(ZLIB_SOURCE) : <lib>boost_zlib <dll>boost_zlib : ] 
    : # copy to a path rooted at BOOST_ROOT:
      <locate>$(BOOST_ROOT)
      [ common-names ] # magic for install and auto-link features
      # add this target to the "stage" and "all" psuedo-targets:
      <target>stage
      <target>all
    : # build variants
      debug release 
    ;

# end
