1/*
2 * @(#)Imakefile	6.82 04/03/25
3 *
4 * Imakefile for cda
5 *
6 *	cda - Command-line CD Audio Player/Ripper
7 *
8 *   Copyright (C) 1993-1999  Ti Kan
9 *   E-mail: xmcd@amb.org
10 *
11 *   This program is free software; you can redistribute it and/or modify
12 *   it under the terms of the GNU General Public License as published by
13 *   the Free Software Foundation; either version 2 of the License, or
14 *   (at your option) any later version.
15 *
16 *   This program is distributed in the hope that it will be useful,
17 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
18 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19 *   GNU General Public License for more details.
20 *
21 *   You should have received a copy of the GNU General Public License
22 *   along with this program; if not, write to the Free Software
23 *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
24 *
25 */
26
27
28/**** Optional defines:  Change as you see fit. *****************************
29 *
30 * -DNO_STDLIB_H
31 *	The system does not support <stdlib.h>
32 *
33 * -DNO_UNISTD_H
34 *	The system does not support <unistd.h>
35 *
36 * -DHAS_ICONV_H (Linux only)
37 *	The system has <iconv.h> and the iconv(3) library call.
38 *
39 * -DHAS_NCURSES_H (BSD/OS only)
40 *	The system has <ncurses.h> and the ncurses library.
41 *
42 * -D_IRIX6
43 *	This is a SGI IRIX 6.x system.
44 *
45 * -D_SCO5
46 *	This is a SCO Open Server Release 5 system.
47 *
48 * All other platform-specific feature setup are in common_d/config.h
49 *
50 */
51#if defined(LinuxArchitecture)
52/* The following conditional is GNU-make specific */
53ifeq "$(wildcard /usr/include/iconv.h)" "/usr/include/iconv.h"
54DEFINES= -DHAS_ICONV_H
55endif
56#else
57#if defined(BSDOSArchitecture) || defined(__bsdi__)
58.if exists(/usr/include/ncurses.h)
59DEFINES= -DHAS_NCURSES_H
60.endif
61#else
62#if defined(SGIArchitecture) && OSMajorVersion >= 6
63DEFINES= -D_IRIX6
64#else
65#if (defined(SCOArchitecture) || defined(i386ScoArchitecture)) && \
66    (defined(i386Sco325Architecture) || OSMajorVersion >= 5)
67DEFINES= -D_SCO5
68#else	/* all others */
69DEFINES=
70#endif	/* SCO5 */
71#endif	/* IRIX6 */
72#endif	/* BSD/OS */
73#endif	/* Linux */
74
75
76/*
77 * POSIX threads stuff
78 */
79#if defined(OsfArchitecture) || defined(OSF1Architecture)
80THREADS_CFLAGS= -pthread
81THREADS_LDFLAGS= -pthread
82#endif
83
84#if defined(USLArchitecture) && defined(i386Architecture)
85/* UnixWare 7, Caldera Open UNIX 8 only.  UnixWare 2.x, UnixWare 1.x,
86 * SVR4.2/386 and SVR4.0/386 please comment out the following two lines.
87 */
88THREADS_CFLAGS= -Kpthread
89THREADS_LDFLAGS= -Kpthread
90#endif
91
92#if defined(SunArchitecture) && OSMajorVersion >= 5
93/* Solaris 2.5 and later */
94THREADS_DEFINES= -D_REENTRANT
95THREADS_LIBS= -lpthread
96#endif
97
98#if defined(SGIArchitecture) && HasPosixThreads
99/* IRIX 6.3 or later */
100THREADS_LIBS= -lpthread
101#endif
102
103#if defined(AIXArchitecture) && \
104    ((OSMajorVersion == 4 && OSMinorVersion >= 1) || OSMajorVersion > 4)
105/* AIX 4.1 and later */
106THREADS_DEFINES= -D_THREAD_SAFE=1
107THREADS_LIBS= -lpthreads
108#endif
109
110#if defined(HPArchitecture) && OSMajorVersion >= 11
111/* HP-UX 11.0 and later */
112THREADS_DEFINES= -D_POSIX_C_SOURCE=199506
113THREADS_LIBS= -lpthread
114#endif
115
116#if defined(LinuxArchitecture) && HasPosixThreads
117/* Linux with glibc 2.1 or later */
118THREADS_DEFINES= -D_REENTRANT
119THREADS_LIBS= -lpthread
120#endif
121
122#if defined(FreeBSDArchitecture) && HasPosixThreads
123/* FreeBSD 4.x and later */
124THREADS_CFLAGS= -pthread
125THREADS_LDFLAGS= -pthread
126#endif
127
128
129/*
130 * Add standard and local include paths
131 */
132#if (defined(SunArchitecture) && OSMajorVersion == 4)
133STD_INCLUDES=-I/usr/5include
134#else
135#if defined(LinuxArchitecture)
136STD_INCLUDES=-I/usr/include/ncurses
137#else	/* all others */
138STD_INCLUDES=
139#endif	/* LinuxArchitecture */
140#endif	/* SunArchitecture */
141
142INCLUDES=-I..
143
144
145/*
146 * Add needed libraries
147 */
148CDDBLIB= -L../cddb_d -lcddblocal
149LOCAL_LIBDIR= -L/usr/freeware/lib32 -L/usr/local/lib
150VORBLIB= -lvorbisenc -lvorbis -logg
151FLACLIB= -lFLAC
152ENCLIBS= $(LOCAL_LIBDIR) $(FLACLIB) $(VORBLIB)
153
154
155#if defined(LinuxArchitecture)
156/* On Linux the -lc is needed to prevent potential internal symbol
157 * name clashes between libc and libstdc++.
158 */
159SYS_LIBRARIES= -lc $(CDDBLIB) $(ENCLIBS) -lm
160
161/* The following conditional is GNU-make specific:
162 * Try to auto-detect ALSA headers and library.
163 */
164alsalib_incl=	$(wildcard /usr/include/alsa/asoundlib.h)
165alsalib_incl+=	$(wildcard /usr/local/include/alsa/asoundlib.h)
166ifneq "$(strip $(alsalib_incl))" ""
167SYS_LIBRARIES+= -lasound -ldl
168endif
169#else
170#if (defined(SunArchitecture) && OSMajorVersion >= 5)
171SYS_LIBRARIES= $(CDDBLIB) $(ENCLIBS) -lm -lposix4
172#else
173#if defined(OsfArchitecture) || defined(OSF1Architecture)
174SYS_LIBRARIES= $(CDDBLIB) $(ENCLIBS) -L/usr/ccs/lib -lmme -liconv -lrt -lm
175#else
176#if defined(AIXArchitecture)
177SYS_LIBRARIES= $(CDDBLIB) $(ENCLIBS) -liconv -lm
178#else
179#if defined(SGIArchitecture)
180SYS_LIBRARIES= $(CDDBLIB) $(ENCLIBS) -laudio -lmediad -lm
181#else
182SYS_LIBRARIES= $(CDDBLIB) $(ENCLIBS) -lm
183#endif	/* SGI Irix */
184#endif	/* AIX */
185#endif  /* OSF1 */
186#endif	/* Sun5 */
187#endif	/* Linux */
188
189#if (defined(SunArchitecture) && OSMajorVersion == 4)
190LOCAL_LIBRARIES=-L/usr/5lib -lcurses
191#else
192#if defined(LinuxArchitecture)
193LOCAL_LIBRARIES=-lncurses
194#else
195#if defined(FreeBSDArchitecture)
196LOCAL_LIBRARIES=-lncurses
197.if exists(/usr/include/camlib.h)
198LOCAL_LIBRARIES+= -lcam
199.endif
200#else
201#if defined(NetBSDArchitecture)
202LOCAL_LIBRARIES=
203#else
204#if defined(BSDOSArchitecture) || defined(__bsdi__)
205.if exists(/usr/include/ncurses.h)
206LOCAL_LIBRARIES=-lncurses
207.else
208LOCAL_LIBRARIES=
209.endif
210#else
211#if defined(OpenBSDArchitecture)
212LOCAL_LIBRARIES=-lncurses -ltermlib
213#else
214#if defined(UltrixArchitecture)
215LOCAL_LIBRARIES=-lcursesX
216#else
217#if defined(SNIArchitecture)
218LOCAL_LIBRARIES=/usr/ccs/lib/libcurses.a
219#else
220#if defined(__QNX__)
221LOCAL_LIBRARIES=-lncurses
222#else
223LOCAL_LIBRARIES=-lcurses
224#endif	/* __QNX__ */
225#endif	/* SINIX */
226#endif	/* ultrix */
227#endif	/* OpenBSDArchitecture */
228#endif	/* BSD/OS */
229#endif	/* NetBSDArchitecture */
230#endif	/* FreeBSDArchitecture */
231#endif	/* LinuxArchitecture OpenBSDArchitecture */
232#endif	/* SunArchitecture */
233
234MANSUFFIX=1
235
236/*
237 * C Source files
238 */
239SRCS=	cda.c \
240	userreg.c \
241	visual.c
242
243
244/*
245 * Objects to build cda
246 */
247#if defined(__QNX__)
248OBJS=	cda.o \
249	userreg.o \
250	visual.o \
251	../cdinfo_d/cdinfo3r.lib \
252	../cddb_d/cddbkey3r.lib \
253	../libdi_d/di3r.lib \
254	../cdda_d/cdda3r.lib \
255	../common_d/util3r.lib
256#else
257OBJS=	cda.o \
258	userreg.o \
259	visual.o \
260	../cdinfo_d/libcdinfo.a \
261	../cddb_d/libcddbkey.a \
262	../libdi_d/libdi.a \
263	../cdda_d/libcdda.a \
264	../common_d/libutil.a
265#endif
266
267
268/*
269 * Build rule for cda
270 */
271#ifdef InstallProgram
272#undef InstallProgram
273#define InstallProgram(program, dest)
274#endif
275#ifdef InstallManPage
276#undef InstallManPage
277#define InstallManPage(program, dir)
278#endif
279ComplexProgramTarget(cda)
280
281
282