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
)
25 # on mingw32, make sure CC is set to gcc
26 ifeq ($(findstring MINGW
,$(shell uname
)),MINGW
)
31 CFLAGS
+= -arch
$(RBARCH
)
34 # don't try to use the systems libspeex when building a static binary.
36 SYS_SPEEX
= $(shell pkg-config
--silence-errors
--libs speex
)
38 SYS_SPEEX
+= $(shell pkg-config
--silence-errors
--libs speexdsp
)
42 # fall back to our own librbspeex if no suitable found.
44 # This sets up 'SRC' based on the files mentioned in SOURCES
45 SRC
:= $(shell cat
$(SPEEXSRC
)/SOURCES |
$(CC
) $(CFLAGS
) -E
-P
- | grep
-v
"^\#" | grep
-v
"^$$")
46 LIBS
= $(TARGET_DIR
)librbspeex
$(RBARCH
).a
51 OUT
= $(TARGET_DIR
)build
$(RBARCH
)
52 SOURCES
= $(SRC
:%.c
=$(SPEEXSRC
)/%.c
) rbspeex.c rbspeexenc.c rbspeexdec.c
53 OBJS
= $(addprefix $(OUT
)/,$(SRC
:%.c
=%.o
))
54 DEPFILE
= $(OUT
)/dep-speex
59 all: ..
/rbspeexenc ..
/rbspeexdec
61 $(DEPFILE
): $(SOURCES
)
63 $(SILENT
)mkdir
-p
$(OUT
)
64 @echo Creating dependencies
65 $(SILENT
)rm -f
$(DEPFILE
)
66 $(SILENT
)(for each in
$(SOURCES
) x
; do \
67 if
test "x" != "$$each"; then \
68 obj
=`echo $$each | sed -e 's/\.[cS]/.o/' | sed -e 's/^.*\///' `; \
69 $(CC
) -MG
-MM
-MT
"$(OUT)/$$obj" $(CFLAGS
) $$each 2>/dev
/null
; \
71 if
test -n
"$$del"; then \
76 echo
"oo" > /dev
/null
)
80 $(OUT
)/librbspeex.a
: $(OBJS
) $(DEPFILE
) $(OUT
)/rbspeex.o
81 @echo AR
$(OUT
)/librbspeex
$(RBARCH
).a
82 $(SILENT
)$(AR
) ruv
$@
$+ > /dev
/null
2>&1
84 librbspeex
$(RBARCH
).a
: $(OUT
)/librbspeex.a
85 $(SILENT
)cp
$(OUT
)/librbspeex.a
$(TARGET_DIR
)librbspeex
$(RBARCH
).a
87 ..
/rbspeexenc
: $(OBJS
) $(OUT
)/rbspeexenc.o librbspeex
$(RBARCH
).a
88 @echo Linking ..
/rbspeexenc
89 $(SILENT
)$(CC
) $(CFLAGS
) -o ..
/rbspeexenc
$(OUT
)/rbspeexenc.o
$(LIBS
) -lm
$(TARGET_DIR
)librbspeex
$(RBARCH
).a
91 ..
/rbspeexdec
: $(OBJS
) librbspeex
$(RBARCH
).a
$(OUT
)/rbspeexdec.o
92 @echo Linking ..
/rbspeexdec
93 $(SILENT
)$(CC
) $(CFLAGS
) -o ..
/rbspeexdec
$(OUT
)/rbspeexdec.o
$(LIBS
) -lm
$(TARGET_DIR
)librbspeex
$(RBARCH
).a
97 $(SILENT
)$(CC
) $(CFLAGS
) -c
$< -o
$@
99 # some trickery to build ppc and i386 from a single call
102 make RBARCH
=i386 TARGET_DIR
=$(TARGET_DIR
) librbspeexi386.a
105 make RBARCH
=ppc TARGET_DIR
=$(TARGET_DIR
) librbspeexppc.a
108 librbspeex-universal
: librbspeexi386.a librbspeexppc.a
109 @echo lipo librbspeex.a
110 $(SILENT
) rm -f
$(TARGET_DIR
)librbspeex.a
111 lipo
-create
$(TARGET_DIR
)librbspeexppc.a
$(TARGET_DIR
)librbspeexi386.a
-output
$(TARGET_DIR
)librbspeex.a
114 rm -f
$(OBJS
) $(TARGET_DIR
)librbspeex
* ..
/rbspeexenc ..
/rbspeexdec
$(TARGET_DIR
)dep-speex
119 $(SILENT
)mkdir
$(OUT
)