shithub: sox

ref: 852e497803ad66828a4ed4d34c9ebc1f919dfa4f
dir: /Makefile.gcc/

View raw version
#
# Sound Tools Makefile
#
# 	builds libst.a and sox
#
# Updated on 02/24/97 - by Chris Bagwell (cbagwell@sprynet.com)
#   Inhanced Makefile to install software and documented a little better.
#
# Updated on 05 May 1998 by Chris Bagwell (cbagwell@sprynet.com)
#   Made some changes for various platforms based on others sugestions
#   and made my home system (Linux) the default. ;-)
#
# July 19, 1998 - Chris Bagwell (cbagwell@sprynet.com)
#   Redid makefile so that libraries could be optionally linked in.
#   Also made each specific portion of system specifics a seperate
#   line to comment/uncomment so that it will be easier to see how
#   to compiler on a wider array of systems (he says with a grin).
#   

# These things are site dependant so you may want to change.
PREFIX	= /usr/local
BINDIR  = $(PREFIX)/bin
LIBDIR	= $(PREFIX)/lib
MANDIR  = $(PREFIX)/man
INCDIR	= $(PREFIX)/include

SRCDIR	= sox-12.17

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

FOBJ	= 8svx.o adpcm.o aiff.o alsa.o au.o auto.o avr.o cdr.o cvsd.o dat.o \
	  g721.o g723_24.o g723_40.o g72x.o gsm.o hcom.o ima_rw.o maud.o \
	  nul.o oss.o raw.o sf.o smp.o sndrtool.o sphere.o sunaudio.o \
	  tx16w.o voc.o wav.o wve.o

EOBJ    = avg.o band.o bandpass.o breject.o btrworth.o chorus.o compand.o \
          copy.o cut.o dcshift.o deemphas.o earwax.o echo.o echos.o fade.o \
	  filter.o flanger.o highp.o highpass.o lowp.o lowpass.o map.o \
	  mask.o pan.o phaser.o pick.o pitch.o polyphas.o rate.o \
	  resample.o reverb.o reverse.o silence.o speed.o split.o \
	  stat.o stretch.o swap.o synth.o trim.o vibro.o vol.o

SOUNDLIB = libst.a
LIBOBJS = $(FOBJ) $(EOBJ) handlers.o libst.o misc.o util.o getopt.o

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

#
# System dependency parameters
#   Find anything related to your system and uncomment.
#

# Default way to delete files.
RM	    = rm -f

# Chose the best compiler you got from the following:
#
# GCC with all warnings and debug info
CC		= gcc -g -Wall
#
# GCC with no special options
# CC		= gcc
#
# Generic compiler on your system
# CC		= cc
#
# EMX GCC under OS/2 seems to need the following
# CC		= gcc -Zcrtdll -Zexe

# For optimized compilation, uncomment one of the following that your
# compiler understands.
#
# gcc's all understand this as do lots of standard compilers.  Try this one
# first.
O		= -O2

# getopt() support is defined here.  If you have a built-in
# getopt() that is compatible with SVR5 then you don't need to
# do anything special.
#
# If you don't have any getopt() function then use the following
# define to use Sox's builtin version
# GETOPT_DEFINES	= -DHAVE_GETOPT
#
# If your system has the more advanced version of getopt() that
# also has its own getopt.h file (Such as the case with GNU libc 2.0)
# then uncomment the following line.  Don't uncomment anything if
# its in stdlib.h.
GETOPT_DEFINES	= -DHAVE_GETOPT_H

# If your system has bswap_16(), bswap_32() in byteswap.h
# (Such as the case with GNU libc 2.1)
# then uncomment the following line to use these fast versions.
BYTESWAP_DEFINES	= -DHAVE_BYTESWAP_H

# If your system has rand() then uncomment the following line.
RAND_DEFINES	= -DHAVE_RAND

# Uncomment the following if your system does not have a built in
# strerror().  This includes SunOS.
#
# STRERR_DEFINES	= -DHAVE_STRERROR

# Uncomment the following if your system does not have a built in
# MEMMOVE function.  Sox will attempt to use bcopy instead.
# SunOS has this problem.
#
# MEMMOVE_DEFINES	= -DHAVE_MEMMOVE

# If you have the GSM 6.10 libraries installed then uncomment the follow
# 4 lines, and change to reflect your installation paths.
#
# GSM_PRE_LIBS	= -L/usr/local/lib
# GSM_POST_LIBS	= -lgsm
# GSM_INCLUDES	= -I/usr/local/include/
# GSM_DEFINES	= -DHAVE_LIBGSM

# For sound support on machines that include the OSS sound driver
# (such as Linux) then uncomment the following line.
#
# PLAYER_DEFINES = -DOSS_PLAYER

# For sound support using the ALSA driver then uncomment the following line.
#
# PLAYER_DEFINES = -DALSA_PLAYER

