2007-11-16 15:35:37 +00:00
|
|
|
# __________ __ ___.
|
|
|
|
# Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
|
|
|
# Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
|
|
|
# Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
|
|
|
# Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
|
|
|
# \/ \/ \/ \/ \/
|
2007-11-16 15:58:38 +00:00
|
|
|
# $Id$
|
2007-11-16 15:35:37 +00:00
|
|
|
#
|
|
|
|
|
|
|
|
ifndef V
|
|
|
|
SILENT = @
|
|
|
|
endif
|
|
|
|
|
|
|
|
SPEEXSRC = ../../apps/codecs/libspeex
|
|
|
|
|
2007-11-16 19:53:47 +00:00
|
|
|
INCLUDES = -I $(SPEEXSRC)
|
2007-11-16 15:35:37 +00:00
|
|
|
SPEEXOPTS = -DHAVE_CONFIG_H -DROCKBOX_VOICE_ENCODER
|
|
|
|
|
|
|
|
CFLAGS = $(SPEEXOPTS) $(INCLUDES) -O3 -fomit-frame-pointer -Wno-unused-parameter
|
|
|
|
|
2007-11-16 21:05:34 +00:00
|
|
|
#build standalone win32 executables on cygwin
|
|
|
|
ifeq ($(findstring CYGWIN,$(shell uname)),CYGWIN)
|
|
|
|
CFLAGS+=-mno-cygwin
|
|
|
|
endif
|
|
|
|
|
2008-09-01 19:48:27 +00:00
|
|
|
ifdef RBARCH
|
|
|
|
CFLAGS += -arch $(RBARCH)
|
2008-07-09 21:39:45 +00:00
|
|
|
endif
|
|
|
|
|
2009-10-08 21:26:39 +00:00
|
|
|
# don't try to use the systems libspeex when building a static binary.
|
|
|
|
ifndef STATIC
|
2010-09-05 10:27:39 +00:00
|
|
|
SYS_SPEEX ?= $(shell pkg-config --silence-errors --libs speex speexdsp)
|
2009-10-08 21:26:39 +00:00
|
|
|
endif
|
2008-07-09 21:39:45 +00:00
|
|
|
|
2009-10-08 21:26:39 +00:00
|
|
|
# fall back to our own librbspeex if no suitable found.
|
|
|
|
ifeq ($(SYS_SPEEX),)
|
2007-11-16 15:35:37 +00:00
|
|
|
# This sets up 'SRC' based on the files mentioned in SOURCES
|
2008-07-20 15:47:47 +00:00
|
|
|
SRC := $(shell cat $(SPEEXSRC)/SOURCES | $(CC) $(CFLAGS) -E -P - | grep -v "^\#" | grep -v "^$$")
|
2009-10-08 21:26:39 +00:00
|
|
|
LIBS = $(TARGET_DIR)librbspeex$(RBARCH).a
|
|
|
|
else
|
|
|
|
LIBS = $(SYS_SPEEX)
|
|
|
|
endif
|
2007-11-16 15:35:37 +00:00
|
|
|
|
2009-09-04 21:31:17 +00:00
|
|
|
OUT = $(TARGET_DIR)build$(RBARCH)
|
2007-12-14 16:04:38 +00:00
|
|
|
SOURCES = $(SRC:%.c=$(SPEEXSRC)/%.c) rbspeex.c rbspeexenc.c rbspeexdec.c
|
2008-07-20 15:47:47 +00:00
|
|
|
OBJS = $(addprefix $(OUT)/,$(SRC:%.c=%.o))
|
|
|
|
DEPFILE = $(OUT)/dep-speex
|
2007-11-16 15:35:37 +00:00
|
|
|
DIRS =
|
|
|
|
|
|
|
|
.PHONY : all
|
|
|
|
|
2007-11-28 13:42:44 +00:00
|
|
|
all: ../rbspeexenc ../rbspeexdec
|
2007-11-16 15:35:37 +00:00
|
|
|
|
2009-06-27 21:49:23 +00:00
|
|
|
$(DEPFILE): $(SOURCES)
|
2009-09-04 21:31:17 +00:00
|
|
|
@echo MKDIR $(OUT)
|
|
|
|
$(SILENT)mkdir -p $(OUT)
|
2009-06-27 21:49:23 +00:00
|
|
|
@echo Creating dependencies
|
2007-11-16 15:35:37 +00:00
|
|
|
$(SILENT)rm -f $(DEPFILE)
|
|
|
|
$(SILENT)(for each in $(SOURCES) x; do \
|
|
|
|
if test "x" != "$$each"; then \
|
|
|
|
obj=`echo $$each | sed -e 's/\.[cS]/.o/' | sed -e 's/^.*\///' `; \
|
2008-07-20 15:47:47 +00:00
|
|
|
$(CC) -MG -MM -MT "$(OUT)/$$obj" $(CFLAGS) $$each 2>/dev/null; \
|
2007-11-16 15:35:37 +00:00
|
|
|
fi; \
|
|
|
|
if test -n "$$del"; then \
|
|
|
|
rm $$del; \
|
|
|
|
del=""; \
|
|
|
|
fi \
|
|
|
|
done > $(DEPFILE); \
|
|
|
|
echo "oo" > /dev/null )
|
|
|
|
|
2008-07-20 15:47:47 +00:00
|
|
|
-include $(DEPFILE)
|
|
|
|
|
|
|
|
$(OUT)/librbspeex.a: $(OBJS) $(DEPFILE) $(OUT)/rbspeex.o
|
2008-09-01 19:48:27 +00:00
|
|
|
@echo AR $(OUT)/librbspeex$(RBARCH).a
|
2007-12-15 15:11:53 +00:00
|
|
|
$(SILENT)$(AR) ruv $@ $+ > /dev/null 2>&1
|
2007-11-17 16:54:54 +00:00
|
|
|
|
2008-09-01 19:48:27 +00:00
|
|
|
librbspeex$(RBARCH).a: $(OUT)/librbspeex.a
|
2009-09-04 21:31:17 +00:00
|
|
|
$(SILENT)cp $(OUT)/librbspeex.a $(TARGET_DIR)librbspeex$(RBARCH).a
|
2008-07-20 15:47:47 +00:00
|
|
|
|
2008-09-01 19:48:27 +00:00
|
|
|
../rbspeexenc: $(OBJS) $(OUT)/rbspeexenc.o librbspeex$(RBARCH).a
|
2007-11-17 16:54:54 +00:00
|
|
|
@echo Linking ../rbspeexenc
|
2009-10-08 21:26:39 +00:00
|
|
|
$(SILENT)$(CC) $(CFLAGS) -o ../rbspeexenc $(OUT)/rbspeexenc.o $(LIBS) -lm $(TARGET_DIR)librbspeex$(RBARCH).a
|
2007-11-16 15:35:37 +00:00
|
|
|
|
2008-09-01 19:48:27 +00:00
|
|
|
../rbspeexdec: $(OBJS) librbspeex$(RBARCH).a $(OUT)/rbspeexdec.o
|
2007-11-28 13:42:44 +00:00
|
|
|
@echo Linking ../rbspeexdec
|
2009-10-08 21:26:39 +00:00
|
|
|
$(SILENT)$(CC) $(CFLAGS) -o ../rbspeexdec $(OUT)/rbspeexdec.o $(LIBS) -lm $(TARGET_DIR)librbspeex$(RBARCH).a
|
2007-11-28 13:42:44 +00:00
|
|
|
|
2007-11-16 15:35:37 +00:00
|
|
|
%.o:
|
2007-11-17 16:54:54 +00:00
|
|
|
@echo CC $<
|
2008-07-20 15:47:47 +00:00
|
|
|
$(SILENT)$(CC) $(CFLAGS) -c $< -o $@
|
|
|
|
|
|
|
|
# some trickery to build ppc and i386 from a single call
|
2008-09-01 19:48:27 +00:00
|
|
|
ifeq ($(RBARCH),)
|
2008-07-20 15:47:47 +00:00
|
|
|
librbspeexi386.a:
|
2009-09-04 21:31:17 +00:00
|
|
|
make RBARCH=i386 TARGET_DIR=$(TARGET_DIR) librbspeexi386.a
|
2007-11-16 15:35:37 +00:00
|
|
|
|
2008-07-20 15:47:47 +00:00
|
|
|
librbspeexppc.a:
|
2009-09-04 21:31:17 +00:00
|
|
|
make RBARCH=ppc TARGET_DIR=$(TARGET_DIR) librbspeexppc.a
|
2008-07-20 15:47:47 +00:00
|
|
|
endif
|
|
|
|
|
|
|
|
librbspeex-universal: librbspeexi386.a librbspeexppc.a
|
|
|
|
@echo lipo librbspeex.a
|
2009-09-04 21:31:17 +00:00
|
|
|
$(SILENT) rm -f $(TARGET_DIR)librbspeex.a
|
2009-12-13 21:30:28 +00:00
|
|
|
$(SILENT)lipo -create $(TARGET_DIR)librbspeexppc.a $(TARGET_DIR)librbspeexi386.a -output $(TARGET_DIR)librbspeex.a
|
2007-12-14 16:04:38 +00:00
|
|
|
|
2007-11-16 15:35:37 +00:00
|
|
|
clean:
|
2009-09-04 21:31:17 +00:00
|
|
|
rm -f $(OBJS) $(TARGET_DIR)librbspeex* ../rbspeexenc ../rbspeexdec $(TARGET_DIR)dep-speex
|
2008-07-20 15:47:47 +00:00
|
|
|
rm -rf build*
|
|
|
|
|
2009-09-04 21:31:17 +00:00
|
|
|
$(OUT):
|
|
|
|
@echo MKDIR $(OUT)
|
|
|
|
$(SILENT)mkdir $(OUT)
|
2007-11-16 15:35:37 +00:00
|
|
|
|