###########################################################################
# Desc: Makefile for Mezzanine
# Author: Andrew Howard
# Date: 21 Mar 2001
# CVS: $Id: Makefile,v 1.6 2002/05/07 00:24:01 inspectorg Exp $
# Notes:
# - Requires the gtk+ 1.2.X library (gui toolkit), which is pretty standard.
# - Requires the gsl library (Gnu Scientific Library) which is in most
#   Linux distros.  You can also get it at http://sources.redhat.com/gsl
###########################################################################

include ../Makefile.opt

.SUFFIXES: .c .o

###########################################################################
# Options
###########################################################################

EXE = mezzanine
OBS = mezzanine.o fgrab.o classify.o blobfind.o dewarp.o ident.o \
			opt.o geom.o img.o

INCLUDES = -I../libmezz -I../libfg
CFLAGS = -g3 -Wall $(INCLUDES) 
CFLAGS += -DVERSION=\"$(VERSION)\" -DINSTALL_ETC=\"$(INSTALL_ETC)\"
LFLAGS = -lm -L../libmezz -lmezz -L../libfg -lfg
LFLAGS += -lgsl -lgslcblas

CC = gcc
LINKER = gcc
MAKEDEP = makedepend


###########################################################################
# Build section
###########################################################################

all: $(EXE)

$(EXE) : $(OBS)
	$(LINKER) $(OBS) $(LFLAGS) -o $(EXE)

%.o : %.c
	${CC} ${CFLAGS} -c $< -o $@

dep:
	$(MAKEDEP) $(INCLUDES) -Y -s "# Dependancies (generated by 'make dep')" *.c 2>/dev/null
	$(RM) -f Makefile.bak

clean:
	rm -f $(EXE) *~ *.o core


###########################################################################
# Symlinks
###########################################################################

symlinks:
	ln -sf ../shared/opt.c; ln -sf ../shared/opt.h
	ln -sf ../shared/geom.c; ln -sf ../shared/geom.h
	ln -sf ../shared/img.c; ln -sf ../shared/img.h
	ln -sf ../shared/color.h; ln -sf ../shared/err.h


###########################################################################
# Install
###########################################################################

install:
	$(MKDIR) -p $(INSTALL_BIN)
	$(MKDIR) -p $(INSTALL_ETC)	
	$(INSTALL) -m 755 mezzanine $(INSTALL_BIN)
	$(INSTALL) -m 644 mezzanine.opt $(INSTALL_ETC)/mezzanine.opt


# Dependancies (generated by 'make dep')

blobfind.o: opt.h mezzanine.h ../libmezz/mezz.h
classify.o: color.h geom.h opt.h mezzanine.h ../libmezz/mezz.h
dewarp.o: opt.h mezzanine.h ../libmezz/mezz.h
fgrab.o: ../libfg/capture.h ../libfg/frame.h err.h opt.h img.h mezzanine.h
fgrab.o: ../libmezz/mezz.h
geom.o: geom.h
ident.o: geom.h opt.h mezzanine.h ../libmezz/mezz.h
img.o: err.h img.h
mezzanine.o: err.h opt.h mezzanine.h ../libmezz/mezz.h
opt.o: err.h opt.h
