#################################################################
# $Id: Makefile,v 1.72 2003/05/22 16:44:29 dm Exp $
#
#     This file is part of the
#
#     GRammar vISUalization tool (GRISU)
#
#     Developed by Holger Wunsch and Detmar Meurers
#     Copyright (C) 1998-2003 by the developers
#     All rights reserved
#
#     Seminar fr Sprachwissenschaft, Universitt Tbingen and
#     Department of Linguistics, The Ohio State University
#
#     This program is free software; you can redistribute it and/or modify
#     it under the terms of the GNU General Public License as published by
#     the Free Software Foundation; either version 2 of the License, or
#     (at your option) any later version.
#
#     This program 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 General Public License for more details.
#
#     You should have received a copy of the GNU General Public License
#     along with this program; if not, write to the Free Software
#     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
#
#
#################################################################
#
# Grisu has been built on the platforms listed below. 
# Uncomment the one that meets your configuration. 

# --- Solaris targets ----

# Solaris 7 or 8 with KDE2
#TARGET = Solaris_KDE2_OSU
#TARGET = Solaris_KDE2_SfS

# Solaris 7 or 8 with KDE3
TARGET = Solaris_KDE3

# --- LINUX targets ----

# SuSE Linux 7.1 with KDE2
#TARGET = SuSe_KDE2

# SuSE Linux 8.0 with KDE3
#TARGET = SuSe_KDE3

# SuSE Linux 8.1 with KDE3
#TARGET = SuSe81_KDE3

# RedHat Linux 7.2 with KDE2
#TARGET = RedHat_KDE2

# RedHat Linux 7.3 with KDE3
#TARGET = RedHat_KDE3

# RedHat Linux 8.0 with KDE3
#TARGET = RedHat8_KDE3

# Red Hat Linux 9.0 (KDE 3.1)
#TARGET = RedHat9

# Mandrake Linux 9.0 with KDE3
#TARGET = Mandrake9_KDE3

# Debian GNU/Linux (Woody) with KDE2
#TARGET = Debian_KDE2

# --------------------------

# Directory in which the icons for our application live
# Note: most targets below change this setting
ICONDIR = '"/this/is/the/path/to/the/pics/directory"'

# Here come the definitions for the different target platforms. 
# You should check if the paths are the same on your system.

ifeq ($(TARGET), Solaris_KDE2_OSU)
INCLUDE = -I. -I/opt/local/kde/include -I/opt/local/qt/include -I/usr/openwin/include -I/opt/local/include -I/usr/local/include
LIBDIR  = -L. -L/opt/local/kde/lib -L/opt/local/qt/lib -L/usr/openwin/lib  -L/opt/local/lib -L/usr/local/lib -R/opt/local/kde/lib -R/opt/local/qt/lib
LIBS    = -lkdeui -lkdecore -lkfile -lkio -lkdefakes -lDCOP -ljpeg -lqt  -lX11  -ltiff  -lsocket -lstdc++ -lnsl
DEFINES = -D_SOLARIS -DRESOURCE_PATH=$(ICONDIR)
MOCCOMPILE = /opt/local/qt/bin/moc
ICONDIR = '"/home/projects/milca/systems/grisu/pics"'
endif

ifeq ($(TARGET), Solaris_KDE2_SfS)
INCLUDE =  -I. -I/afs/sfs/@sys/kde222/include -I/afs/sfs/@sys/qt231/include -I/usr/openwin/include -I/usr/local/include
LIBDIR  =  -L. -L/afs/sfs/@sys/kde222/lib -L/afs/sfs/@sys/qt231/lib -L/usr/openwin/lib -L/usr/local/lib -R/afs/sfs/@sys/kde222/lib -R/afs/sfs/@sys/qt231/lib -R/usr/openwin/lib -R/usr/local/lib
LIBS    = -lkdeui -lkdecore -lkfile -lkio -lkdefakes -lDCOP -ljpeg -lqt  -lX11  -ltiff  -lsocket -lstdc++ -lnsl -lksycoca -lkdesu -lkssl
DEFINES = -D_SOLARIS -DRESOURCE_PATH=$(ICONDIR)
MOCCOMPILE = /afs/sfs/@sys/qt-224/bin/moc
ICONDIR = '"/home/milca/a4/systems/grisu/pics"'
endif

ifeq ($(TARGET), Solaris_KDE3)
KDE=/opt/kde3
QT=/opt/qt3
ICONDIR = '"/home/projects/milca/systems/grisu/pics/standard"'
INCLUDE = -I. -I$(KDE)/include -I$(QT)/include -I/usr/openwin/include -I/opt/local/include -I/usr/local/include
LIBDIR  = -L. -L$(KDE)/lib -L$(QT)/lib -R$(KDE)/lib -R$(QT)/lib -L/usr/openwin/lib -L/opt/local/lib
LIBS    = -lkdeui -lkdecore -lkio -lkdefakes -lkdefx -lDCOP -ljpeg -lqt-mt  -lX11  -ltiff  -lsocket -lstdc++ -lnsl
DEFINES = -D_SOLARIS -DRESOURCE_PATH=$(ICONDIR)
MOCCOMPILE = $(QT)/bin/moc
endif

