Makefile.unix 20 KB

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