diff --git a/Makefile b/Makefile index c45f437..059db6b 100644 --- a/Makefile +++ b/Makefile @@ -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 diff --git a/README b/README index 317db39..c5f6f5e 100644 --- a/README +++ b/README @@ -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 =========== diff --git a/alsa.c b/alsa.c index 88af42f..ebfaeab 100644 --- a/alsa.c +++ b/alsa.c @@ -22,7 +22,6 @@ * Description: Produce audio by calling the ALSA library directly. */ -#ifdef USE_ALSA #include #include #include @@ -146,4 +145,3 @@ int init_audio(void) audio_callback = alsa_play_callback; return 0; } -#endif diff --git a/espeak_sound.c b/espeak_sound.c index e8a3a03..f89538a 100644 --- a/espeak_sound.c +++ b/espeak_sound.c @@ -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