## ----------------------------------------------------------------------------
##                                                                           --
##                      GNADE  : GNat Ada Database Environment               --
##                                                                           --
##  Filename        : $Source: /cvsroot/gnade/gnade/contrib/gsql/Makefile,v $
##  Description     : Makefile for the GSQL IDE
##  Author          : Michael Erdmann <michael.erdmann@snafu.de> 
##  Created On      : 08-Aug-2001
##  Last Modified By: $Author: merdmann $
##  Last Modified On: $Date: 2003/11/16 12:11:18 $
##  Status          : $State: Exp $
##
##  Copyright (C) 2000-2001
##
##  GNADE is copyrighted by the persons and institutions enumerated in the   --
##  AUTHORS file. This file is located in the root directory of the          --
##  GNADE distribution.                                                      --
##                                                                           --
##  GNADE is free software;  you can redistribute it  and/or modify it under --
##  terms of the  GNU General Public License as published  by the Free Soft- --
##  ware  Foundation;  either version 2,  or (at your option) any later ver- --
##  sion.  GNAT is distributed in the hope that it will be useful, but WITH- --
##  OUT ANY WARRANTY;  without even the  implied warranty of MERCHANTABILITY --
##  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License --
##  for  more details.  You should have  received  a copy of the GNU General --
##  Public License  distributed with GNAT;  see file COPYING.  If not, write --
##  to  the Free Software Foundation,  59 Temple Place - Suite 330,  Boston, --
##  MA 02111-1307, USA.                                                      --
##                                                                           --
##  As a special exception,  if other files  instantiate  generics from      --
##  GNADE Ada units, or you link GNADE Ada units or libraries with other     --
##  files  to produce an executable, these  units or libraries do not by     --
##  itself cause the resulting  executable  to  be covered  by the  GNU      --
##  General  Public  License.  This exception does not however invalidate    --
##  any other reasons why  the executable file  might be covered by the      --
##  GNU Public License.                                                      --
##                                                                           --
##  GNADE is implemented to work with GNAT, the GNU Ada compiler.            --
##                                                                           --
## ----------------------------------------------------------------------------
##
##  Functional Description
##  ======================
##  This makefile builds the sample programs for the thin ODBC binding.
##
##  Restrictions
##  ============
##
##  References
##  ==========
##
sinclude ../conf.local
sinclude ../../make.conf

VERS=0.8

DISTNAME=gsql-source-$(VERS)

all:: icons gsql

##
## Build the GSQL Application 
##
gsql:	gsql.adb  						\
	gsql_types.ads gsql_types.adb				\
	odbc.adb odbc.ads 					\
	gui.adb gui.ads 					\
	gui_window.adb gui_window.ads				\
	gui_files.adb gui_files.ads				\
	gui_result.adb gui_result.ads				\
	gui_editor.adb gui_editor.ads   			\
	gui_preferences.adb gui_preferences.ads 		\
	gui_logging.adb gui_logging.ads				\
	gui_menu.adb gui_menu.ads				\
	gui_tools.ads gui_tools.adb				\
	gui_dialog.adb gui_dialog.ads				\
	gui_license.adb gui_license.ads				\
	gui_about.adb gui_about.ads				\
	gui_common.adb gui_common.ads				\
	gui_table.adb gui_table.ads				\
	gui_worksheet.ads gui_worksheet.adb			\
	gui_addrow.ads gui_addrow.adb				\
	gui_rowdefinition.ads					\
	gui_checkbutton.ads gui_checkbutton.adb			\
	contents_handler.ads					\
	contents_manager-gui.ads contents_manager-gui.adb 	\
	contents_manager.adb contents_manager.ads		\
	query_handler.ads query_handler.adb			\
	table_handler.ads table_handler.adb			\
	procedure_handler.ads procedure_handler.adb		\
	datasource_handler.ads datasource_handler.adb 		\
	project_file.ads project_file.adb			\
	files.adb files.ads					\
	text_block.ads text_block.adb				\
	environment.adb environment.ads				\
	preferences.ads						\
	config.ads						\
	import_export.adb import_export.ads
	gnatmake -g $(ADAFLAGS) gsql -cargs $(CFLAGS) 	        \
	        `gtkada-config --cflags`                        \
		$(APP_BIND_FLAGS) $(APP_LINK_FLAGS)		\
                -L/usr/lib/ada/GtkAda-1.2/lib `gtkada-config --libs`  \
		-largs -lodbc
	cp gsql $(bindir)

##
## Provide the icons for installation
##
icons:
	cp *.xpm $(SHARED)

##
## Insert the version number into the window gui
##
gui_window.ads: gui_window.gps
	$(ADAPREP) -DVersion=\"$(VERS)\" gui_window.gps gui_window.ads

##
## Insert the configuration data from the GNADE environment
##
config.ads: config.gps
	$(ADAPREP) -DShared_Path=\"$(SITE_SHARED)\" config.gps config.ads

##
## Clean the directory
##
clean::
	rm -f b~*.ad[bs] core a.out *.o *.ali *~ 
	rm -f gsql 
	rm -f gui_window.ads config.ads

distclean:: clean

##
## create a distribution
##
dist :: 
	rm -rf ../$(DISTNAME)
	mkdir -p ../$(DISTNAME)
	cat MANIFEST | cpio -pdmu ../$(DISTNAME)
	( cd .. ; tar cvzf $(DISTNAME).tar.gz $(DISTNAME) )
	( cd .. ; zip -r $(DISTNAME).zip $(DISTNAME) )
	rm -rf ../$(DISTNAME)


publish:
	ncftpput  upload.sourceforge.net  /incoming ../$(DISTNAME).zip
	ncftpput  upload.sourceforge.net  /incoming ../$(DISTNAME).tar.gz
