shithub: sox

ref: d3139893acde1c0948423af52f377389c7a8458c
dir: /Makefile.gcc/

View raw version
#
# Sound Tools Makefile
#
# 	builds libst.a, sox, soxmix, and play
#
# To use this Makefile, first copy stconfig.h.in to stconfig.h and modify
# that file to reflect your environment.  This will should also be modified
# to reflect your build environment.
#   

# 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.3

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

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

EOBJ    = avg.o band.o bandpass.o breject.o btrworth.o chorus.o compand.o \
          copy.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 pitch.o polyphas.o rate.o \
	  resample.o reverb.o reverse.o silence.o speed.o \
	  stat.o stretch.o swap.o synth.o trim.o vibro.o vol.o

SOUNDLIB = libst.a
LIBOBJS = $(FOBJ) $(EOBJ) handlers.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

# Default way to provide symbolic links from one file to another
LN_S	    = ln -s

# 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

# 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

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

# 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 = 

# If your linking Ogg Vorbis support, uncomment the following
#VORBISLIB = -logg -lvorbis -lvorbisfile -lvorbisenc

# If your linking MP3 support, uncomment the following
#MP3LIB = -lmad -lmp3lame

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

SOX_PRE_LIBS    = -L./gsm
SOX_POST_LIBS	= -lgsm $(VORBISLIB) $(MP3LIB) $(MATHLIB)
SOX_INCLUDES    =
SOX_DEFINES	= -DGSM_SUPPORT $(DOS_DEFINES)

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

all: sox soxmix

sox: sox.o $(SOUNDLIB) gsm/libgsm.a
	$(CC) $(CFLAGS) -o sox sox.o $(SOUNDLIB) $(SOX_PRE_LIBS) $(SOX_POST_LIBS)

soxmix.o: sox.c
	$(CC) $(CLAGS) -DSOXMIX -c -o soxmix.o sox.c

soxmix: soxmix.o $(SOUNDLIB) gsm/libgsm.a
	$(CC) $(CFLAGS) -o soxmix soxmix.o $(SOUNDLIB) $(SOX_PRE_LIBS) $(SOX_POST_LIBS)

play: play.in
	$(SED) -e 's|@PREFIX@|$(bindir)|g' < $(srcdir)/play.in > play

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

gsm/libgsm.a:
	cd gsm && $(MAKE)

sox.o:		sox.c st.h

$(LIBOBJS):	st.h st_i.h

man: sox.1 soxexam.1 libst.3
	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 soxmix
	$(INSTALL) -c -m 755 sox $(bindir)
	$(INSTALL) -c -m 755 sox play $(bindir)
	$(INSTALL) -c -m 644 sox.1 $(mandir)/man1
	if [ -f $(mandir)/man1/soxmmix.1 ] ; then $(RM) $(mandir)/man1/soxmix.1; fi
	$(LN_S) $(mandir)/man1/sox.1 $(mandir)/man1/soxmix.1
	$(INSTALL) -c -m 644 soxexam.1 $(mandir)/man1

install-play: play
	if [ -f $(bindir)/rec ] ; then $(RM) $(bindir)/rec ; fi
	if [ -f $(mandir)/man1/rec.1 ] ; then $(RM) $(mandir)/man1/rec.1 ; fi
	install -c -m 755 play $(bindir)
	install -c -m 644 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)
	install -c -m 644 ststdint.h $(incdir)

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

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