Last night I hacked the lame makefile for DJGPP.
It's attached to this email

I have tested it with DJGPP 2.03, GCC 2.95 (19990728 release),
the DJGPP port of GNU make 3.78.1 and lame 3.85 beta.

Here are some timings for my Celeron 400 Mhz.

Test track: We Care A Lot by Faith No More - Track 01 - Greatest Hits,
encoded with the -h switch.

1:28  -  MSVC 6.0 with default project file 
1:47  -  DJGPP with default compiler options 
1:40  -  DJGPP with second set of options 
1:40  -  DJGPP with third set of options (the ones for GCC 2.95.2)
1:41  -  gcc under linux on the same machine with the 3rd set 
         of compiler options 
1.37  -  mingw32, gcc 2.95.2 for win32 (3rd set of compiler options)
         see: http://www.xraylith.wisc.edu/~khan/software/gnu-win32/

So on my system at least, DJGPP isn't quite as fast as MSVC 6.
However it's still pretty good and freely available.
Mingw32 is slightly faster and produces true win32 executables which 
should be better for windows NT users. (AFAIK DJGPP only can't use long
filenames under win NT.)

mingw32 has a problem with this in brhist.c:

#ifdef _WIN32  
COORD Pos;
HANDLE CH;
CONSOLE_SCREEN_BUFFER_INFO CSBI;
#endif

because COORD isn't in the mingw32 include files.

Chris Wise
# Makefile for LAME 3.xx using DJGPP (DJ Delorie's DOS port of GCC)

# based on the original lame makefile

#

# Hints:

#

# To compile, use: make -f Makefile.djgpp

#

# Make sure that you have the DJGPP make utility installed (get it from where you got 
DJGPP)

#

# Use UPX to compress the exe to less half the original size.

#

## Some of the changes (things that don't work with DOS/DJGPP)

## removed VBR histogram capability

## removed references to GTK 

## removed references to rtp

## make clean is a hack because the dos prompt doesn't like really long command lines

## removed -pipe from CC_OPTS



# generic defaults. OS specific options go in versious sections below

PGM = lame

CC = gcc

CC_OPTS =  -O

SNDLIB = -DLAMESNDFILE

LIBSNDFILE =  

LIBS = -lm 

MAKEDEP = -M





##########################################################################

# -DHAVEMPGLIB compiles the mpglib *decoding* library into libmp3lame

##########################################################################

CPP_OPTS += -DHAVEMPGLIB 



##########################################################################

# -DFLOAT8_is_float will FLOAT8 as float

# -DFLOAT8_is_double  will FLOAT8 as double (default)

#  NOTE: RH: 7/00:  if FLOAT8=float, it breaks resampling and VBR code 

##########################################################################

CPP_OPTS += -DFLOAT8_is_double





##########################################################################

# Define these in the OS specific sections below to compile in support

# for the Ogg Vorbis audio format (both decoding and encoding)

# 

# VORBIS = -DHAVEVORBIS  -I ../vorbis/include

# VORBIS_LIB = -L ../vorbis/lib -lvorbis

##########################################################################





##########################################################################

# Define these in the OS specific sections below to compile in code for:

#

# SNDLIB =                no file i/o 

# SNDLIB = -DLAMESNDFILE  to use internal LAME soundfile routines 

# SNDLIB = -DLIBSNDFILE   to use Erik de Castro Lopo's libsndfile 

# http://www.zip.com.au/~erikd/libsndfile/

#

# Note: at present, libsndfile does not support input from stdin.  

#

# for example:

#  SNDLIB = -DLIBSNDFILE

#  LIBSNDFILE=-lsndfile 

#  if libsndfile is in a custom location, try:

#  LIBSNDFILE=-L $(LIBSNDHOME) -lsndfile  -I $(LIBSNDHOME)

##########################################################################





##########################################################################

# DJGPP   

##########################################################################



# suggested for gcc-2.7.x

