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
|
|
|
|
|
2011-06-26 01:32:25 +00:00
|
|
|
SPEEXSRC = ../../lib/rbcodec/codecs/libspeex
|
2007-11-16 15:35:37 +00:00
|
|
|
|
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
|
|
|
|
|
2012-01-02 16:59:26 +00:00
|
|
|
CFLAGS += $(SPEEXOPTS) $(INCLUDES) -O3 -fomit-frame-pointer -Wno-unused-parameter
|
2007-11-16 15:35:37 +00:00
|
|
|
|
2007-11-16 21:05:34 +00:00
|
|
|
#build standalone win32 executables on cygwin
|
|
|
|
ifeq ($(findstring CYGWIN,$(shell uname)),CYGWIN)
|
|
|
|
CFLAGS+=-mno-cygwin
|
|
|
|
endif
|
2012-01-05 22:26:04 +00:00
|
|
|
# OS X specifics. Needs to consider cross compiling for Windows.
|
|
|
|
ifeq ($(findstring Darwin,$(shell uname)),Darwin)
|
|
|
|
ifneq ($(findstring mingw,$(CROSS)$(CC)),mingw)
|
|
|
|
# when building libs for OS X build for both i386 and ppc at the same time.
|
|
|
|
# This creates fat objects, and ar can only create the archive but not operate
|
|
|
|
# on it. As a result the ar call must NOT use the u (update) flag.
|
|
|
|
ARCHFLAGS = -arch ppc -arch i386
|
|
|
|
# building against SDK 10.4 is not compatible with gcc-4.2 (default on newer Xcode)
|
|
|
|
# might need adjustment for older Xcode.
|
|
|
|
CC ?= gcc-4.0
|
|
|
|
CFLAGS += -isysroot /Developer/SDKs/MacOSX10.4u.sdk -mmacosx-version-min=10.4
|
|
|
|
NATIVECC ?= gcc-4.0
|
|
|
|
endif
|
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 "^$$")
|
2012-01-05 22:26:04 +00:00
|
|
|
LIBS = $(TARGET_DIR)librbspeex.a
|
2009-10-08 21:26:39 +00:00
|
|
|
else
|
|
|
|
LIBS = $(SYS_SPEEX)
|
|
|
|
endif
|
2007-11-16 15:35:37 +00:00
|
|
|
|
2012-01-05 22:26:04 +00:00
|
|
|
TARGET_DIR ?= $(shell pwd)/
|
|
|
|
BUILD_DIR ?= $(TARGET_DIR)build
|
2007-12-14 16:04:38 +00:00
|
|
|
SOURCES = $(SRC:%.c=$(SPEEXSRC)/%.c) rbspeex.c rbspeexenc.c rbspeexdec.c
|
2012-01-05 22:26:04 +00:00
|
|
|
OBJS = $(addprefix $(BUILD_DIR)/,$(SRC:%.c=%.o))
|
|
|
|
DEPFILE = $(BUILD_DIR)/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)
|
2012-01-05 22:26:04 +00:00
|
|
|
@echo MKDIR $(BUILD_DIR)
|
|
|
|
$(SILENT)mkdir -p $(BUILD_DIR)
|
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/^.*\///' `; \
|
2012-01-05 22:26:04 +00:00
|
|
|
$(CC) -MG -MM -MT "$(BUILD_DIR)/$$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 )
|
|
|
|
|
2012-01-05 22:26:04 +00:00
|
|
|
include $(DEPFILE)
|
2008-07-20 15:47:47 +00:00
|
|
|
|
2011-12-17 09:57:28 +00:00
|
|
|
dll: $(TARGET_DIR)rbspeex.dll
|
|
|
|
|
2012-01-05 22:26:04 +00:00
|
|
|
$(TARGET_DIR)rbspeex.dll: $(OBJS) $(BUILD_DIR)/rbspeex.o
|
2011-12-16 21:10:25 +00:00
|
|
|
@echo DLL $(notdir $@)
|
2011-12-17 09:57:28 +00:00
|
|
|
$(SILENT)$(CROSS)$(CC) $(CFLAGS) -shared -o $@ $^ \
|
|
|
|
-Wl,--output-def,$(TARGET_DIR)rbspeex.def
|
2011-12-16 21:10:25 +00:00
|
|
|
|
2012-01-05 22:26:04 +00:00
|
|
|
$(TARGET_DIR)librbspeex.a: $(OBJS) $(BUILD_DIR)/rbspeex.o
|
2011-12-03 13:58:42 +00:00
|
|
|
@echo AR $(notdir $@)
|
2012-01-05 22:26:04 +00:00
|
|
|
$(SILENT)rm -f $@
|
|
|
|
$(SILENT)$(CROSS)$(AR) rcs $@ $^ > /dev/null 2>&1
|
2007-11-17 16:54:54 +00:00
|
|
|
|
2012-01-05 22:26:04 +00:00
|
|
|
librbspeex.a: $(TARGET_DIR)librbspeex.a
|
|
|
|
|
|
|
|
../rbspeexenc: $(OBJS) $(BUILD_DIR)/rbspeexenc.o librbspeex.a
|
2007-11-17 16:54:54 +00:00
|
|
|
@echo Linking ../rbspeexenc
|
2012-01-05 22:26:04 +00:00
|
|
|
$(SILENT)$(CROSS)$(CC) $(CFLAGS) $(ARCHFLAGS) -o ../rbspeexenc $(BUILD_DIR)/rbspeexenc.o \
|
|
|
|
$(LIBS) -lm $(TARGET_DIR)librbspeex.a
|
2007-11-16 15:35:37 +00:00
|
|
|
|
2012-01-05 22:26:04 +00:00
|
|
|
../rbspeexdec: $(OBJS) librbspeex.a $(BUILD_DIR)/rbspeexdec.o
|
2007-11-28 13:42:44 +00:00
|
|
|
@echo Linking ../rbspeexdec
|
2012-01-05 22:26:04 +00:00
|
|
|
$(SILENT)$(CROSS)$(CC) $(CFLAGS) $(ARCHFLAGS) -o ../rbspeexdec $(BUILD_DIR)/rbspeexdec.o \
|
|
|
|
$(LIBS) -lm $(TARGET_DIR)librbspeex.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 $<
|
2012-01-05 22:26:04 +00:00
|
|
|
$(SILENT)$(CROSS)$(CC) $(CFLAGS) $(ARCHFLAGS) -c $< -o $@
|
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*
|
|
|
|
|
2012-01-05 22:26:04 +00:00
|
|
|
$(BUILD_DIR):
|
|
|
|
@echo MKDIR $(BUILD_DIR)
|
|
|
|
$(SILENT)mkdir $(BUILD_DIR)
|
2007-11-16 15:35:37 +00:00
|
|
|
|