#
# $Id: Jamfile 3047 2011-09-26 13:11:12Z karijes $
#
# Copyright (c) 2005-2012 edelib authors
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with this library. If not, see <http://www.gnu.org/licenses/>.

SubDir TOP tools edelib-dbus-explorer ;

if $(DBUS_LIBS) {
    GEN_HELP_SCRIPT = "$(LOCATE_SOURCE)/gen-help.sh" ;

	rule GenHelp {
		local t = [ FGristSourceFiles $(<) ] ;
		LocalDepends $(t) : $(>) ;

		MakeLocate $(t) : $(LOCATE_SOURCE) ;
		SEARCH on $(>) = $(SEARCH_SOURCE) ;
		GenHelp1 $(t) : $(>) ;
		LocalClean clean : $(t) ;
	}

	actions piecemeal GenHelp1 {
		cat $(>) | $(GEN_HELP_SCRIPT) > $(<) ;
	}

	PROGRAM_FLAGS = $(FLTK_CFLAGS) -I$(TOP)/tools/edelib-dbus-explorer ;

	if $(HAVE_FL_TREE) != 1 {
		# older that FLTK 1.3.0 does not have Tree widget
		FL_TREE_SRC = Fl_Tree.cpp
					  Fl_Tree_Item_Array.cpp
			  		  Fl_Tree_Item.cpp
					  Fl_Tree_Prefs.cpp ;

		FL_TREE_SRC = missing/$(FL_TREE_SRC) ;
		PROGRAM_FLAGS += -I$(TOP)/tools/edelib-dbus-explorer/missing ;
	}

	SRC = $(FL_TREE_SRC)
		  edelib-dbus-explorer.cpp
		  ScriptEditor.cpp
		  ObjectTree.cpp
		  Entity.cpp	
		  ScriptDBus.cpp ;

	ObjectC++Flags $(SRC) : $(PROGRAM_FLAGS) ;
	MakeTest edelib-dbus-explorer : $(SRC) : -ledelib_dbus -ledelib_gui $(FLTK_LIBS_FULL) -ledelib $(DBUS_LIBS) -lX11 ;

	GenHelp Help.h : edelib-dbus-explorer.txt ;
	InstallProgram $(bindir) : edelib-dbus-explorer ;
}
