alsa support is conditional

This commit updates the makefile and the documentation to explain how to
build alsa support.  It has not been fully tested, so it is not built by
default.  Also, I was able to remove the conditional compile directives
from the source.
This commit is contained in:
William Hubbs 2009-06-20 16:46:50 -05:00
commit 1d02169aa5
4 changed files with 31 additions and 16 deletions

View file

@ -1,23 +1,30 @@
INSTALL = install
CFLAGS ?= -DUSE_ALSA
SRCS = \
cli.c \
alsa.c \
espeakup.c \
espeak_sound.c \
queue.c \
softsynth.c \
synth.c
OBJS = $(SRCS:.c=.o)
LDLIBS = -lespeak -lasound
CFLAGS += -Wall
LDLIBS = -lespeak
PREFIX = /usr
MANDIR = $(PREFIX)/share/man/man8
BINDIR = $(PREFIX)/bin
INSTALL = install
ALSA_SRCS = alsa.c
ESPEAK_SRCS = espeak_sound.c
SRCS = \
cli.c \
espeakup.c \
queue.c \
softsynth.c \
synth.c
ifeq ($(AUDIO),alsa)
SRCS += $(ALSA_SRCS)
LDLIBS += -lasound
else
SRCS += $(ESPEAK_SRCS)
endif
OBJS = $(SRCS:.c=.o)
all: espeakup
install: espeakup
@ -27,7 +34,7 @@ install: espeakup
$(INSTALL) -m 0644 espeakup.8 $(DESTDIR)$(MANDIR)
clean:
$(RM) $(OBJS)
$(RM) *.o
distclean: clean
$(RM) espeakup
@ -44,5 +51,6 @@ softsynth.o: softsynth.c espeakup.h
synth.o: synth.c espeakup.h
%.o: %.c
$(CC) -c -Wall $(CFLAGS) $(CPPFLAGS) -o $@ $<
alsa.o: alsa.c espeakup.h
espeak_sound.o: espeak_sound.c espeakup.h

11
README
View file

@ -25,6 +25,17 @@ To install espeakup, first cd into the directory where you
unpacked the tarball, then issue make to compile the program. Once this
is done, as root, issue make install. This will install espeakup in /usr/bin.
ALSA SUPPORT
============
Direct support for alsa was just contributed to this project; I would
like to thank Chris Brannon for his work on this. Currently,, it is in
the early stages, so if you have any suggestions or patches, I am
definitely interested.
To build with alsa support, add "AUDIO=alsa" to the make command when you
compile the program.
Starting Up
===========

2
alsa.c
View file

@ -22,7 +22,6 @@
* Description: Produce audio by calling the ALSA library directly.
*/
#ifdef USE_ALSA
#include <stdio.h>
#include <stdlib.h>
#include <limits.h>
@ -146,4 +145,3 @@ int init_audio(void)
audio_callback = alsa_play_callback;
return 0;
}
#endif

View file

@ -1,4 +1,3 @@
#ifndef USE_ALSA
#include "espeakup.h"
int init_audio(void)
{
@ -6,4 +5,3 @@ int init_audio(void)
audio_callback = NULL;
return 0;
}
#endif