# ***** BEGIN LICENSE BLOCK *****
# Version: MPL 1.1/GPL 2
#
# The contents of this file are subject to the Mozilla Public License Version 
# 1.1 (the "License"); you may not use this file except in compliance with 
# the License. You may obtain a copy of the License at 
# http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
# for the specific language governing rights and limitations under the
# License.
#
# The Original Code is the Floater Bridge Network.
#
# The Initial Developer of the Original Code is
# Geoff Pike  <pike@EECS.Berkeley.EDU>.
# Portions created by the Initial Developer are Copyright (C) 1996--2003
# the Initial Developer. All Rights Reserved.
#
# Contributor(s):
#    Lex Spoon <lex@cc.gatech.edu>
#
# Alternatively, the contents of this file may be used under the terms
# of either the GNU General Public License Version 2 or later (the
# "GPL"), in which case the provisions of the GPL are applicable instead
# of those above. If you wish to allow use of your version of this file
# only under the terms of the GPL, and not to allow others to use your
# version of this file under the terms of the MPL, indicate your
# decision by deleting the provisions above and replace them with the
# notice and other provisions required by the GPL. If you do not delete
# the provisions above, a recipient may use your version of this file
# under the terms of either the MPL or the GPL.
# ***** END LICENSE BLOCK *****

# This file is a Jamfile for the Floater client.  You need to install
# jam before you can use it:
#
#           http://www.perforce.com/jam/jam.html
#


SubDir TOP common ;


# optional files to include
if $(windows) = yes {
    platform_source_files = winico.o maximize.c winMain.c ;
} else {
    platform_source_files = ;
}


### extra Jam rules for this directory 
rule Tcp {
  Dequote $(tcldir)/$(1).deq : $(tcldir)/$(1).tcp ;
}


rule Autohelp {

  DEPENDS $(1) : $(2) common/autohelp1.c common/autohelp2.c common/autohelp3.c common/mkautohelp ;
  Clean clean : $(1) ;

  LOCATE on $(1) = $(LOCATE_SOURCE) ;
  SEARCH on $(2) = $(SEARCH_SOURCE) ;
}
actions Autohelp {
  (cd common; $(TOP)/common/mkautohelp $(2) > $(1)) ;
}



###  the actual build rules ###

floater_sources =  tickler.c main.c commandhash.c alloc.c floatcmd.c
                   comm.c rand.c deal.c stringlist.c br.c bits.c
                   util.c result.c score.c calendar.c help.c autohelp.c
                   UI.c UIback.c UIback-tk.c 
                   bug.c text.c floatcl.c $(platform_source_files) ;

if $(enable_backend_curses) = yes {
  floater_sources += UIback-curses.c ;
}

if $(windows) = yes {
    LINKFLAGS on <common>floater += -mwindows ;
}



LINKLIBS on <common>floater += $(LIBS) ;
Main <common>floater : $(floater_sources) ;

if $(enable_backend_curses) = yes {
  if $(windows) = yes {
      # XXX this setup causes all the C files to be compiled twice.
      # This dual compilation should be fixed, one way or the other.
      LINKFLAGS on <common>floatert += -mconsole ;
      LINKLIBS on <common>floatert += $(LIBS) ;
      Main <common>floatert : $(floater_sources) ;
  } else {
      SoftLink <common>floatert : <common>floater ;
  }

  LOCATE on <common>floatert = $(LOCATE_SOURCE) ;
}

Tcl_In_C <common>floatcl.c : $(tcldir)/floater.tcl $(tcldir)/floatert.tcl ;


Tcp connect ;
Tcp errorhandle ;
Tcp files ;
Tcp gset ;
Tcp gui ;
Tcp logo ;
Tcp mail ;
Tcp matrix0 ;
Tcp matrixbig ;
Tcp matrixsize ;
Tcp matrix ;
Tcp menu ;
Tcp options_common ;
Tcp options_GUI ;
Tcp resultreq ;
Tcp seen ;
Tcp texts ;
Tcp the_texts ;
Tcp floater ;
Tcp floatert ;


PreprocessRequote $(tcldir)/floater.tcl : $(tcldir)/floater.deq ;
PreprocessRequote $(tcldir)/floatert.tcl : $(tcldir)/floatert.deq ;


Autohelp <common>autohelp.c : <common>ref ;


if $(windows) = yes {
  WindRes <common>winico.o : <common>winico.rc ;
  DEPENDS <common>winico.o $(artdir)/icons/floater.ico ;
}



# TODO:
#  add a Jamfile for the artdir files
#  add man page generation
#  add Jamfiles for building servers
#  give tcldir its own jamfile
#   (note: floatcl.c does not need to be in common, necessarily....)
