home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 13 / AACD13.ISO / AACD / Sound / LAME / src / Makefile.org < prev    next >
Makefile  |  2000-08-03  |  14KB  |  477 lines

  1. # Makefile for LAME 3.xx
  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. # these variables are available on command line:
  9. #
  10. #   make NOUNIXCMD=YES            - don't use unix commands
  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 NOUNIXCMD=YES UNAME=MSDOS
  16. #
  17.  
  18.  
  19. ifeq ($(NOUNIXCMD),YES)
  20.   UNAME ?= UNKNOWN
  21.   ARCH ?= UNKNOWN_ARCH
  22. else
  23.   UNAME = $(shell uname)
  24.   ARCH = $(shell uname -m)
  25. endif
  26.  
  27. # generic defaults. OS specific options go in versious sections below
  28. PGM ?= lame
  29. CC = gcc
  30. CC_OPTS =  -O
  31. GTK = 
  32. GTKLIBS = 
  33. SNDLIB = -DLAMESNDFILE
  34. LIBSNDFILE =  
  35. LIBS = -lm 
  36. MAKEDEP = -M
  37. BRHIST_SWITCH = 
  38. LIBTERMCAP = 
  39. RM = rm -f
  40.  
  41.  
  42.  
  43. ##########################################################################
  44. # -DHAVEMPGLIB compiles the mpglib *decoding* library into libmp3lame
  45. ##########################################################################
  46. CPP_OPTS += -DHAVEMPGLIB 
  47.  
  48. ##########################################################################
  49. # floating point option:
  50. # -DFLOAT8_is_float         most floating point variables are 4 byte
  51. # -DFLOAT8_is_double        most floating point variables are 8 byte (default)
  52. # NOTE: RH: 7/00:  if FLOAT8=float, it breaks resampling and VBR code 
  53. ##########################################################################
  54. #CPP_OPTS += -DFLOAT8_is_double
  55.  
  56.  
  57.  
  58. ##########################################################################
  59. # Define these in the OS specific sections below to compile in support
  60. # for the Ogg Vorbis audio format (both decoding and encoding)
  61. # VORBIS = -DHAVEVORBIS  -I ../vorbis/include
  62. # VORBIS_LIB = -L ../vorbis/lib -lvorbis
  63. ##########################################################################
  64.  
  65. ##########################################################################
  66. # Define these in the OS specific sections below to compile in code 
  67. # for the optional VBR bitrate histogram.  
  68. # Requires ncurses, but libtermcap also works.  
  69. # If you have any trouble, just dont define these
  70. #
  71. # BRHIST_SWITCH = -DBRHIST
  72. # LIBTERMCAP = -lncurses
  73. # LIBTERMCAP = -ltermcap
  74. #
  75. # or, to try and simulate TERMCAP (ANSI), use:
  76. # BRHIST_SWITCH = -DBRHIST -DNOTERMCAP
  77. #
  78. ##########################################################################
  79.  
  80.  
  81. ##########################################################################
  82. # Define these in the OS specific sections below to compile in code for:
  83. #
  84. # SNDLIB =                no file i/o 
  85. # SNDLIB = -DLAMESNDFILE  to use internal LAME soundfile routines 
  86. # SNDLIB = -DLIBSNDFILE   to use Erik de Castro Lopo's libsndfile 
  87. # http://www.zip.com.au/~erikd/libsndfile/
  88. #
  89. # Note: at present, libsndfile does not support input from stdin.  
  90. #
  91. # for example:
  92. #  SNDLIB = -DLIBSNDFILE
  93. #  LIBSNDFILE=-lsndfile 
  94. #  if libsndfile is in a custom location, try:
  95. #  LIBSNDFILE=-L $(LIBSNDHOME) -lsndfile  -I $(LIBSNDHOME)
  96. ##########################################################################
  97.  
  98.  
  99. ##########################################################################
  100. # Define these in the OS specific sections below to compile in code for
  101. # the GTK mp3 frame analyzer
  102. #
  103. # Requires  -DHAVEMPGLIB
  104. # and SNDLIB = -DLAME or -DLIBSNDFILE
  105. #
  106. # GTK = -DHAVEGTK `gtk-config --cflags`
  107. # GTKLIBS = `gtk-config --libs` 
  108. #
  109. ##########################################################################
  110.  
  111.  
  112.  
  113.  
  114. ##########################################################################
  115. # LINUX   
  116. ##########################################################################
  117. ifeq ($(UNAME),Linux)
  118. #  remove these lines if you dont have GTK, or dont want the GTK frame analyzer
  119.    GTK = -DHAVEGTK `gtk-config --cflags`
  120.    GTKLIBS = `gtk-config --libs` 
  121. # Comment out next 2 lines if you want to remove VBR histogram capability
  122.    BRHIST_SWITCH = -DBRHIST
  123.    LIBTERMCAP = -lncurses
  124. #  uncomment to use LIBSNDFILE
  125. #   SNDLIB = -DLIBSNDFILE
  126. #   LIBSNDFILE=-lsndfile 
  127.  
  128. # uncomment to compile in Vorbis support
  129. #   VORBIS = -DHAVEVORBIS -I/home/mt/mp3/vorbis/include
  130. #   VORBIS_LIB = -L/home/mt/mp3/vorbis/lib -lvorbis
  131.  
  132.  
  133. # suggested for gcc-2.7.x
  134.    CC_OPTS =  -O3 -fomit-frame-pointer -funroll-loops -ffast-math  -finline-functions -Wall
  135. #  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 
  136.  
  137. #  for debugging:
  138. #   CC_OPTS =  -UNDEBUG -O -Wall -g -DABORTFP
  139.  
  140. #  for lots of debugging:
  141. #   CC_OPTS =  -DDEBUG -UNDEBUG  -O -Wall -g -DABORTFP 
  142.  
  143.  
  144. #  special noise calculation
  145. #   FEATURES = -DRH_NOISE_CALC
  146. # these options for gcc-2.95.2 to produce fast code
  147. #   CC_OPTS = $(FEATURES)\
  148. #    -Wall -O9 -fomit-frame-pointer -march=pentium \
  149. #    -finline-functions -fexpensive-optimizations \
  150. #    -funroll-loops -funroll-all-loops -pipe -fschedule-insns2 \
  151. #    -fstrength-reduce \
  152. #    -malign-double -mfancy-math-387 -ffast-math 
  153.  
  154.  
  155. ##########################################################################
  156. # LINUX on Digital/Compaq Alpha CPUs
  157. ##########################################################################
  158. ifeq ($(ARCH),alpha)
  159.  
  160. ################################################################
  161. #### Check if 'ccc' is in our path
  162. ####   if not, use 'gcc'
  163. ################################################################
  164. ifeq ($(shell which ccc 2>/dev/null | grep -c ccc),0)
  165.  
  166. # double is faster than float on Alpha
  167. CC_OPTS =       -O4 -Wall -fomit-frame-pointer -ffast-math -funroll-loops \
  168.                 -mfp-regs -fschedule-insns -fschedule-insns2 \
  169.                 -finline-functions \
  170. #                -DFLOAT=double
  171. # add "-mcpu=21164a -Wa,-m21164a" to optimize for 21164a (ev56) CPU
  172.  
  173. ################################################################
  174. #### else, use 'ccc'
  175. ################################################################
  176. else
  177.  
  178. # Compaq's C Compiler
  179. CC = ccc
  180.  
  181. ################################################################
  182. #### set 'CC_OPTS = -arch host -tune host' to generate/tune instructions for 
  183. this machine
  184. ####     'CC_OPTS += -migrate -fast -inline speed -unroll 0' tweak to run as 
  185. fast as possible :)
  186. ####     'CC_OPTS += -w0 -Wall' set warning and linking flags
  187. ################################################################
  188. CC_OPTS = -arch host -tune host
  189. CC_OPTS += -migrate -fast -inline speed -unroll 0
  190. CC_OPTS += -w0 -Wall
  191.  
  192.  
  193. ################################################################
  194. #### to debug, uncomment
  195. ################################################################
  196. # For Debugging
  197. #CC_OPTS += -g3
  198.  
  199. ################################################################
  200. #### define __DECALPHA__ (i was getting re-declaration warnings
  201. ####   in machine.h
  202. ################################################################
  203. # Define DEC Alpha
  204. CPP_OPTS += -D__DECALPHA__
  205.  
  206. # standard Linux libm
  207. #LIBS    =    -lm
  208. # optimized libffm (free fast math library)
  209. #LIBS    =    -lffm
  210. # Compaq's fast math library
  211. LIBS    =       -lcpml
  212. endif  #  gcc or ccc?
  213. endif  #  alpha 
  214. endif  #  linux
  215.  
  216.  
  217.  
  218. ##########################################################################
  219. # FreeBSD
  220. ##########################################################################
  221. ifeq ($(UNAME),FreeBSD)
  222. #  remove if you do not have GTK or do not want the GTK frame analyzer
  223.    GTK = -DHAVEGTK `gtk12-config --cflags`
  224.    GTKLIBS = `gtk12-config --libs` 
  225. # Comment out next 2 lines if you want to remove VBR histogram capability
  226.    BRHIST_SWITCH = -DBRHIST
  227.    LIBTERMCAP = -lncurses
  228.  
  229. endif
  230.  
  231. ##########################################################################
  232. # OpenBSD
  233. ##########################################################################
  234. ifeq ($(UNAME),OpenBSD)
  235. #  remove if you do not have GTK or do not want the GTK frame analyzer
  236.    GTK = -DHAVEGTK `gtk12-config --cflags`
  237.    GTKLIBS = `gtk12-config --libs` 
  238. # Comment out next 2 lines if you want to remove VBR histogram capability
  239.    BRHIST_SWITCH = -DBRHIST
  240.    LIBTERMCAP = -lncurses
  241. endif
  242.  
  243.  
  244. ##########################################################################
  245. # SunOS
  246. ##########################################################################
  247. ifeq ($(UNAME),SunOS) 
  248.    CC = cc
  249.    CC_OPTS = -O -xCC      
  250.    MAKEDEP = -xM
  251. endif
  252.  
  253.  
  254. ##########################################################################
  255. # SGI
  256. ##########################################################################
  257. ifeq ($(UNAME),IRIX64) 
  258.    CC = cc
  259.    CC_OPTS = -O3 -woff all 
  260.  
  261. #optonal:
  262. #   GTK = -DHAVEGTK `gtk-config --cflags`
  263. #   GTKLIBS = `gtk-config --libs`
  264. #   BRHIST_SWITCH = -DBRHIST
  265. #   LIBTERMCAP = -lncurses
  266.  
  267. endif
  268. ifeq ($(UNAME),IRIX) 
  269.    CC = cc
  270.    CC_OPTS = -O3 -woff all 
  271. endif
  272.  
  273.  
  274.  
  275. ##########################################################################
  276. # Compaq Alpha running Dec Unix (OSF)
  277. ##########################################################################
  278. ifeq ($(UNAME),OSF1)
  279.    CC = cc
  280.    CC_OPTS = -fast -O3 -std -g3 -non_shared
  281. endif
  282.  
  283. ##########################################################################
  284. # BeOS
  285. ##########################################################################
  286. ifeq ($(UNAME),BeOS)
  287.    CC = $(BE_C_COMPILER)
  288.    LIBS =
  289. ifeq ($(ARCH),BePC)
  290.    CC_OPTS = -O9 -fomit-frame-pointer -march=pentium \
  291.    -mcpu=pentium -ffast-math -funroll-loops \
  292.    -fprofile-arcs -fbranch-probabilities
  293. else
  294.    CC_OPTS = -opt all
  295.    MAKEDEP = -make
  296. endif
  297. endif
  298.  
  299. ###########################################################################
  300. # MOSXS (Rhapsody PPC)
  301. ###########################################################################
  302. ifeq ($(UNAME),Rhapsody)
  303.    CC = cc
  304.    LIBS =
  305.    CC_OPTS = -O9 -ffast-math -funroll-loops -fomit-frame-pointer
  306.    MAKEDEP = -make 
  307.    
  308. endif
  309. ##########################################################################
  310. # OS/2
  311. ##########################################################################
  312. # Properly installed EMX runtime & development package is a prerequisite.
  313. # tools I used: make 3.76.1, uname 1.12, sed 2.05, PD-ksh 5.2.13
  314. #
  315. ##########################################################################
  316. ifeq ($(UNAME),OS/2)
  317.    SHELL=sh    
  318.    CC = gcc
  319.    CC_OPTS = -O3
  320.    PGM ?= lame.exe
  321.    LIBS =
  322.  
  323. # I use the following for slightly better performance on my Pentium-II
  324. # using pgcc-2.91.66:
  325. #   CC_OPTS = -O6 -ffast-math -funroll-loops -mpentiumpro -march=pentiumpro
  326.  
  327. # Comment out next 2 lines if you want to remove VBR histogram capability
  328.    BRHIST_SWITCH = -DBRHIST
  329.    LIBTERMCAP = -ltermcap
  330.  
  331. # Uncomment & inspect the 2 GTK lines to use MP3x GTK frame analyzer.
  332. # Properly installed XFree86/devlibs & GTK+ is a prerequisite.
  333. # The following works for me using Xfree86/OS2 3.3.5 and GTK+ 1.2.3:
  334. #   GTK = -DHAVEGTK -IC:/XFree86/include/gtk12 -Zmt -D__ST_MT_ERRNO__ -IC:/XFree86/include/glib12 -IC:/XFree86/include
  335. #   GTKLIBS = -LC:/XFree86/lib -Zmtd -Zsysv-signals -Zbin-files -lgtk12 -lgdk12 -lgmodule -lglib12 -lXext -lX11 -lshm -lbsd -lsocket -lm
  336. endif
  337.  
  338. ###########################################################################
  339. # MSDOS/Windows
  340. ###########################################################################
  341. ifeq ($(UNAME),MSDOS)
  342.   RM =
  343.   PGM ?= lame.exe
  344. endif
  345.  
  346.  
  347. # 10/99 added -D__NO_MATH_INLINES to fix a bug in *all* versions of
  348. # gcc 2.8+ as of 10/99.  
  349.  
  350. CC_SWITCHES = -DNDEBUG -D__NO_MATH_INLINES $(CC_OPTS) $(SNDLIB) $(GTK) \
  351. $(BRHIST_SWITCH) $(VORBIS) 
  352. c_sources_s = \
  353.         brhist.c \
  354.     bitstream.c \
  355.     fft.c \
  356.     get_audio.c \
  357.         id3tag.c \
  358.     ieeefloat.c \
  359.         lame.c \
  360.         newmdct.c \
  361.         parse.c \
  362.     portableio.c \
  363.     psymodel.c \
  364.     quantize.c \
  365.     quantize-pvt.c \
  366.     vbrquantize.c \
  367.     reservoir.c \
  368.     tables.c \
  369.     takehiro.c \
  370.     timestatus.c \
  371.     util.c \
  372.     vorbis_interface.c \
  373.         VbrTag.c \
  374.         version.c \
  375.         mpglib/common.c \
  376.         mpglib/dct64_i386.c \
  377.         mpglib/decode_i386.c \
  378.         mpglib/layer3.c \
  379.         mpglib/tabinit.c \
  380.         mpglib/interface.c \
  381.         mpglib/main.c 
  382.  
  383. ifeq ($(UNAME),MSDOS)
  384.   c_sources = $(subst /,\\,$(c_sources_s))
  385. else
  386.   c_sources = $(c_sources_s)
  387. endif
  388.  
  389. OBJ = $(c_sources:.c=.o)
  390. DEP = $(c_sources:.c=.d)
  391.  
  392. gtk_sources = gtkanal.c gpkplotting.c
  393. gtk_obj = $(gtk_sources:.c=.o)
  394. gtk_dep = $(gtk_sources:.c=.d)
  395.  
  396.  
  397.  
  398. NASM = nasm
  399. ASFLAGS=-f elf -i i386/
  400. %.o: %.nas
  401.     $(NASM) $(ASFLAGS) $< -o $@
  402. %.o: %.s
  403.     gcc -c $< -o $@
  404.  
  405. ## use MMX extension. you need nasm and MMX supported CPU.
  406. #CC_SWITCHES += -DMMX_choose_table
  407. #OBJ += i386/choose_table.o
  408.  
  409. %.o: %.c 
  410.     $(CC) $(CPP_OPTS) $(CC_SWITCHES) -c $< -o $@
  411.  
  412. %.d: %.c
  413.   ifeq ($(NOUNIXCMD),YES)
  414.     $(CC) $(MAKEDEP)  $(CPP_OPTS) $(CC_SWITCHES)  $< > $@
  415.   else
  416.     $(SHELL) -ec '$(CC) $(MAKEDEP)  $(CPP_OPTS) $(CC_SWITCHES)  $< | sed '\''s;$*.o;& $@;g'\'' > $@'
  417.   endif
  418.  
  419. all: $(PGM)
  420.  
  421. $(PGM):    main.o $(gtk_obj) libmp3lame.a 
  422.     $(CC) $(CC_OPTS) -o $(PGM)  main.o $(gtk_obj) -L. -lmp3lame $(LIBS) $(LIBSNDFILE) $(GTKLIBS) $(LIBTERMCAP) $(VORBIS_LIB)
  423.  
  424. mp3x:    mp3x.o $(gtk_obj) libmp3lame.a
  425.     $(CC) -o mp3x mp3x.o $(gtk_obj) $(OBJ) $(LIBS) $(LIBSNDFILE) $(GTKLIBS) $(LIBTERMCAP) $(VORBIS_LIB)
  426.  
  427. mp3rtp:    rtp.o mp3rtp.o libmp3lame.a
  428.     $(CC) -o mp3rtp mp3rtp.o rtp.o   $(OBJ) $(LIBS) $(LIBSNDFILE) $(GTKLIBS) $(LIBTERMCAP) $(VORBIS_LIB)
  429.  
  430. libmp3lame.a:  $(OBJ) Makefile
  431. #    cd libmp3lame
  432. #    make libmp3lame
  433.     ar cr libmp3lame.a  $(OBJ) 
  434.     ranlib libmp3lame.a
  435.  
  436. clean:
  437.   ifeq ($(UNAME),MSDOS)
  438.     -del *.o
  439.     -del *.d
  440.     -del *.a
  441.     -del mpglib\*.o
  442.     -del mpglib\*.d
  443.     -del $(PGM)
  444.   else
  445.     -$(RM) $(gtk_obj) $(OBJ) $(DEP) $(PGM) main.o rtp.o mp3rtp mp3rtp.o \
  446.          mp3x.o mp3x libmp3lame.a 
  447.   endif
  448.  
  449.  
  450. tags: TAGS
  451.  
  452. TAGS: ${c_sources}
  453.     etags -T ${c_sources}
  454.  
  455. ifneq ($(MAKECMDGOALS),clean)
  456.   -include $(DEP)
  457. endif
  458.  
  459.  
  460. #
  461. #  testcase.mp3 is a 2926 byte file.  The first number output by
  462. #  wc is the number of bytes which differ between new output
  463. #  and 'official' results.  
  464. #
  465. #  Because of compilier options and effects of roundoff, the 
  466. #  number of bytes which are different may not be zero, but
  467. #  should be at most 30.
  468. #
  469. test: $(PGM)
  470.     ./lame  --nores -h testcase.wav testcase.new.mp3
  471.     cmp -l testcase.new.mp3 testcase.mp3 | wc
  472.  
  473. testg: $(PGM)
  474.     ./lame -g -h ../test/castanets.wav
  475.