#
# Makefile for xmysqladmin on Linux
#

VERSION = 0.4.0

########################################################
# WARNING
#
#     Change INSTALLPATH and PIXMAPPATH
#     according to where you want the executable
#     and the xpm file located.
#
#     Also, you must set MYSQLINC and MYSQLLOAD
#     to point to the MySQL include and library
#     file directories.
#  
#     Also, you must set XFORMLIBDIR and XFORMLIBDIR
#     to point to the Xforms include and library
#     file directories.
#
#     Also, you must set the INC and XLOAD to point
#     to the X include and library file directories.
#
#     Also, you must set BACKUP for your backup program
#     It will be use when you drop a database
#
#     You may also have to add a -L to point to the
#     Xpm library directory. In many cases the Xpm
#     library will already be found via the XLOAD 
#     setting.
#


########################################################
# name of the executable.  No need to change this
#-------------------------------------------------------
PROGRAM = 	xmysqladmin
########################################################




########################################################
# install program  (used by make install)
#-------------------------------------------------------

# Use this for Solaris 2.x:
# INSTALL = /usr/ucb/install

# Use this for Linux:
INSTALL = install
########################################################





########################################################
# PROGRAM (executable) install path
# This is used by 'make install' command
#-------------------------------------------------------
#INSTALLPATH = /opt/local/i386/bin
INSTALLPATH = /usr/local/bin
########################################################





########################################################
# pixmap file location
#-------------------------------------------------------
#PIXMAPPATH = /opt/local/lib
PIXMAPPATH = /usr/local/bin
########################################################





########################################################
# backup program 
# drop database will fire up this command...
#-------------------------------------------------------
# Use this if you have GNU tar and gzip installed:
BACKUP = "tar cvzf"
BACKUPSUFFIX = ".gz"

# Use this if you don't:
#BACKUP = "tar cvf"
#BACKUPSUFFIX = ""
########################################################





########################################################
#backup dir
#-------------------------------------------------------
BACKUPDIR = /tmp
########################################################





########################################################
# Compilation Details
# hum... I think you dont need to change this
#-------------------------------------------------------
CC = gcc
STDCFLAGS = -g -c -O2 -Wall -DPIXMAPFILE=\"$(PIXMAPPATH)/mysql.xpm\" \
            -DBACKUP=\"$(BACKUP)\" -DBACKUPDIR=\"$(BACKUPDIR)\" \
            -DBACKUPSUFFIX=\"$(BACKUPSUFFIX)\"
STDLFLAGS = 
########################################################





########################################################
# mysql include dir 
#-------------------------------------------------------
#MYSQLINC = -I/opt/local/include/mysql
MYSQLINC = -I/usr/local/include/mysql
########################################################






########################################################
# mysql library dir
#-------------------------------------------------------
#MYSQLLOAD = -L/opt/local/i386/lib/mysql -lmysqlclient -lmysys -ldbug -lmystrings
MYSQLLOAD = -L/usr/local/lib/mysql -lmysqlclient -lmysys -ldbug -lmystrings
########################################################





########################################################
# xforms librairies dir
#-------------------------------------------------------
#XFORMLIBDIR = -L/opt/local/i386/lib
XFORMLIBDIR = -L/usr/lib
########################################################






########################################################
# xforms include dir (xforms.h)
#-------------------------------------------------------
#XFORMINCDIR = -I/opt/local/include
XFORMINCDIR = -I/usr/include
########################################################





########################################################
# X includes and xload
#-------------------------------------------------------
# Use this for Solaris 2.x:
#XINC = -I/usr/openwin/include
#XLOAD = -L/usr/openwin/lib  -lX11

# Use this for Linux:
XINC =
XLOAD = -L/usr/X11R6/lib -lX11
########################################################





########################################################
# others librairies
#-------------------------------------------------------
# Use this for Solaris 2.x:
#LIBS = -lsocket -lnsl -lm

# Use this for Linux:
LIBS = -lm
######################################################## 





##########################################################################################
##########################################################################################
##########################################################################################
# no changes needed after this line...
##########################################################################################
##########################################################################################
##########################################################################################


ADMININC = xmysqladmin.h xmysqladmin2.h


# objects needed for the program
OBJS =  xmysqladmin.o \
	main_callback.o \
	status.o \
	version.o \
	threads.o \
	reload.o \
	configure.o \
	isamchk.o \
	grant.o \
	inputhost.o \
	inputdb.o \
	inputuser.o \
	createDropDB.o \
	utils.o \
	createTable.o \
	connect.o \
	droptable.o \
	ccomkey.o \
	alterTable.o \
	browseTable.o
 
${PROGRAM}: $(OBJS)
	$(CC) -o ${PROGRAM} $(OBJS) $(MYSQLINC) $(XFORMINCDIR) \
	$(XINC) $(STDLFLAGS) $(MYSQLLOAD) \
	$(XLOAD) $(XFORMLIBDIR) -lforms -lXpm $(LIBS)
	./$(PROGRAM)

.c.o:
	$(CC) $*.c $(STDCFLAGS) $(XFORMINCDIR) $(MYSQLINC) $(XINC) 

clean:
	rm -f ${PROGRAM} $(OBJS) 

install:
	strip $(PROGRAM)
	$(INSTALL) -m 711 $(PROGRAM) $(INSTALLPATH)
	cp mysql.xpm $(PIXMAPPATH)

version:
	rm -f $(PROGRAM) $(OBJS)
	tar cvzf ../xmysqladmin-$(VERSION).tar.gz *














