src/Makefile
author Markus Bröker <mbroeker@largo.dyndns.tv>
Mon, 09 Sep 2013 15:54:09 +0200
changeset 4 be4de85337e5
parent 2 6ee2a130dc07
permissions -rw-r--r--
Small changes committer: Markus Bröker <mbroeker@largo.homelinux.org>

###### USER CONFIG ###############
TARGET  = ../bin/vreader         #
MBROLA  = /opt/mbrola/bin/mbrolas #
FESTIVAL= /usr/bin/festival      #
INSTDIR = ~/bin                  #
##### USER CONFIG ENDS ###########

     CC = gcc
MCFLAGS =  -Wall -O2 -DMBROLA $(shell sdl-config --cflags)
FCFLAGS =  -Wall -O2 -DFESTIVAL $(shell sdl-config --cflags)
PCFLAGS =  -Wall -O2 -DPROSER -DLINUX -DWINAPI="" $(shell sdl-config --cflags)
INCLUDE = -I../include
LDFLAGS = -Wl,-rpath,lib -L../lib $(shell sdl-config --libs)
  DEBUG = -g -ggdb

OBJECTS  = main.o
OBJECTS += sentence.o
OBJECTS += keyboard.o
OBJECTS += thread.o
OBJECTS += audioplayer.o
OBJECTS += proser_interface.o
OBJECTS += mbrola_interface.o
OBJECTS += festival_interface.o

.c.o:
	@if [ -f ../lib/libProserGerman.a ]; \
	then \
		$(CC) -c $(PCFLAGS) $(INCLUDE) $(DEBUG) -o $@ $<; \
	elif [ -x $(MBROLA) ]; \
	then \
		if [ ! -f /etc/txt2pho ]; \
		then \
			if [ ! -f ~/.txt2phorc ]; \
			then \
				echo "Warning: ~/.txt2phorc or /etc/txt2pho is missing"; \
			fi; \
		fi; \
		$(CC) -c $(MCFLAGS) $(INCLUDE) $(DEBUG) -o $@ $<; \
	elif [ -x $(FESTIVAL) ]; \
	then \
		$(CC) -c $(FCFLAGS) $(INCLUDE) $(DEBUG) -o $@ $<; \
	else \
		echo "Cannot find any TTS-System on your Machine"; \
		exit 1; \
	fi;
	@echo "CC $<"

all: $(TARGET)

$(TARGET): $(OBJECTS)
	@if [ -f ../lib/libProserGerman.a ]; \
	then \
		$(CC) $(OBJECTS) $(LDFLAGS) -lProserGerman -o $@; \
	else \
		$(CC) $(OBJECTS) $(LDFLAGS) -o $@; fi
	@echo "LD OBJECTS -o $@"

.PHONY: clean distclean

clean:
	@rm -f *.o *~
	@echo "CLEANING $$PWD"

distclean:
	@make clean
	@rm -f $(TARGET)
	@echo "WIPING $$PWD OUT"

install: $(TARGET)
	install -m 755 $(TARGET) $(INSTDIR)