2 # Open \______ \ ____ ____ | | _\_ |__ _______ ___
3 # Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
4 # Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
5 # Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
14 SPEEXSRC
= ..
/..
/apps
/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
)
27 CFLAGS
+= -arch
$(RBARCH
)
30 # don't try to use the systems libspeex when building a static binary.
32 SYS_SPEEX ?
= $(shell pkg-config
--silence-errors
--libs speex speexdsp
)
35 # fall back to our own librbspeex if no suitable found.
37 # This sets up 'SRC' based on the files mentioned in SOURCES
38 SRC
:= $(shell cat
$(SPEEXSRC
)/SOURCES |
$(CC
) $(CFLAGS
) -E
-P
- | grep
-v
"^\#" | grep
-v
"^$$")
39 LIBS
= $(TARGET_DIR
)librbspeex
$(RBARCH
).a
44 OUT
= $(TARGET_DIR
)build
$(RBARCH
)
45 SOURCES
= $(SRC
:%.c
=$(SPEEXSRC
)/%.c
) rbspeex.c rbspeexenc.c rbspeexdec.c
46 OBJS
= $(addprefix $(OUT
)/,$(SRC
:%.c
=%.o
))
47 DEPFILE
= $(OUT
)/dep-speex
52 all: ..
/rbspeexenc ..
/rbspeexdec
54 $(DEPFILE
): $(SOURCES
)
56 $(SILENT
)mkdir
-p
$(OUT
)
57 @echo Creating dependencies
58 $(SILENT
)rm -f
$(DEPFILE
)
59 $(SILENT
)(for each in
$(SOURCES
) x
; do \
60 if
test "x" != "$$each"; then \
61 obj
=`echo $$each | sed -e 's/\.[cS]/.o/' | sed -e 's/^.*\///' `; \
62 $(CC
) -MG
-MM
-MT
"$(OUT)/$$obj" $(CFLAGS
) $$each 2>/dev
/null
; \
64 if
test -n
"$$del"; then \
69 echo
"oo" > /dev
/null
)
73 $(OUT
)/librbspeex.a
: $(OBJS
) $(DEPFILE
) $(OUT
)/rbspeex.o
74 @echo AR
$(OUT
)/librbspeex
$(RBARCH
).a
75 $(SILENT
)$(AR
) ruv
$@
$+ > /dev
/null
2>&1
77 librbspeex
$(RBARCH
).a
: $(OUT
)/librbspeex.a
78 $(SILENT
)cp
$(OUT
)/librbspeex.a
$(TARGET_DIR
)librbspeex
$(RBARCH
).a
80 ..
/rbspeexenc
: $(OBJS
) $(OUT
)/rbspeexenc.o librbspeex
$(RBARCH
).a
81 @echo Linking ..
/rbspeexenc
82 $(SILENT
)$(CC
) $(CFLAGS
) -o ..
/rbspeexenc
$(OUT
)/rbspeexenc.o
$(LIBS
) -lm
$(TARGET_DIR
)librbspeex
$(RBARCH
).a
84 ..
/rbspeexdec
: $(OBJS
) librbspeex
$(RBARCH
).a
$(OUT
)/rbspeexdec.o
85 @echo Linking ..
/rbspeexdec
86 $(SILENT
)$(CC
) $(CFLAGS
) -o ..
/rbspeexdec
$(OUT
)/rbspeexdec.o
$(LIBS
) -lm
$(TARGET_DIR
)librbspeex
$(RBARCH
).a
90 $(SILENT
)$(CC
) $(CFLAGS
) -c
$< -o
$@
92 # some trickery to build ppc and i386 from a single call
95 make RBARCH
=i386 TARGET_DIR
=$(TARGET_DIR
) librbspeexi386.a
98 make RBARCH
=ppc TARGET_DIR
=$(TARGET_DIR
) librbspeexppc.a
101 librbspeex-universal
: librbspeexi386.a librbspeexppc.a
102 @echo lipo librbspeex.a
103 $(SILENT
) rm -f
$(TARGET_DIR
)librbspeex.a
104 $(SILENT
)lipo
-create
$(TARGET_DIR
)librbspeexppc.a
$(TARGET_DIR
)librbspeexi386.a
-output
$(TARGET_DIR
)librbspeex.a
107 rm -f
$(OBJS
) $(TARGET_DIR
)librbspeex
* ..
/rbspeexenc ..
/rbspeexdec
$(TARGET_DIR
)dep-speex
112 $(SILENT
)mkdir
$(OUT
)