2 # Open \______ \ ____ ____ | | _\_ |__ _______ ___
3 # Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
4 # Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
5 # Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
14 SPEEXSRC
= ..
/..
/lib
/rbcodec
/codecs
/libspeex
16 INCLUDES
= -I
$(SPEEXSRC
)
17 SPEEXOPTS
= -DHAVE_CONFIG_H
-DROCKBOX_VOICE_ENCODER
19 CFLAGS
+= $(SPEEXOPTS
) $(INCLUDES
) -O3
-fomit-frame-pointer
-Wno-unused-parameter
21 #build standalone win32 executables on cygwin
22 ifeq ($(findstring CYGWIN
,$(shell uname
)),CYGWIN
)
25 # OS X specifics. Needs to consider cross compiling for Windows.
26 ifeq ($(findstring Darwin
,$(shell uname
)),Darwin
)
27 ifneq ($(findstring mingw
,$(CROSS
)$(CC
)),mingw
)
28 # when building libs for OS X build for both i386 and ppc at the same time.
29 # This creates fat objects, and ar can only create the archive but not operate
30 # on it. As a result the ar call must NOT use the u (update) flag.
31 ARCHFLAGS
= -arch ppc
-arch i386
32 # building against SDK 10.4 is not compatible with gcc-4.2 (default on newer Xcode)
33 # might need adjustment for older Xcode.
35 CFLAGS
+= -isysroot
/Developer
/SDKs
/MacOSX10.4u.sdk
-mmacosx-version-min
=10.4
40 # don't try to use the systems libspeex when building a static binary.
42 SYS_SPEEX ?
= $(shell pkg-config
--silence-errors
--libs speex speexdsp
)
45 # fall back to our own librbspeex if no suitable found.
47 # This sets up 'SRC' based on the files mentioned in SOURCES
48 SRC
:= $(shell cat
$(SPEEXSRC
)/SOURCES |
$(CC
) $(CFLAGS
) -E
-P
- | grep
-v
"^\#" | grep
-v
"^$$")
49 LIBS
= $(TARGET_DIR
)librbspeex.a
54 TARGET_DIR ?
= $(shell pwd
)/
55 BUILD_DIR ?
= $(TARGET_DIR
)build
56 SOURCES
= $(SRC
:%.c
=$(SPEEXSRC
)/%.c
) rbspeex.c rbspeexenc.c rbspeexdec.c
57 OBJS
= $(addprefix $(BUILD_DIR
)/,$(SRC
:%.c
=%.o
))
58 DEPFILE
= $(BUILD_DIR
)/dep-speex
63 all: ..
/rbspeexenc ..
/rbspeexdec
65 $(DEPFILE
): $(SOURCES
)
66 @echo MKDIR
$(BUILD_DIR
)
67 $(SILENT
)mkdir
-p
$(BUILD_DIR
)
68 @echo Creating dependencies
69 $(SILENT
)rm -f
$(DEPFILE
)
70 $(SILENT
)(for each in
$(SOURCES
) x
; do \
71 if
test "x" != "$$each"; then \
72 obj
=`echo $$each | sed -e 's/\.[cS]/.o/' | sed -e 's/^.*\///' `; \
73 $(CC
) -MG
-MM
-MT
"$(BUILD_DIR)/$$obj" $(CFLAGS
) $$each 2>/dev
/null
; \
75 if
test -n
"$$del"; then \
80 echo
"oo" > /dev
/null
)
84 dll
: $(TARGET_DIR
)rbspeex.dll
86 $(TARGET_DIR
)rbspeex.dll
: $(OBJS
) $(BUILD_DIR
)/rbspeex.o
87 @echo DLL
$(notdir $@
)
88 $(SILENT
)$(CROSS
)$(CC
) $(CFLAGS
) -shared
-o
$@
$^ \
89 -Wl
,--output-def
,$(TARGET_DIR
)rbspeex.def
91 $(TARGET_DIR
)librbspeex.a
: $(OBJS
) $(BUILD_DIR
)/rbspeex.o
94 $(SILENT
)$(CROSS
)$(AR
) rcs
$@
$^
> /dev
/null
2>&1
96 librbspeex.a
: $(TARGET_DIR
)librbspeex.a
98 ..
/rbspeexenc
: $(OBJS
) $(BUILD_DIR
)/rbspeexenc.o librbspeex.a
99 @echo Linking ..
/rbspeexenc
100 $(SILENT
)$(CROSS
)$(CC
) $(CFLAGS
) $(ARCHFLAGS
) -o ..
/rbspeexenc
$(BUILD_DIR
)/rbspeexenc.o \
101 $(LIBS
) -lm
$(TARGET_DIR
)librbspeex.a
103 ..
/rbspeexdec
: $(OBJS
) librbspeex.a
$(BUILD_DIR
)/rbspeexdec.o
104 @echo Linking ..
/rbspeexdec
105 $(SILENT
)$(CROSS
)$(CC
) $(CFLAGS
) $(ARCHFLAGS
) -o ..
/rbspeexdec
$(BUILD_DIR
)/rbspeexdec.o \
106 $(LIBS
) -lm
$(TARGET_DIR
)librbspeex.a
110 $(SILENT
)$(CROSS
)$(CC
) $(CFLAGS
) $(ARCHFLAGS
) -c
$< -o
$@
113 rm -f
$(OBJS
) $(TARGET_DIR
)librbspeex
* ..
/rbspeexenc ..
/rbspeexdec
$(TARGET_DIR
)dep-speex
117 @echo MKDIR
$(BUILD_DIR
)
118 $(SILENT
)mkdir
$(BUILD_DIR
)