From e66311bb992122ca4797eab1d2a79b1619c71b9b Mon Sep 17 00:00:00 2001 From: William Hubbs Date: Wed, 23 Sep 2009 15:44:51 -0500 Subject: [PATCH] added automatic dependency tracking to the Makefile --- .gitignore | 1 + Makefile | 33 +++++++++++---------------------- 2 files changed, 12 insertions(+), 22 deletions(-) diff --git a/.gitignore b/.gitignore index 49299b3..aeb1414 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ espeakup +*.d *.o diff --git a/Makefile b/Makefile index 32c4293..3ae9301 100644 --- a/Makefile +++ b/Makefile @@ -4,9 +4,14 @@ PREFIX = /usr/local MANDIR = $(PREFIX)/share/man/man8 BINDIR = $(PREFIX)/bin -ALSA_SRCS = alsa.c -PORTAUDIO_SRCS = portaudio.c -SRCS = \ +ifndef AUDIO + AUDIO=portaudio +endif + +alsa_SRCS = alsa.c +portaudio_SRCS = portaudio.c + +SRCS = $($(AUDIO)_SRCS) \ cli.c \ espeak.c \ espeakup.c \ @@ -15,10 +20,7 @@ SRCS = \ softsynth.c ifeq ($(AUDIO),alsa) -SRCS += $(ALSA_SRCS) SOUNDLIB = -lasound -else -SRCS += $(PORTAUDIO_SRCS) endif OBJS = $(SRCS:.c=.o) @@ -34,7 +36,7 @@ install: espeakup $(INSTALL) -m 0644 espeakup.8 $(DESTDIR)$(MANDIR) clean: - $(RM) *.o + $(RM) *.d *.o distclean: clean $(RM) espeakup @@ -42,19 +44,6 @@ distclean: clean espeakup: $(OBJS) %.o: %.c - $(CC) $(CFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -Wall -c $< - -alsa.o: alsa.c espeakup.h - -cli.o: cli.c espeakup.h - -espeak.o: espeak.c espeakup.h queue.h - -espeakup.o: espeakup.c espeakup.h queue.h - -portaudio.o: portaudio.c espeakup.h - -queue.o: queue.c queue.h - -softsynth.o: softsynth.c espeakup.h queue.h + $(COMPILE.c) -MMD -Wall $(OUTPUT_OPTION) $< +-include $(SRCS:.c=.d)