CC = gcc
CFLAGS = -g -O2
LDFLAGS = -lcdaudio
LIBS = 
DEFS =  
INSTALL = /usr/bin/install -c

# Installation directories
prefix = ${DESTDIR}/usr
exec_prefix = ${prefix}
mandir = ${prefix}/man/man1
bindir = ${exec_prefix}/bin
etcdir = ${DESTDIR}/etc

INCL = 
SRCS = cd-discid.c
OBJS = $(SRCS:.c=.o)

.SUFFIXES: .c .o

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

all: cd-discid

cd-discid: $(OBJS)
	$(CC) $(LDFLAGS) -o $@ $(OBJS) $(LIBS)

clean:
	rm -f *~ *.o core cd-discid

install: cd-discid
	$(INSTALL) -d -m 755 $(bindir)
	$(INSTALL) -m 755 -o 0 cdgrab $(bindir)
	$(INSTALL) -s -m 755 -o 0 cd-discid $(bindir)
	$(INSTALL) -d -m 755 $(mandir)
	$(INSTALL) -m 644 -o 0 cd-discid.1 $(mandir)
	$(INSTALL) -m 644 -o 0 cdgrab.1 $(mandir)
	$(INSTALL) -m 644 -o 0 cdgrab.conf $(etcdir)