# For sound support under SunOS and Solaris then uncomment the following line.
#
# PLAYER_DEFINES = -DSUNAUDIO_PLAYER

# Uncomment the following lines if your compiling under DOS or Windows.
# defines .snd to mean a DOS soundtool file (starts with SOUND)
#
# DOS_DEFINES	= -DDOS
# RM		= del /q

# MISC DEFINES - The catch all for things that make even less sense
#  then normal under unix.  If you need more than one of the following
#  MISC DEFINES remember to include them on one line so it isn't just
#  redefined.
#
# If your sysetem has unistd.h then you'll most like need to add 
# HAVE_UNISTD_H to your misd defines.
# MISC_DEFINES_UNI = -DHAVE_UNISTD_H
#
# If your system has malloc.h then you'll most likely need to add
# HAVE_MALLOC_H to your misd defines.
# MSIC_DEFINES_MALLOC = -DHAVE_UNISTD_H
#
# Testing new improved rate code.  You can use the older version if ther
# are problems.
# MISC_DEFINES_OLDRATE	= -DUSE_OLD_RATE
#
# For an extra 32k memory, you can include u-law/a-law lookup
# tables to speed compressiong/decompression of this type data.
# MISC_DEFINES_COMP = -DFAST_ULAW_COMPRESSION -DFAST_ALAW_COMPRESSION 

MISC_DEFINES = $(MISC_DEFINES_UNI) \
	$(MISC_DEFINES_MALLOC) \
	$(MISC_DEFINES_OLDRATE)\
	$(MISC_DEFINES_COMP)

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

# Library setup

# How should libaries be created.  Most systems can simply use the following.
AR		= ar r

# How should 'ranlib' be performed. HPUX, Linux, BSD-ish, SunOS, Solaris
RANLIB		= ranlib

# AT&T System V and GCC on DOS or OS/2 based systems
# RANLIB	= ar ts

# Some systems don't have a ranlib that you can run.  Use the following
# for those systems.
# RANLIB    = true

# Some systems (i.e. MacOsX Server) don't need a separate math library
MATHLIB = -lm
# MATHLIB = 

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

SOX_PRE_LIBS	= $(GSM_PRE_LIBS)
SOX_POST_LIBS	= $(GSM_POST_LIBS) $(MATHLIB)
SOX_INCLUDES	= $(GSM_INCLUDES)
SOX_DEFINES	= $(GSM_DEFINES) $(PLAYER_DEFINES) \
  $(GETOPT_DEFINES) $(BYTESWAP_DEFINES) $(RAND_DEFINES) $(STRERR_DEFINES) \
	$(MEMMOVE_DEFINES) $(DOS_DEFINES) $(NEXT_DEFINES) $(MISC_DEFINES)

CFLAGS  = $O $(SOX_DEFINES) $(SOX_INCLUDES)

all: sox mix

sox: sox.o $(SOUNDLIB)
	$(CC) $(CFLAGS) -o sox sox.o $(SOUNDLIB) $(SOX_PRE_LIBS) $(SOX_POST_LIBS)

mix: mix.o $(SOUNDLIB)
	$(CC) $(CFLAGS) -o mix mix.o $(SOUNDLIB) $(SOX_PRE_LIBS) $(SOX_POST_LIBS)

$(SOUNDLIB): $(LIBOBJS)
	$(RM) $(SOUNDLIB)
	$(AR) $(SOUNDLIB) $(LIBOBJS)
	$(RANLIB) $(SOUNDLIB)

sox.o:		sox.c st.h

$(LIBOBJS):	st.h

man: sox.1 libst.3
	$(RM) sox.txt libst.txt
	nroff -man sox.1 | col -b > sox.txt
	nroff -man soxexam.1 | col -b > soxexam.txt
	nroff -man libst.3 | col -b > libst.txt

install: sox
	if [ -f $(BINDIR)/rec ] ; then $(RM) $(BINDIR)/rec ; fi
	if [ -f $(MANDIR)/man1/rec.1 ] ; then $(RM) $(MANDIR)/man1/rec.1 ; fi
	sed -e 's|@PREFIX@|$(BINDIR)|g' < play.in > play
	install -c -m 755 sox play $(BINDIR)
	install -c -m 644 sox.1 soxexam.1 play.1 $(MANDIR)/man1
	ln -s $(BINDIR)/play $(BINDIR)/rec
	ln -s $(MANDIR)/man1/play.1 $(MANDIR)/man1/rec.1

install-lib: libst.a
	install -c -m 644 libst.a $(LIBDIR)
	install -c -m 644 libst.3 $(MANDIR)/man3
	install -c -m 644 st.h $(INCDIR)

clean:
	$(RM) *~ *.o *.raw *.sf core sox libst.a

tar:	clean
	$(RM) ../$(SRCDIR).tar
	cd ..; tar cvf $(SRCDIR).tar $(SRCDIR)