/*
 * @(#)Imakefile	7.45 02/11/18
 *
 * Imakefile for xmcd
 *
 *	xmcd - Motif(R) CD Audio Player/Ripper
 *
 *   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 supports Motif correctly, the
 * following LOCAL_LIBRARIES= declaration should work just fine.
 * If it fails, try uncommenting the #include lines below.  If that
 * still fails, then substitute the LOCAL_LIBRARIES= line with
 * one of the these:
 *
 * LOCAL_LIBRARIES= $(XMLIB) $(XTOOLLIB) $(EXTENSIONLIB) $(XLIB)
 *
 * or,
 *
 * LOCAL_LIBRARIES= -lXm -lXt -lXext -lX11
 *
 */

/*
 * #include "Motif.tmpl"
 * #include "Motif.rules"
 */

CDDBLIB= -L../cddb_d -lcddb
LOCAL_LIBDIR= -L/usr/local/lib
VORBLIB= -lvorbisenc -lvorbis -logg

/* Add the following if -DUSE_LIBMP3LAME is defined in cdda_d/Imakefile.
 * LAMELIB= -lmp3lame
 */


#if defined(LinuxArchitecture)
/* On Linux the -lc is needed to prevent potential internal symbol
 * name clashes between libc and libstdc++.
 */
SYS_LIBRARIES= -lc $(CDDBLIB) $(LOCAL_LIBDIR) $(LAMELIB) $(VORBLIB) -lm

/* 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))" ""
SYS_LIBRARIES+= -lasound
endif
#else
#if defined(OsfArchitecture) || defined(OSF1Architecture)
SYS_LIBRARIES= $(CDDBLIB) $(LOCAL_LIBDIR) $(LAMELIB) $(VORBLIB) -L/usr/ccs/lib -lmme -liconv -lrt -lm
#else
#if defined(AIXArchitecture)
SYS_LIBRARIES= $(CDDBLIB) $(LOCAL_LIBDIR) $(LAMELIB) $(VORBLIB) -liconv -lm
#else
#if defined(SGIArchitecture)
SYS_LIBRARIES= $(CDDBLIB) $(LOCAL_LIBDIR) $(LAMELIB) $(VORBLIB) -laudio -lm
#else
SYS_LIBRARIES= $(CDDBLIB) $(LOCAL_LIBDIR) $(LAMELIB) $(VORBLIB) -lm
#endif	/* SGI Irix */
#endif	/* AIX */
#endif	/* OSF1 */
#endif	/* Linux */

LOCAL_LIBRARIES= XmClientLibs

#if defined(FreeBSDArchitecture)
.if exists(/usr/include/camlib.h)
LOCAL_LIBRARIES+= -lcam
.endif
#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.
 *
 * -DNO_STDLIB_H
 *	The system does not support <stdlib.h>
 *
 * -DNO_UNISTD_H
 *	The system does not support <unistd.h>
 *
 * -DNO_LABELH
 *	The use of the LabelH widget causes a crash on some X11R5 systems.
 *	Add this to disable the use of the LabelH widget.
 *
 * -DUSE_GETWD
 *	Use the getwd(3) function to determine the current working directory
 *	instead of getcwd(3).  This is only used if -DBSDCOMPAT is also
 #	defined.
 *
 * -DEDITRES
 *	Enable editres(1) support.  This feature is only effective
 *	when compiling under X11R5 or later.
 */
#if defined(SYSTYPE_BSD43) || defined(BSD43) || defined(BSD) || \
    defined(FreeBSDArchitecture) || defined(NetBSDArchitecture) || \
    defined(OpenBSDArchitecture) || defined(BSDOSArchitecture) || \
    defined(OsfArchitecture) || defined(OSF1Architecture) || \
    defined(sony_news) || \
    (defined(SunArchitecture) && OSMajorVersion == 4)
DEFINES= -DBSDCOMPAT -DHAS_SETEUID
#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
#else	/* all others */
DEFINES=
#endif	/* Linux Sun5 AIX Ultrix USL SVR4 SCO325 */
#endif	/* BSD OSF1 sony_news Sun4 */


/*
 * Add local include path
 */
INCLUDES=-I..


/*
 * C Source files
 */
SRCS=	callback.c \
	cdfunc.c \
	command.c \
	dbprog.c \
	geom.c \
	help.c \
	hotkey.c \
	main.c \
	userreg.c \
	widget.c \
	wwwwarp.c

/*
 * Objects
 */
#if defined(__QNX__)
OBJS=	callback.o \
	cdfunc.o \
	command.o \
	dbprog.o \
	geom.o \
	help.o \
	hotkey.o \
	main.o \
	userreg.o \
	widget.o \
	wwwwarp.o \
	../labelh_d/LabelH3r.lib \
	../cdinfo_d/cdinfo3r.lib \
	../cddb_d/cddbkey3r.lib \
	../libdi_d/di3r.lib \
	../cdda_d/cdda3r.lib \
	../common_d/util3r.lib
#else
OBJS=	callback.o \
	cdfunc.o \
	command.o \
	dbprog.o \
	geom.o \
	help.o \
	hotkey.o \
	main.o \
	userreg.o \
	widget.o \
	wwwwarp.o \
	../labelh_d/libLabelH.a \
	../cdinfo_d/libcdinfo.a \
	../cddb_d/libcddbkey.a \
	../libdi_d/libdi.a \
	../cdda_d/libcdda.a \
	../common_d/libutil.a
#endif


/*
 * Build rule for the main module
 */
#ifdef InstallProgram
#undef InstallProgram
#define InstallProgram(program, dest)
#endif
#ifdef InstallManPage
#undef InstallManPage
#define InstallManPage(program, dir)
#endif

ComplexProgramTarget(xmcd)