CC_OPTS = -s  -O3 -fomit-frame-pointer -funroll-loops -ffast-math  -finline-functions 
-Wall



#CC_OPTS =  -s -O9 -fomit-frame-pointer -fno-strength-reduce -mpentiumpro -ffast-math 
-finline-functions -funroll-loops -Wall -malign-double -g -march=pentiumpro 
-mfancy-math-387



# these options for gcc-2.95.2 to produce fast code

#CC_OPTS = -s -Wall -O9 -fomit-frame-pointer -march=pentiumpro -finline-functions \

#       -fexpensive-optimizations -funroll-loops -funroll-all-loops -fschedule-insns2 
\

#       -fstrength-reduce -malign-double -mfancy-math-387 -ffast-math 



#  for debugging:

#   CC_OPTS =  -UNDEBUG -O -Wall -g -DABORTFP



#  for lots of debugging:

#   CC_OPTS =  -DDEBUG -UNDEBUG  -O -Wall -g -DABORTFP 





# 10/99 added -D__NO_MATH_INLINES to fix a bug in *all* versions of

# gcc 2.8+ as of 10/99.  



CC_SWITCHES = -DNDEBUG -D__NO_MATH_INLINES $(CC_OPTS) $(SNDLIB)  \

$(VORBIS) 

c_sources = \

        brhist.c \

        bitstream.c \

        fft.c \

        get_audio.c \

        id3tag.c \

        ieeefloat.c \

        lame.c \

        newmdct.c \

        parse.c \

        portableio.c \

        psymodel.c \

        quantize.c \

        quantize-pvt.c \

        vbrquantize.c \

        reservoir.c \

        tables.c \

        takehiro.c \

        timestatus.c \

        util.c \

        vorbis_interface.c \

        VbrTag.c \

        version.c \

        mpglib/common.c \

        mpglib/dct64_i386.c \

        mpglib/decode_i386.c \

        mpglib/layer3.c \

        mpglib/tabinit.c \

        mpglib/interface.c \

        mpglib/main.c 



OBJ = $(c_sources:.c=.o)

DEP = $(c_sources:.c=.d)





NASM = nasm

ASFLAGS=-f elf -i i386/

%.o: %.nas

        $(NASM) $(ASFLAGS) $< -o $@

%.o: %.s

        gcc -c $< -o $@



## use MMX extension. you need nasm and MMX supported CPU.

#CC_SWITCCH += -DMMX_choose_table

#OBJ += i386/choose_table.o



%.o: %.c 

        $(CC) $(CPP_OPTS) $(CC_SWITCHES) -c $< -o $@



#%.d: %.c

#       $(SHELL) -ec '$(CC) $(MAKEDEP)  $(CPP_OPTS) $(CC_SWITCHES)  $< | sed 
'\''s;$*.o;& $@;g'\'' > $@'



all: $(PGM)



$(PGM): main.o libmp3lame.a 

        $(CC) $(CC_OPTS) -o $(PGM)  main.o  -L. -lmp3lame $(LIBS) $(LIBSNDFILE) 
$(VORBIS_LIB)



libmp3lame.a:  $(OBJ) Makefile

#       cd libmp3lame

#       make libmp3lame

        ar cr libmp3lame.a  $(OBJ) 



clean:

        del *.o 

        del mpglib\*.o 

        del lame.exe

        del libmp3lame.a 





#

#  testcase.mp3 is a 2926 byte file.  The first number output by

#  wc is the number of bytes which differ between new output

#  and 'official' results.  

#

#  Because of compilier options and effects of roundoff, the 

#  number of bytes which are different may not be zero, but

#  should be at most 30.

#

test: $(PGM)

        ./lame  --nores -h testcase.wav testcase.new.mp3

        cmp -l testcase.new.mp3 testcase.mp3 | wc



testg: $(PGM)

        ./lame -g -h ../test/castanets.wav

Reply via email to