# SuSE Linux 7.1, KDE2
ifeq ($(TARGET), SuSe_KDE2)
INCLUDE = -I/opt/kde2/include -I/usr/lib/qt-2.2.3/include -I/usr/X11R6/include -I.
LIBDIR = -L. -L/usr/X11R6/lib -L/opt/kde2/lib -L/usr/lib/qt-2.2.3/lib
LIBS    = -lkdeui -lkdecore -lkfile  -lqt -lXext -lX11 -lc -lg++
DEFINES = -D_LINUX -DRESOURCE_PATH=$(ICONDIR)
MOCCOMPILE = /usr/lib/qt-2.2.3/bin/moc
ICONDIR = '"/home/wunsch/grisu/pics"'
endif

#SuSE Linux 8.0, KDE3
ifeq ($(TARGET), SuSe_KDE3)
INCLUDE = -I/opt/kde3/include -I/usr/lib/qt3/include -I/usr/X11R6/include -I.
LIBDIR = -L. -L/usr/X11R6/lib -L/opt/kde3/lib -L/usr/lib/qt3/lib
LIBS    = -lkdeui -lkdecore -lkio
DEFINES = -D_LINUX -DRESOURCE_PATH=$(ICONDIR)
MOCCOMPILE = /usr/lib/qt3/bin/moc
ICONDIR = '"/home/wunsch/grisu/pics"'
endif

#SuSE Linux 8.1, KDE3
ifeq ($(TARGET), SuSe81_KDE3)
INCLUDE = -I/opt/kde3/include -I/usr/lib/qt3/include -I/usr/X11R6/include -I.
LIBDIR = -L. -L/usr/X11R6/lib -L/opt/kde3/lib -L/usr/lib/qt3/lib
LIBS    = -lkdeui -lkdecore -lkio
DEFINES = -D_LINUX -DRESOURCE_PATH=$(ICONDIR)
MOCCOMPILE = /usr/lib/qt3/bin/moc
ICONDIR = '"/home/wunsch/grisu/pics"'
endif

#RedHat Linux 7.3, KDE3
ifeq ($(TARGET), RedHat_KDE3)
INCLUDE = -I/usr/include/kde -I/usr/lib/qt3/include -I/usr/X11R6/include -I.
LIBDIR = -L. -L/usr/X11R6/lib -L/usr/lib/kde3 -L/usr/lib/qt3/lib
LIBS    = -lkdeui -lkdecore -lkio -lqt -lXext -lX11 -lc
DEFINES = -D_LINUX -DRESOURCE_PATH=$(ICONDIR)
MOCCOMPILE = /usr/bin/moc
endif

#RedHat Linux 8.0, KDE3
ifeq ($(TARGET), RedHat8_KDE3)
INCLUDE = -I/usr/include/kde -I/usr/lib/qt3/include -I/usr/X11R6/include -I.
LIBDIR = -L. -L/usr/X11R6/lib -L/usr/lib/kde3 -L/usr/lib/qt3/lib
LIBS    = -lkdeui -lkdecore -lkio -lqt -lXext -lX11 -lc
DEFINES = -D_LINUX -DRESOURCE_PATH=$(ICONDIR)
MOCCOMPILE = /usr/bin/moc
endif

#Red Hat Linux 9.0, KDE 3.1
ifeq ($(TARGET), RedHat9)
INCLUDE = -I/usr/include/kde -I/usr/lib/qt-3.1/include -I/usr/X11R6/include -I.
LIBDIR = -L. -L/usr/X11R6/lib -L/usr/lib/qt-3.1/lib
LIBS    = -lkdeui -lkdecore -lkio -lqt
DEFINES = -D_LINUX -DRESOURCE_PATH=$(ICONDIR)
MOCCOMPILE = /usr/bin/moc
endif

#RedHat Linux 7.2, KDE2
ifeq ($(TARGET), RedHat_KDE2)
INCLUDE = -I/usr/include/kde -I/usr/lib/qt-2.3.1/include -I/usr/X11R6/include -I.
LIBDIR = -L. -L/usr/X11R6/lib -L/usr/lib/kde2 -L/usr/lib/qt-2.3.1/lib
LIBS    = -lkdeui -lkdecore -lkfile  -lqt -lXext -lX11 -lc
DEFINES = -D_LINUX -DRESOURCE_PATH=$(ICONDIR)
MOCCOMPILE = /usr/bin/moc
ICONDIR = '"/home/fr/TRALE/grisu-v-1-1-5/pics"'
endif

