# cdda_paranoia makefile.in ready to go for autoconf.

# DO NOT EDIT BELOW! ##########################################################
# (unless, of course, you know what you are doing :) ##########################

VPATH=@srcdir@
srcdir=@srcdir@

@SET_MAKE@
FLAGS=@SBPCD_H@ @UCDROM_H@ @TYPESIZES@ @CFLAGS@
OPT=@OPT@ $(FLAGS)
DEBUG=@DEBUG@ -DCDDA_TEST
CC=@CC@
LD=@CC@
LDFLAGS=@LDFLAGS@ $(FLAGS)
AR=@AR@
RANLIB=@RANLIB@
LIBS = -lm -lrt @LIBCAM@
CPPFLAGS+=-D_REENTRANT

OFILES = scan_devices.o	common_interface.o cooked_interface.o interface.o\
	scsi_interface.o smallft.o toc.o test_interface.o

export VERSION

all: lib slib

debug: 
	$(MAKE) libcdda_interface.a CFLAGS="$(DEBUG)"

lib:	
	$(MAKE) libcdda_interface.a CFLAGS="$(OPT)" 

slib:	
	$(MAKE) lessmessy
	$(MAKE) libcdda_interface.so CFLAGS="$(OPT) -fpic" 
	[ -e libcdda_interface.so.0 ] || ln -s libcdda_interface.so libcdda_interface.so.0

test:	
	$(MAKE) libcdda_interface.a CFLAGS="$(DEBUG)"
	$(CC) $(DEBUG) -c test.c
	$(LD) $(DEBUG) test.o $(LDFLAGS) -o cdda_test $(LIBS) libcdda_interface.a

libcdda_interface.a: 	$(OFILES)	
	$(AR) -r libcdda_interface.a $(OFILES)
	$(RANLIB) libcdda_interface.a

libcdda_interface.so: 	$(OFILES)	
	$(CC) -fpic -shared -o libcdda_interface.so.0.$(VERSION) -Wl,-soname -Wl,libcdda_interface.so.0 $(OFILES) $(LIBS)
	[ -e libcdda_interface.so.0 ] || ln -s libcdda_interface.so.0.$(VERSION) libcdda_interface.so.0
	[ -e libcdda_interface.so ] || ln -s libcdda_interface.so.0.$(VERSION) libcdda_interface.so

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

lessmessy:
	-rm  -f *.o core *~ *.out

clean: lessmessy
	-rm -f *.a *.so *.so.0 *.so.*

distclean: clean
	-rm -f  Makefile
