# $Id: Makefile,v 1.6 1994/07/20 13:59:31 queinnec Exp queinnec $

#-------------------------------------------------------------------------
#
# Configuration Options
#
#-------------------------------------------------------------------------

# Your C Compiler
# NOTE: must be ANSI compatible, use gcc if your standard compiler isn't!
#CC = gcc
CC = cc

# C flags
CFLAGS = -O -DCOMPRESS

# Linker
LD = $(CC)

# ld flags
LDFLAGS = -g

# ZDBSEXT is the extension used to identify the compressed database file. For
# 'gzip' it is '.gz' or for 'compress' it is '.Z' 
#
# ZDBSCAT is a command to cat a compressed database file. If using 'gzip' 
# for ZDBSCOMPRESS use 'gzcat' (if you have it) or 'gzip' (in which case 
# set ZDBSCATOPTS to -cd). For security you are advised to use an absolute path
#
# ZDBSCATOPTS specifies any options required for ZDBSCAT (e.g. -cd for gzip)
#
# If you don't want any support for compressed databases, remove the
# definition COMPRESS from the CFLAGS variable
#
# ATTENTION: these values must be the same as when compiling moviedb.

ZDBSEXT = .gz
ZDBSCAT = /usr/local/bin/gzip
ZDBSCATOPTS = -cd

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

# Where are the databases ?
# ATTENTION: you can *not* use DBDIR = `pwd`/dbs/
# (but you can use $(HOME)/dbs/)
DBDIR = /alt/moviedb/dbs/

# --------------------------------------------------------------------------
#
#
# Configure just like imoviedb, or read the description of each variable.
# Read MACHINES (Have I said it enough time?)

# Choose your pager program ("more" or "less")
MORE = less

# If you have read imoviedb/README, you know that you need the readline
# library.
# Tell me where it is installed.
READLINEINCDIR = /alt/include
READLINELIBDIR = /alt/lib

# If you have the vfork() system call, you should probably use it instead
# of fork(). 'man vfork' will probably tell you if it exists.
#VFORK = 1
VFORK = 0


# libreadline.a may need additional libraries (for instance -lbsd on Linux).
# See MACHINES for more information
#READLINEAUXLIBS = -lbsd
READLINEAUXLIBS = 

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

#
# SYSTEM SPECIFICS
# You probably have nothing to change here.

SHELL = /bin/sh

# If your make automatically sets the $(MAKE) variable, comment out
# the following line. Leaving it does no harm.
MAKE = make


# --------------------------------------------------------------------------
#
# YOU SHOULD HAVE NOTHING TO CHANGE AFTER HERE.

#
# The following are just to compile dbutils.c
# Meaningful values are useless (or meaningless values are useful)

RAWDIR = /dev/null
ETCDIR = /deb/null
ZLISTCOMPRESS = /bin/true
ZLISTEXT = .Z
ZLISTCAT = /bin/true
ZLISTCATOPTS = 
ZDBSCOMPRESS = /bin/true


EXEBIN =  templedit

EXE = $(EXEBIN)

SRC = templedit.c y-or-n.c rectify.c command.c atree.c readname.c exec.c
SPECIALSRC = dbutils.c

OBJ = $(SRC:.c=.o) $(SPECIALSRC:.c=.o)

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

CAUXFLAGS = -DDBDIR="\"$(DBDIR)\"" -DMORE="\"$(MORE)\"" -I"$(READLINEINCDIR)"

SPECIALCAUXFLAGS = -DZLISTCAT=\"$(ZLISTCAT)\" -DZLISTEXT=\"$(ZLISTEXT)\" \
            -DZDBSCAT=\"$(ZDBSCAT)\" -DZDBSEXT=\"$(ZDBSEXT)\" \
	    -DZDBSCATOPTS=\"$(ZDBSCATOPTS)\" \
	    -DZLISTCATOPTS=\"$(ZLISTCATOPTS)\" \
	    -DRAWDIR="\"$(RAWDIR)\"" -DDBDIR="\"$(DBDIR)\"" \
	    -DETCDIR="\"$(ETCDIR)\""

LDAUXFLAGS = -L"$(READLINELIBDIR)" -lreadline -ltermcap $(READLINEAUXLIBS)

#
# ----------------------------------------------------------------
#
# Compilation rules.
#

all : compile

compile : $(EXE)
	@echo 'All is compiled.'

templedit : $(OBJ)
	$(LD) $(LDFLAGS) -o templedit templedit.o y-or-n.o rectify.o \
	    command.o atree.o readname.o exec.o dbutils.o $(LDAUXFLAGS)

.c.o:
	$(CC) $(CFLAGS) $(CAUXFLAGS) -c $<

dbutils.o :
	$(CC) $(CFLAGS) $(SPECIALCAUXFLAGS) -c dbutils.c

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

clean : cleanobj

cleanobj :
	rm -f $(OBJ) $(EXE)
	rm -f Makefile.bak


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

# Automatic generation of dependencies. This uses gcc. You can also use
# the makedepend program distributed with X11.
#depend:
#	makedepend -- $(CFLAGS) $(CAUXFLAGS) -- $(SRC)

depend:
	mv -f Makefile Makefile.bak
	sed -n '1,/^# DO NOT DELETE THIS LINE/p' < Makefile.bak >Makefile
	echo '' >>Makefile
	gcc -MM $(CFLAGS) $(CAUXFLAGS) $(SRC) >>Makefile
	gcc -MM $(CFLAGS) $(SPECIALCAUXFLAGS) $(SPECIALSRC) >>Makefile

# Local variables:
# indent-tabs-mode: t
# fill-column: 500
# End:

# DO NOT WRITE ANYTHING AFTER THIS LINE. It will disappear with the next
# "make depend".
#
# DO NOT DELETE THIS LINE -- make depend depends on it.

templedit.o : templedit.c moviedb.h atree.h readname.h command.h constants.h \
  y-or-n.h rectify.h 
y-or-n.o : y-or-n.c constants.h y-or-n.h 
rectify.o : rectify.c constants.h rectify.h 
command.o : command.c atree.h constants.h command.h 
atree.o : atree.c constants.h atree.h 
readname.o : readname.c moviedb.h dbutils.h atree.h constants.h readname.h 
exec.o : exec.c moviedb.h dbutils.h constants.h exec.h 
dbutils.o : dbutils.c moviedb.h dbutils.h 