#Mandrake Linux 9.0, KDE3
ifeq ($(TARGET), Mandrake9_KDE3)
INCLUDE = -I/opt/kde3/include -I/usr/lib/qt3/include -I/usr/X11R6/include -I.
LIBDIR = -L. -L/usr/X11R6/lib -L/opt/kde3/lib -L/usr/lib/qt3/lib
LIBS    = -lkdeui -lkdecore -lkio
DEFINES = -D_LINUX -DRESOURCE_PATH=$(ICONDIR)
MOCCOMPILE = /usr/lib/qt3/bin/moc
ICONDIR = '"/home/wunsch/grisu/pics"'
endif

# Debian GNU/Linux, KDE2
ifeq ($(TARGET), Debian_KDE2)
INCLUDE = -I/usr/include/kde -I/usr/include/qt -I/usr/X11R6/include -I.
LIBDIR = -L. -L/usr/X11R6/lib -L/usr/lib/kde2
LIBS    = -lkdeui -lkdecore -lkfile  -lqt -lXext -lX11 -lc
DEFINES = -D_LINUX -DRESOURCE_PATH=$(ICONDIR)
MOCCOMPILE = /usr/bin/moc
ICONDIR = '"/home/adamp/nlp/grisu/pics"'
endif

########################################################
# C++ Compiler

# Your C++ compiler. The value may include a path.
GPP = g++

# include debug code
#CXXCOMPILE = $(GPP) -g -ggdb

# include debug code and profiling information
#CXXCOMPILE = $(GPP) -pg

# optimized release
CXXCOMPILE = $(GPP) -O2 -fno-strength-reduce -fomit-frame-pointer -fPIC

########################################################
# Additional options for linking
LINKOPTIONS =

########################################################
# The command to build the Grisu API documentation
KDOC	   = doxygen doc/grisudoc.cfg

########################################################
# Never touch anything beyond this line
########################################################
SOURCES = main.cpp data.cpp mainw.cpp canvas.cpp scrollcanvas.cpp drawer.cpp options.cpp vcanvas.cpp slider.cpp node.cpp il.cpp yylex.cpp dataparser.cpp NodeAddress.cpp idtree.cpp find.cpp StrucFindDialogData.cpp StrucFindDialog.cpp compare.cpp gbuffer.cpp gdataexchange.cpp tools.cpp gspacingdialog.cpp glatexrenderer.cpp

OBJECTS = main.o data.o mainw.o canvas.o scrollcanvas.o drawer.o options.o vcanvas.o slider.o node.o yylex.o il.o dataparser.o NodeAddress.o idtree.o StrucFindDialogData.o StrucFindDialog.o find.o compare.o gbuffer.o gdataexchange.o tools.o gspacingdialog.o glatexrenderer.o

MOC	= mainw.moc canvas.moc vcanvas.moc options.moc slider.moc StrucFindDialogData.moc StrucFindDialog.moc gdataexchange.moc gspacingdialog.moc


default: all


clean:
	rm -f *.o *.moc *~ *.bak \#*\# grisu

all: grisu

# Bison is somewhat problematic in that it doesn't produce
# proper C++ code in version 1.28 and there is a bug in 1.35
# which results in the stack not being able to grow. To generate
# il.cpp from il.y one thus needs something like version 1.33.
#
# Since il.cpp comes with the distribtion, you can just use that file.
# If you want to rebuild il.cpp, call make bison.
bison:
	bison -d -o il.cpp il.y

depend:
	@makedepend -I$(INCDIR) $(SOURCES) 2> /dev/null


documentation: 
	$(KDOC)


.SUFFIXES: .cpp .c

.cpp.o:
	$(CXXCOMPILE) $(INCLUDE) $(DEFINES) -c $<


grisu:    $(MOC) $(OBJECTS) $(SOURCES)
	$(GPP) $(LINKOPTIONS) -o grisu $(OBJECTS) $(LIBDIR) $(LIBS)

mainw.moc: mainw.h
	$(MOCCOMPILE) mainw.h -o mainw.moc

options.moc: options.h
	$(MOCCOMPILE) options.h -o options.moc

canvas.moc: canvas.h
	$(MOCCOMPILE) canvas.h -o canvas.moc

vcanvas.moc: vcanvas.h
	$(MOCCOMPILE) vcanvas.h -o vcanvas.moc

slider.moc: slider.h
	$(MOCCOMPILE) slider.h -o slider.moc

StrucFindDialogData.moc: StrucFindDialogData.h
	$(MOCCOMPILE) StrucFindDialogData.h -o StrucFindDialogData.moc

StrucFindDialog.moc: StrucFindDialog.h
	$(MOCCOMPILE) StrucFindDialog.h -o StrucFindDialog.moc

gdataexchange.moc: gdataexchange.h
	$(MOCCOMPILE) gdataexchange.h -o gdataexchange.moc

gspacingdialog.moc: gspacingdialog.h
	$(MOCCOMPILE) gspacingdialog.h -o gspacingdialog.moc



# DO NOT DELETE THIS LINE -- make depend depends on it.
