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
|
2007-12-15 15:11:53 +00:00
|
|
|
# on mingw32, make sure CC is set to gcc
|
|
|
|
ifeq ($(findstring MINGW,$(shell uname)),MINGW)
|
|
|
|
CC = gcc
|
|
|
|
endif
|
2007-11-16 21:05:34 +00:00
|
|
|
|
2008-09-01 19:48:27 +00:00
|
|
|
ifdef RBARCH
|
|
|
|
CFLAGS += -arch $(RBARCH)
|
2008-07-09 21:39:45 +00:00
|
|
|
endif
|
|
|
|
|
|
|
|
|
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 "^$$")
|
2007-11-16 15:35:37 +00:00
|
|
|
|
2008-09-01 19:48:27 +00:00
|
|
|
OUT = 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
|
|
|
|
2008-07-20 15:47:47 +00:00
|
|
|
$(DEPFILE): $(SOURCES) $(OUT)
|
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
|
|
|
|
$(SILENT)cp $(OUT)/librbspeex.a 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
|
2008-09-01 19:48:27 +00:00
|
|
|
$(SILENT)$(CC) $(CFLAGS) -o ../rbspeexenc $(OUT)/rbspeexenc.o librbspeex$(RBARCH).a -lm
|
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
|
2008-09-01 19:48:27 +00:00
|
|
|
$(SILENT)$(CC) $(CFLAGS) -o ../rbspeexdec $(OUT)/rbspeexdec.o librbspeex$(RBARCH).a -lm
|
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:
|
2008-09-01 19:48:27 +00:00
|
|
|
make RBARCH=i386 librbspeexi386.a
|
2007-11-16 15:35:37 +00:00
|
|
|
|
2008-07-20 15:47:47 +00:00
|
|
|
librbspeexppc.a:
|
2008-09-01 19:48:27 +00:00
|
|
|
make RBARCH=ppc librbspeexppc.a
|
2008-07-20 15:47:47 +00:00
|
|
|
endif
|
|
|
|
|
|
|
|
librbspeex-universal: librbspeexi386.a librbspeexppc.a
|
|
|
|
@echo lipo librbspeex.a
|
|
|
|
$(SILENT) rm -f librbspeex.a
|
2008-07-09 21:56:41 +00:00
|
|
|
lipo -create librbspeexppc.a librbspeexi386.a -output librbspeex.a
|
2007-12-14 16:04:38 +00:00
|
|
|
|
2007-11-16 15:35:37 +00:00
|
|
|
clean:
|
2008-07-20 15:47:47 +00:00
|
|
|
rm -f $(OBJS) librbspeex* ../rbspeexenc ../rbspeexdec dep-speex
|
|
|
|
rm -rf build*
|
|
|
|
|
2008-09-01 19:48:27 +00:00
|
|
|
build$(RBARCH):
|
|
|
|
@echo MKDIR build$(RBARCH)
|
|
|
|
$(SILENT)mkdir build$(RBARCH)
|
2007-11-16 15:35:37 +00:00
|
|
|
|