/*
 * @(#)Imakefile	7.44 02/11/17
 *
 * Imakefile for cdda
 *
 *	cdda  - CD Digital Audio support
 *
 *   Copyright (C) 1993-2002  Ti Kan
 *   E-mail: xmcd@amb.org
 *
 *   This program is free software; you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License as published by
 *   the Free Software Foundation; either version 2 of the License, or
 *   (at your option) any later version.
 *
 *   This program is distributed in the hope that it will be useful,
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *   GNU General Public License for more details.
 *
 *   You should have received a copy of the GNU General Public License
 *   along with this program; if not, write to the Free Software
 *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 *
 */


/*
 * If your local X configuration is broken, you may need to muck with
 * the following RANLIB= lines.
 * On most System V platforms RANLIB should be set to /bin/true.
 * On BSD-derived systems RANLIB should be set to ranlib.
 */
#if defined(DoRanlibCmd) && (DoRanlibCmd == NO)
RANLIB= /bin/true
#endif


/**** Optional defines:  Change as you see fit. *****************************
 *
 * -DBSDCOMPAT
 *      Compiling under BSD-derived or BSD-like OS
 *
 * -DHAS_SETEUID
 *      The system supports the geteuid(2), seteuid(2), getegid(2) and
 *      setegid(2) system calls.
 *
 * -DAIX_IDE
 *	Enable the AIX IDE ioctl method.  This option must be used for
 *	AIX 4.x users that are using IDE CD-ROM drives who wants to use
 *	any of the CDDA modes.
 *
 * -DUSE_SYS_SOUNDCARD_H
 *	For OSS sound driver support, use the <sys/soundcard.h> header file
 *	instead of the one supplied with the xmcd source code package.
 *
 * -DNO_STDLIB_H
 *      The system does not support <stdlib.h>
 *
 * -DNO_UNISTD_H
 *      The system does not support <unistd.h>
 *
 * -DHAS_MMS
 *	On the Digital/Compaq/HP OSF1 platform, define this to enable
 *	MMS audio driver support code.  This is needed for the CDDA playback
 *	functionality.  However, not all systems have the <mme/*.h> header
 *	files and /usr/shlib/libmme.so library installed.  In this case
 *	-DHAS_MMS must not be defined in order to successfully compile xmcd.
 *
 * -DHAS_LAME
 *	Enable CD ripping to MP3 capability by using the LAME encoder.
 *
 * -DUSE_LIBMP3LAME
 *	Link in and use the LAME libmp3lame library instead of using the
 *	external LAME encoder program (lame(1)) for MP3 functionality.
 *
 * -DHAS_VORBIS
 *	Enable CD ripping to OGG capability by linking and using the
 *	Ogg Vorbis encoder libraries.
 */
#if defined(SYSTYPE_BSD43) || defined(BSD43) || defined(BSD) || \
    defined(FreeBSDArchitecture) || defined(NetBSDArchitecture) || \
    defined(OpenBSDArchitecture) || defined(BSDOSArchitecture) || \
    defined(sony_news) || \
    (defined(SunArchitecture) && OSMajorVersion == 4)
DEFINES=-DBSDCOMPAT -DHAS_SETEUID -DHAS_LAME -DHAS_VORBIS
#else
#if (defined(SunArchitecture) && OSMajorVersion >= 5) || \
    defined(LinuxArchitecture) || defined(AIXArchitecture) || \
    defined(UltrixArchitecture) || defined(USLArchitecture) || \
    defined(SVR4Architecture) || SystemV4 || \
    (defined(SCOArchitecture) && OSMajorVersion >= 5) || \
    defined(i386Sco325Architecture)
DEFINES= -DHAS_SETEUID -DHAS_LAME -DHAS_VORBIS
#else
#if defined(OsfArchitecture) || defined(OSF1Architecture)
DEFINES= -DBSDCOMPAT -DHAS_SETEUID -DHAS_MMS -DHAS_LAME -DHAS_VORBIS
#else   /* all others */
DEFINES= -DHAS_LAME -DHAS_VORBIS
#endif	/* OSF1 */
#endif  /* Linux Sun AIX Ultrix USL SVR4 */
#endif	/* BSD */

#if defined(FreeBSDArchitecture)
/* The following is BSD-make specific */
.if exists(/usr/include/camlib.h)
DEFINES+= -DFREEBSD_CAM
.endif
#endif

#if defined(LinuxArchitecture)
/* The following conditional is GNU-make specific */
alsalib_incl=	$(wildcard /usr/include/alsa/asoundlib.h)
alsalib_incl+=	$(wildcard /usr/local/include/alsa/asoundlib.h)

ifneq "$(strip $(alsalib_incl))" ""
DEFINES+= -DHAS_ALSA
endif
#endif

/*
 * Add local include path
 */
#if defined(BSDOSArchitecture)
INCLUDES=-I.. -I/sys -I/usr/local/include
#else
#if defined(LinuxArchitecture)
INCLUDES=-I.. -I/usr/src/linux/include -I/usr/local/include
#else
#if defined(OsfArchitecture) || defined(OSF1Architecture)
INCLUDES=-I.. -I/usr/include/mme -I/usr/local/include
#else
INCLUDES=-I.. -I/usr/local/include
#endif	/* OSF1 */
#endif  /* Linux */
#endif  /* BSD/OS */


/*
 * C Source files
 */
SRCS=	cdda.c \
	sysvipc.c \
	sem.c \
	rd_scsi.c \
	rd_sol.c \
	rd_linux.c \
	rd_fbsd.c \
	rd_aix.c \
	wr_oss.c \
	wr_sol.c \
	wr_irix.c \
	wr_hpux.c \
	wr_aix.c \
	wr_alsa.c \
	wr_osf1.c \
	wr_fp.c \
	wr_gen.c

/*
 * Object files
 */
OBJS=	cdda.o \
	sysvipc.o \
	sem.o \
	rd_scsi.o \
	rd_sol.o \
	rd_linux.o \
	rd_fbsd.o \
	rd_aix.o \
	wr_oss.o \
	wr_sol.o \
	wr_irix.o \
	wr_hpux.o \
	wr_aix.o \
	wr_alsa.o \
	wr_osf1.o \
	wr_fp.o \
	wr_gen.o

/*
 * Build rules for cdda handling library
 */
#ifdef InstallProgram
#undef InstallProgram
#define InstallProgram(program, dest)
#endif
#ifdef InstallManPage
#undef InstallManPage
#define InstallManPage(program, dir)
#endif

NormalLibraryTarget(cdda,$(OBJS))
DependTarget()

AllTarget(has_alsa)
SingleProgramTarget(has_alsa,has_alsa.o,,)

