• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Makefile for LAME 3.xx -*- makefile -*-
2#
3# LAME is reported to work under:
4# Linux (i86), NetBSD 1.3.2 (StrongARM), FreeBSD (i86)
5# Compaq Alpha(OSF, Linux, Tru64 Unix), Sun Solaris, SGI IRIX,
6# OS2 Warp, Macintosh PPC, BeOS, Amiga and even VC++
7#
8
9# these variables are available on command line:
10#
11#   make UNAME=xxxxx ARCH=xxxxx   - specify a type of host
12#   make PGM=lame_exp             - specify a name of an executable file
13#
14# if you have mingw32-gcc, try:
15#   make -fMakefile.unix UNAME=MSDOS
16# or if you get the error
17# "process_begin: CreateProcess((null), copy configMS.h config.h, ...)":
18#   make -fMakefile.unix UNAME=MSDOS NOUNIXCMD=NO
19# or if you have NASM:
20#   make -fMakefile.unix UNAME=MSDOS HAVE_NASM=YES
21#
22
23ifeq ($(UNAME),MSDOS)
24  UNAME ?= UNKNOWN
25  ARCH = x86
26  NOUNIXCMD = YES
27else
28  UNAME = $(shell uname)
29  ARCH = $(shell uname -m)
30  iARCH = $(patsubst i%86,x86,$(ARCH))
31endif
32
33HAVE_NASM = NO
34HAVE_NEWER_GLIBC = NO
35NASM_FLAGS=elf
36
37# generic defaults. OS specific options go in versious sections below
38PGM = lame
39CC = gcc
40CC_OPTS =  -O
41CPP_OPTS = -Iinclude -Impglib -Ifrontend -Ilibmp3lame
42AR = ar
43RANLIB = ranlib
44GTK =
45GTKLIBS =
46LIBSNDFILE =
47LIBS = -lm
48MP3LIB = libmp3lame/libmp3lame.a
49MP3LIB_SHARED = libmp3lame/libmp3lame.so
50MAKEDEP = -M
51BRHIST_SWITCH =
52LIBTERMCAP =
53RM = rm -f
54
55CPP_OPTS += -DHAVE_CONFIG_H -I.
56
57##########################################################################
58# -DHAVEMPGLIB compiles the mpglib *decoding* library into libmp3lame
59##########################################################################
60CPP_OPTS += -DHAVE_MPGLIB
61
62##########################################################################
63# -DTAKEHIRO_IEEE754_HACK enables Takehiro's IEEE hack
64##########################################################################
65ifeq ($(iARCH),x86)
66 ifeq ($(CFG),RH_SSE)
67# SSE and IEEE754 HACK don't work together
68 else
69	CPP_OPTS += -DTAKEHIRO_IEEE754_HACK
70 endif
71endif
72
73##########################################################################
74# Define these in the OS specific sections below to compile in code
75# for the optional VBR bitrate histogram.
76# Requires ncurses, but libtermcap also works.
77# If you have any trouble, just dont define these
78#
79# BRHIST_SWITCH = -DBRHIST -DHAVE_TERMCAP -DHAVE_{NCURSES_}TERMCAP_H
80# LIBTERMCAP = -lncurses
81# LIBTERMCAP = -ltermcap
82#
83# or, to try and simulate TERMCAP (ANSI), use:
84# BRHIST_SWITCH = -DBRHIST
85#
86##########################################################################
87
88
89##########################################################################
90# Define these in the OS specific sections below to compile in code for:
91#
92# SNDLIB = -DLIBSNDFILE   to use Erik de Castro Lopo's libsndfile
93# http://www.zip.com.au/~erikd/libsndfile/ instead of LAME's internal
94# routines.  Also set:
95#
96# LIBSNDFILE = -lsndfile
97# or
98# LIBSNDFILE = -L/location_of_libsndfile  -lsndfile
99#
100##########################################################################
101
102
103##########################################################################
104# Define these in the OS specific sections below to compile in code for
105# the GTK mp3 frame analyzer
106#
107# Requires  -DHAVE_MPGLIB
108#
109# GTK = -DHAVE_GTK `gtk-config --cflags`
110# GTKLIBS = `gtk-config --libs`
111#
112##########################################################################
113
114
115
116
117##########################################################################
118# LINUX
119##########################################################################
120ifeq ($(UNAME),Linux)
121#  The frame analyzer depends on gtk1.2. Uncomment the next 2 lines to get it
122#   GTK = -DHAVE_GTK `gtk-config --cflags`
123#   GTKLIBS = `gtk-config --libs`
124# Comment out next 2 lines if you want to remove VBR histogram capability
125   BRHIST_SWITCH = -DHAVE_TERMCAP -DHAVE_TERMCAP_H
126   LIBTERMCAP = -lncurses
127#  uncomment to use LIBSNDFILE
128#   SNDLIB = -DLIBSNDFILE
129#   LIBSNDFILE=-lsndfile
130
131# suggested for gcc-2.7.x
132#  CC_OPTS =  -O3 -fomit-frame-pointer -funroll-loops -ffast-math  -finline-functions -Wall -pedantic
133#  CC_OPTS =  -O9 -fomit-frame-pointer -fno-strength-reduce -mpentiumpro -ffast-math -finline-functions -funroll-loops -Wall -malign-double -g -march=pentiumpro -mfancy-math-387 -pipe -pedantic
134
135# Suggested for GCC 4.* & machines with sse+sse2+sse3: -Os might reduce
136# the use of the instruction cache and, thus, get better performance,
137# but this should be experimented by the user. Customize at your own
138# convenience.
139#
140#CC_OPTS = -pipe -O3 \
141#	-Wall -Wextra -pedantic \
142#	-Wmissing-declarations -Wfloat-equal -Wshadow \
143#	-Wcast-qual -Wcast-align -Wdisabled-optimization \
144#	-ffast-math -ftree-vectorize -ftree-vect-loop-version \
145#	-mtune=nocona -march=nocona -mfpmath=sse -msse -msse2 -msse3 \
146#	-malign-double -maccumulate-outgoing-args
147
148#  for debugging:
149  CC_OPTS =  -UNDEBUG -O -Wall -pedantic -ggdb -DABORTFP
150
151#  for lots of debugging:
152#   CC_OPTS =  -DDEBUG -UNDEBUG  -O -Wall -pedantic -g -DABORTFP
153
154
155ifeq ($(CFG),RH)
156   GTK = -DHAVE_GTK `gtk-config --cflags`
157   GTKLIBS = `gtk-config --libs`
158   CPP_OPTS += -DFLOAT8=float -DREAL_IS_FLOAT=1 -DHAVE_ICONV -DHAVE_XMMINTRIN_H -D_ALLOW_INTERNAL_OPTIONS
159# these options for gcc-3.2 & AthlonXP
160   CC_OPTS = \
161	-pipe -O3 \
162	-Wall -W -Wmissing-declarations -Wfloat-equal -Wformat \
163	-Wcast-qual -Wcast-align -Wdisabled-optimization -Wshadow \
164	-march=athlon-xp \
165	-malign-double \
166	-maccumulate-outgoing-args
167#	-Wconversion -Wunreachable-code \
168
169   HAVE_NEWER_GLIBC = YES
170   HAVE_NASM = YES
171endif
172
173ifeq ($(CFG),RH_SSE)
174   GTK = -DHAVE_GTK `gtk-config --cflags`
175   GTKLIBS = `gtk-config --libs`
176   CPP_OPTS += -DFLOAT8=float -DREAL_IS_FLOAT=1 -DHAVE_ICONV -DHAVE_XMMINTRIN_H -DMIN_ARCH_SSE -D_ALLOW_INTERNAL_OPTIONS
177# these options for gcc-3.2 & AthlonXP
178   CC_OPTS = \
179	-std=c99 -pipe -O3 -fstrict-aliasing \
180	-Wall -W -Wmissing-declarations -Wfloat-equal -Wformat \
181	-Wcast-qual -Wcast-align -Wdisabled-optimization -Wshadow \
182	-Wunsafe-loop-optimizations \
183	-march=k8 \
184	-ffast-math \
185	-mfpmath=sse -msse -msse2  \
186	-malign-double \
187	-funsafe-math-optimizations \
188	-funsafe-loop-optimizations \
189	-maccumulate-outgoing-args
190# -Dpowf=pow -Dfabsf=fabs -Dlog10f=log10
191#	-fsingle-precision-constant \
192#	-Wconversion -Wunreachable-code \
193# -ftree-vectorizer-verbose=10 \
194
195   HAVE_NEWER_GLIBC = YES
196#   HAVE_NASM = YES
197   NASM_FLAGS = elf64
198endif
199
200ifeq ($(CFG),RH_INTEL)
201   CC=icc
202   GTK = -DHAVE_GTK `gtk-config --cflags`
203   GTKLIBS = `gtk-config --libs`
204   CPP_OPTS += -DFLOAT8=float -DREAL_IS_FLOAT=1 -DHAVE_ICONV -DHAVE_XMMINTRIN_H -DMIN_ARCH_SSE -D_ALLOW_INTERNAL_OPTIONS
205
206  CC_OPTS = \
207	-cxxlib-nostd \
208	-O3 -fno-alias -ip -finline-limit=400 \
209 	-scalar-rep
210# -vec_report5 -opt-report
211# -parallel
212
213endif
214
215ifeq ($(CFG),PFK)
216   CPP_OPTS += -DKLEMM -DKLEMM_00 -DKLEMM_01 -DKLEMM_02 -DKLEMM_03 -DKLEMM_04 -DKLEMM_05 -DKLEMM_06 -DKLEMM_07 -DKLEMM_08 -DKLEMM_09 -DKLEMM_10 -DKLEMM_11 -DKLEMM_12 -DKLEMM_13 -DKLEMM_14 -DKLEMM_15 -DKLEMM_16 -DKLEMM_17 -DKLEMM_18 -DKLEMM_19 -DKLEMM_20 -DKLEMM_21 -DKLEMM_22 -DKLEMM_23 -DKLEMM_24 -DKLEMM_25 -DKLEMM_26 -DKLEMM_27 -DKLEMM_28 -DKLEMM_29 -DKLEMM_30 -DKLEMM_31 -DKLEMM_32 -DKLEMM_33 -DKLEMM_34 -DKLEMM_35 -DKLEMM_36 -DKLEMM_37 -DKLEMM_38 -DKLEMM_39 -DKLEMM_40 -DKLEMM_41 -DKLEMM_42 -DKLEMM_43 -DKLEMM_44 -DKLEMM_45 -DKLEMM_46 -DKLEMM_47 -DKLEMM_48 -DKLEMM_49 -DKLEMM_50
217   CC_OPTS = \
218	-Wall -O9 -fomit-frame-pointer -march=pentium \
219	-finline-functions -fexpensive-optimizations \
220	-funroll-loops -funroll-all-loops -pipe -fschedule-insns2 \
221	-fstrength-reduce \
222	-malign-double -mfancy-math-387 -ffast-math
223
224   HAVE_NEWER_GLIBC = YES
225   HAVE_NASM = YES
226endif
227
228##########################################################################
229# LINUX on Digital/Compaq Alpha CPUs
230##########################################################################
231ifeq ($(ARCH),alpha)
232
233################################################################
234#### Check if 'ccc' is in our path
235####   if not, use 'gcc'
236################################################################
237ifeq ($(shell which ccc 2>/dev/null | grep -c ccc),0)
238
239# double is faster than float on Alpha
240CC_OPTS =       -O4 -pedantic -Wall -fomit-frame-pointer -ffast-math -funroll-loops \
241                -mfp-regs -fschedule-insns -fschedule-insns2 \
242                -finline-functions \
243#                -DFLOAT=double
244# add "-mcpu=21164a -Wa,-m21164a" to optimize for 21164a (ev56) CPU
245
246################################################################
247#### else, use 'ccc'
248################################################################
249else
250
251# Compaq's C Compiler
252CC = ccc
253
254################################################################
255#### set 'CC_OPTS = -arch host -tune host' to generate/tune instructions for this machine
256####     'CC_OPTS += -migrate -fast -inline speed -unroll 0' tweak to run as fast as possible :)
257####     'CC_OPTS += -w0 -pedantic -Wall' set warning and linking flags
258################################################################
259CC_OPTS = -arch host -tune host
260CC_OPTS += -migrate -fast -inline speed -unroll 0
261CC_OPTS += -w0 -pedantic -Wall
262
263
264################################################################
265#### to debug, uncomment
266################################################################
267# For Debugging
268#CC_OPTS += -g3
269
270################################################################
271#### define __DECALPHA__ (i was getting re-declaration warnings
272####   in machine.h
273################################################################
274# Define DEC Alpha
275CPP_OPTS += -D__DECALPHA__
276
277# standard Linux libm
278#LIBS	=	-lm
279# optimized libffm (free fast math library)
280#LIBS	=	-lffm
281# Compaq's fast math library
282LIBS    =       -lcpml
283endif  #  gcc or ccc?
284endif  #  alpha
285endif  #  linux
286
287
288
289##########################################################################
290# FreeBSD
291##########################################################################
292ifeq ($(UNAME),FreeBSD)
293#  remove if you do not have GTK or do not want the GTK frame analyzer
294   GTK = -DHAVE_GTK `gtk12-config --cflags`
295   GTKLIBS = `gtk12-config --libs`
296# Comment out next 2 lines if you want to remove VBR histogram capability
297   BRHIST_SWITCH = -DHAVE_TERMCAP -DHAVE_TERMCAP_H
298   LIBTERMCAP = -lncurses
299
300endif
301
302
303
304##########################################################################
305# OpenBSD
306##########################################################################
307ifeq ($(UNAME),OpenBSD)
308#  remove if you do not have GTK or do not want the GTK frame analyzer
309   GTK = -DHAVE_GTK `gtk-config --cflags`
310   GTKLIBS = `gtk-config --libs`
311# Comment out next 2 lines if you want to remove VBR histogram capability
312   BRHIST_SWITCH = -DHAVE_TERMCAP -DHAVE_TERMCAP_H
313   LIBTERMCAP = -lcurses
314endif
315
316
317
318
319##########################################################################
320# SunOS
321##########################################################################
322ifeq ($(UNAME),SunOS)
323   CC = cc
324   CC_OPTS = -O -xCC
325   MAKEDEP = -xM
326# for gcc, use instead:
327#   CC = gcc
328#   CC_OPTS = -O
329#   MAKEDEP = -M
330endif
331
332
333
334##########################################################################
335# SGI
336##########################################################################
337ifeq ($(UNAME),IRIX64)
338   CC = cc
339   CC_OPTS = -O3 -woff all
340
341#optonal:
342#   GTK = -DHAVE_GTK `gtk-config --cflags`
343#   GTKLIBS = `gtk-config --libs`
344#   BRHIST_SWITCH = -DBRHIST -DHAVE_TERMCAP -DHAVE_TERMCAP_H
345#   LIBTERMCAP = -lncurses
346
347endif
348ifeq ($(UNAME),IRIX)
349   CC = cc
350   CC_OPTS = -O3 -woff all
351endif
352
353
354
355##########################################################################
356# Compaq Alpha running Dec Unix (OSF)
357##########################################################################
358ifeq ($(UNAME),OSF1)
359   CC = cc
360   CC_OPTS = -fast -O3 -std -g3 -non_shared
361endif
362
363##########################################################################
364# BeOS
365##########################################################################
366ifeq ($(UNAME),BeOS)
367   CC = $(BE_C_COMPILER)
368   LIBS =
369ifeq ($(ARCH),BePC)
370   CC_OPTS = -O9 -fomit-frame-pointer -march=pentium \
371   -mcpu=pentium -ffast-math -funroll-loops \
372   -fprofile-arcs -fbranch-probabilities
373else
374   CC_OPTS = -opt all
375   MAKEDEP = -make
376endif
377endif
378
379###########################################################################
380# MOSXS (Rhapsody PPC)
381###########################################################################
382ifeq ($(UNAME),Rhapsody)
383   CC = cc
384   LIBS =
385   CC_OPTS = -O9 -ffast-math -funroll-loops -fomit-frame-pointer
386   MAKEDEP = -make
387
388endif
389##########################################################################
390# OS/2
391##########################################################################
392# Properly installed EMX runtime & development package is a prerequisite.
393# tools I used: make 3.76.1, uname 1.12, sed 2.05, PD-ksh 5.2.13
394#
395##########################################################################
396ifeq ($(UNAME),OS/2)
397   SHELL=sh
398   CC = gcc
399   CC_OPTS = -O3 -D__OS2__
400   PGM = lame.exe
401   LIBS =
402   RANLIB = touch
403
404# I use the following for slightly better performance on my Pentium-II
405# using pgcc-2.91.66:
406#   CC_OPTS = -O6 -ffast-math -funroll-loops -mpentiumpro -march=pentiumpro -D__OS2__
407# for the unfortunates with a regular pentium (using pgcc):
408# CC_OPTS = -O6 -ffast-math -funroll-loops -mpentium -march=pentium -D__OS2__
409
410# Comment out next 2 lines if you want to remove VBR histogram capability
411   BRHIST_SWITCH = -DHAVE_TERMCAP -DHAVE_{NCURSES_}TERMCAP_H
412   LIBTERMCAP = -lncurses
413
414# Uncomment & inspect the 2 GTK lines to use MP3x GTK frame analyzer.
415# Properly installed XFree86/devlibs & GTK+ is a prerequisite.
416# The following works for me using Xfree86/OS2 3.3.5 and GTK+ 1.2.3:
417#   GTK = -DHAVE_GTK -IC:/XFree86/include/gtk12 -Zmt -D__ST_MT_ERRNO__ -IC:/XFree86/include/glib12 -IC:/XFree86/include
418#   GTKLIBS = -LC:/XFree86/lib -Zmtd -Zsysv-signals -Zbin-files -lgtk12 -lgdk12 -lgmodule -lglib12 -lXext -lX11 -lshm -lbsd -lsocket -lm
419endif
420
421
422
423###########################################################################
424# MSDOS/Windows
425###########################################################################
426ifeq ($(UNAME),MSDOS)
427  RM =
428  CC_OPTS = \
429       -Wall -pipe -O3 -fomit-frame-pointer -ffast-math -funroll-loops \
430       -fschedule-insns2 -fmove-all-movables -freduce-all-givs         \
431       -mcpu=pentium -march=pentium -mfancy-math-387
432  CC_OPTS += -D_cdecl=__cdecl
433  PGM = lame.exe
434endif
435
436
437
438###########################################################################
439# AmigaOS
440###########################################################################
441# Type 'Make ARCH=PPC' for PowerUP and 'Make ARCH=WOS' for WarpOS
442#
443###########################################################################
444ifeq ($(UNAME),AmigaOS)
445	CC = gcc -noixemul
446	CC_OPTS = -O3 -ffast-math -funroll-loops -m68020-60 -m68881
447	BRHIST_SWITCH = -DBRHIST
448	MAKEDEP = -MM
449	ifeq ($(ARCH),WOS)
450		CC = ppc-amigaos-gcc -warpup
451		CC_OPTS = -O3 -ffast-math -fomit-frame-pointer -funroll-loops \
452		-mmultiple -mcpu=603e
453		AR = ppc-amigaos-ar
454		RANLIB = ppc-amigaos-ranlib
455		LIBS =
456	endif
457	ifeq ($(ARCH),PPC)
458		CC = ppc-amigaos-gcc
459		CC_OPTS = -O3 -ffast-math -fomit-frame-pointer -funroll-loops \
460		-mmultiple -mcpu=603e
461		AR = ppc-amigaos-ar
462		RANLIB = ppc-amigaos-ranlib
463		LIBS =
464	endif
465endif
466
467
468# 10/99 added -D__NO_MATH_INLINES to fix a bug in *all* versions of
469# gcc 2.8+ as of 10/99.
470
471ifeq ($(HAVE_NEWER_GLIBC),YES)
472CC_SWITCHES =
473else
474CC_SWITCHES = -D__NO_MATH_INLINES  # only needed by some older glibc
475endif
476
477# temporary remove NDEBUG, see configure.in
478#CC_SWITCHES += -DNDEBUG $(CC_OPTS) $(SNDLIB) $(BRHIST_SWITCH)
479CC_SWITCHES += $(CC_OPTS) $(SNDLIB) $(BRHIST_SWITCH)
480frontend_sources = \
481	frontend/main.c \
482	frontend/amiga_mpega.c \
483        frontend/brhist.c \
484	frontend/get_audio.c \
485        frontend/lametime.c \
486        frontend/parse.c \
487	frontend/timestatus.c \
488	frontend/console.c \
489
490lib_sources = \
491	libmp3lame/bitstream.c \
492	libmp3lame/encoder.c \
493	libmp3lame/fft.c \
494	libmp3lame/gain_analysis.c \
495        libmp3lame/id3tag.c \
496        libmp3lame/lame.c \
497        libmp3lame/newmdct.c \
498	libmp3lame/psymodel.c \
499	libmp3lame/quantize.c \
500	libmp3lame/quantize_pvt.c \
501        libmp3lame/set_get.c \
502	libmp3lame/vbrquantize.c \
503	libmp3lame/reservoir.c \
504	libmp3lame/tables.c \
505	libmp3lame/takehiro.c \
506	libmp3lame/util.c \
507	libmp3lame/mpglib_interface.c \
508        libmp3lame/VbrTag.c \
509        libmp3lame/version.c \
510        libmp3lame/presets.c \
511        libmp3lame/vector/xmm_quantize_sub.c \
512        mpglib/common.c \
513        mpglib/dct64_i386.c \
514        mpglib/decode_i386.c \
515        mpglib/layer1.c \
516        mpglib/layer2.c \
517        mpglib/layer3.c \
518        mpglib/tabinit.c \
519        mpglib/interface.c
520
521
522#ifeq ($(UNAME),MSDOS)
523#  frontend_sources := $(subst /,\,$(frontend_sources))
524#  lib_sources := $(subst /,\,$(lib_sources))
525#endif
526
527frontend_obj = $(frontend_sources:.c=.o)
528lib_obj = $(lib_sources:.c=.o)
529
530DEP = $(frontend_sources:.c=.d) $(lib_sources:.c=.d )
531
532gtk_sources = frontend/gtkanal.c frontend/gpkplotting.c frontend/mp3x.c
533gtk_obj = $(gtk_sources:.c=.gtk.o)
534gtk_dep = $(gtk_sources:.c=.d)
535
536
537
538NASM = nasm
539ASFLAGS=-f $(NASM_FLAGS) -i libmp3lame/i386/
540
541# for people with nasmw
542ifeq ($(UNAME),MSDOS)
543 NASM = nasmw
544 ASFLAGS=-f win32 -DWIN32 -i libmp3lame/i386/
545endif
546
547%.o: %.nas
548	$(NASM) $(ASFLAGS) $< -o $@
549%.o: %.s
550	gcc -c $< -o $@
551
552
553#HAVE_NASM = YES
554
555ifeq ($(HAVE_NASM),YES)
556## have NASM
557CC_SWITCHES += -DHAVE_NASM
558lib_obj += libmp3lame/i386/cpu_feat.o
559
560## use MMX extension. you need nasm and MMX supported CPU.
561CC_SWITCHES += -DMMX_choose_table
562lib_obj += libmp3lame/i386/choose_table.o
563
564## use 3DNow! extension. you need nasm and 3DNow! supported CPU.
565lib_obj += libmp3lame/i386/fft3dn.o
566
567## use SSE extension. you need nasm and SSE supported CPU.
568lib_obj += libmp3lame/i386/fftsse.o
569
570## not yet coded
571#CC_SWITCHES += -DUSE_FFTFPU
572#lib_obj += libmp3lame/i386/fftfpu.o
573endif
574
575
576
577#
578# Makefile rules---you probably won't have to modify below this line
579#
580%.o: %.c
581	$(CC) $(CPP_OPTS) $(CC_SWITCHES) -c $< -o $@
582
583%.d: %.c
584  ifeq ($(NOUNIXCMD),YES)
585	$(CC) $(MAKEDEP)  $(CPP_OPTS) $(CC_SWITCHES)  $< > $@
586  else
587	$(SHELL) -ec '$(CC) $(MAKEDEP)  $(CPP_OPTS) $(CC_SWITCHES)  $< | sed '\''s;$*.o;& $@;g'\'' > $@'
588  endif
589
590%.gtk.o: %.c
591	$(CC) $(CPP_OPTS) $(CC_SWITCHES) $(GTK) -c $< -o $@
592
593all: frontend/$(PGM)
594
595
596$(lib_sources) $(frontend_sources) $(gtk_sources) : config.h
597
598config.h: configMS.h
599  ifeq ($(NOUNIXCMD),YES)
600	copy configMS.h config.h
601  else
602	cp configMS.h config.h
603  endif
604
605frontend/$(PGM):	frontend/lame_main.o $(frontend_obj)  $(MP3LIB)
606	$(CC) $(CC_OPTS) -o frontend/$(PGM)  frontend/lame_main.o $(frontend_obj) \
607        $(MP3LIB) $(LIBS) $(LIBSNDFILE) $(LIBTERMCAP)
608
609mp3x:   $(frontend_obj) $(gtk_obj) $(MP3LIB)
610	$(CC) $(CC_OPTS) -o frontend/mp3x $(frontend_obj) $(gtk_obj) \
611        $(MP3LIB) $(LIBS) $(LIBSNDFILE) $(LIBTERMCAP) $(GTKLIBS)
612
613mp3rtp:	frontend/rtp.o frontend/mp3rtp.o  $(frontend_obj) $(MP3LIB)
614	$(CC) $(CC_OPTS) -o frontend/mp3rtp frontend/mp3rtp.o frontend/rtp.o $(frontend_obj) $(MP3LIB) \
615        $(LIBS) $(LIBSNDFILE) $(LIBTERMCAP)
616
617libmp3lame/libmp3lame.a:  $(lib_obj)
618	echo $(lib_obj)
619	$(AR) cr libmp3lame/libmp3lame.a  $(lib_obj)
620	$(RANLIB) libmp3lame/libmp3lame.a
621
622#shared library.  GNU specific?
623libmp3lame/libmp3lame.so:  $(lib_obj)
624	gcc -shared -Wl,-soname,libmp3lame/libmp3lame.so -o libmp3lame/libmp3lame.so $(lib_obj)
625
626install:  frontend/$(PGM) #libmp3lame.a
627	cp frontend/$(PGM) /usr/bin
628	#cp libmp3lame.a /usr/lib
629	#cp lame.h /usr/lib
630
631clean:
632  ifeq ($(UNAME),MSDOS)
633	-del $(subst /,\,$(frontend_obj))
634	-del $(subst /,\,$(lib_obj))
635	-del $(subst /,\,$(gtk_obj))
636	-del $(subst /,\,$(DEP))
637	-del frontend\$(PGM)
638	-del frontend\main.o
639	-del libmp3lame\libmp3lame.a
640  else
641	-$(RM) $(gtk_obj) $(frontend_obj) $(lib_obj) $(DEP) frontend/$(PGM) \
642          frontend/main.o frontend/lame libmp3lame/libmp3lame.a \
643          frontend/mp3x.o frontend/mp3x
644  endif
645
646
647tags: TAGS
648
649TAGS: ${c_sources}
650	etags -T ${c_sources}
651
652ifneq ($(MAKECMDGOALS),clean)
653  -include $(DEP)
654endif
655
656
657#
658#  testcase.mp3 is a 2926 byte file.  The first number output by
659#  wc is the number of bytes which differ between new output
660#  and 'official' results.
661#
662#  Because of compiler options and effects of roundoff, the
663#  number of bytes which are different may not be zero, but
664#  should be at most 30.
665#
666test: frontend/$(PGM)
667	frontend/$(PGM)  --nores testcase.wav testcase.new.mp3
668	cmp -l testcase.new.mp3 testcase.mp3 | wc -l
669