## This is the makefile for dcd, dave's cd player.

# Select your compiler; gcc is probably just fine.
CC = gcc

# Prefix for installing dcd. `make install' will put files in PREFIX/bin
# and PREFIX/man/man1 .
PREFIX = /usr/local

# Is the system where dcd will be used connected to the 'net regularly?
# If so, uncomment the following line. (Even if you don't define this,
# you can tell dcd that the 'net is available with the 'c' command-line
# option.)
# NET = true

# Where should dcd look for CD Index entries? (relative to ~)
# This is the default, which you probably don't need to change.
# Not many CD players use the CD Index yet (http://www.cdindex.org/)
# so this may change as a "standard" emerges.
# CDI = .cdindex

# Where should dcd store its process ID? (relative to ~)
# This is the default, which you probably don't need to change.
# PID = .dcdpid

# Some CD-ROMs are a bit buggy, and take a second or two to switch
# tracks. The net result is that, usually, the last second or two
# of a track is cut off. If you have that problem, change this 'define'
# to be something greater than zero and uncomment it. (It's in seconds.)
# SLEEP = -DEXTRA_SLEEP_TIME=0

# This is your CD-ROM device. The default is /dev/cdrom so if you're okay
# with that, you don't even need to uncomment the next line.
# CDROM = /dev/cdrom

## Less-configurable stuff here.
RM = rm
STRIP = strip
AR = ar
RANLIB = ranlib


# Uncomment the next line to enable debugging flags. This will bloat the
# programs, and dump all sorts of mildly-useful stuff to stderr.
# In all likelihood you never want to do this. BTW, defining DEBUG as 1
# will put in some debugging, and defining it > 1 puts in bucketloads of it.
# DEBUG = 1



## Here be dragons... (Non-configurable parts past here.)

ifdef DEBUG
EXTRA_CFLAGS = -DDEBUG=${DEBUG} -Wall -pedantic -g
else
EXTRA_CFLAGS = -O2
endif

ifdef CDROM
EXTRA_CFLAGS += -DCDROM_DEVICE=\"${CDROM}\"
endif

ifdef CDI
EXTRA_CFLAGS += -DCDINDEX_HOME=\"${CDI}\"
endif

ifdef PID
EXTRA_CFLAGS += -DPIDFILE=\"${PID}\"
endif

ifdef NET
EXTRA_CFLAGS += -DNETWORK_CAPABLE=TRUE
endif

ifdef SLEEP
EXTRA_CFLAGS += ${SLEEP}
endif

PROGS = dcd
OBJECTS = screenop.o infinite.o libcdplay.o process.o \
	sha.o base64.o cdindex.o cd-misc.o dcd.o
SRCS = screenop.c screenop.h infinite.c infinite.h libcdplay.c libcdplay.h \
       process.c process.h dcd.c dcd.h sha.c sha.h base64.c base64.h \
       endian.h version.h cdindex.c cdindex.h cd-misc.h cd-misc.c

all: ${PROGS}

.c.o:
	$(CC) -c $(CFLAGS) ${EXTRA_CFLAGS} $< -o $@
 
${PROGS}: ${OBJECTS}
	${CC} ${CFLAGS} ${EXTRA_CFLAGS} ${OBJECTS} ${STATLIB} -o $@

clean:;
	-${RM} *.o ${PROGS}

install: dcd
	install -m 755 -d ${PREFIX}/bin
	install -m 755 -s dcd ${PREFIX}/bin
	install -m 755 -d ${PREFIX}/man/man1
	install -m 644 dcd.1 ${PREFIX}/man/man1
	install -m 755 -d ${HOME}/${CDI}

depend:
	makedepend -- ${CFLAGS} ${EXTRA_CFLAGS} -- ${SRCS}

# DO NOT DELETE

