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
--libs speex
)
39 # fall back to our own librbspeex if no suitable found.
41 # This sets up 'SRC' based on the files mentioned in SOURCES
42 SRC
:= $(shell cat
$(SPEEXSRC
)/SOURCES |
$(CC
) $(CFLAGS
) -E
-P
- | grep
-v
"^\#" | grep
-v
"^$$")
43 LIBS
= $(TARGET_DIR
)librbspeex
$(RBARCH
).a
48 OUT
= $(TARGET_DIR
)build
$(RBARCH
)
49 SOURCES
= $(SRC
:%.c
=$(SPEEXSRC
)/%.c
) rbspeex.c rbspeexenc.c rbspeexdec.c
50 OBJS
= $(addprefix $(OUT
)/,$(SRC
:%.c
=%.o
))
51 DEPFILE
= $(OUT
)/dep-speex
56 all: ..
/rbspeexenc ..
/rbspeexdec
58 $(DEPFILE
): $(SOURCES
)
60 $(SILENT
)mkdir
-p
$(OUT
)
61 @echo Creating dependencies
62 $(SILENT
)rm -f
$(DEPFILE
)
63 $(SILENT
)(for each in
$(SOURCES
) x
; do \
64 if
test "x" != "$$each"; then \
65 obj
=`echo $$each | sed -e 's/\.[cS]/.o/' | sed -e 's/^.*\///' `; \
66 $(CC
) -MG
-MM
-MT
"$(OUT)/$$obj" $(CFLAGS
) $$each 2>/dev
/null
; \
68 if
test -n
"$$del"; then \
73 echo
"oo" > /dev
/null
)
77 $(OUT
)/librbspeex.a
: $(OBJS
) $(DEPFILE
) $(OUT
)/rbspeex.o
78 @echo AR
$(OUT
)/librbspeex
$(RBARCH
).a
79 $(SILENT
)$(AR
) ruv
$@
$+ > /dev
/null
2>&1
81 librbspeex
$(RBARCH
).a
: $(OUT
)/librbspeex.a
82 $(SILENT
)cp
$(OUT
)/librbspeex.a
$(TARGET_DIR
)librbspeex
$(RBARCH
).a
84 ..
/rbspeexenc
: $(OBJS
) $(OUT
)/rbspeexenc.o librbspeex
$(RBARCH
).a
85 @echo Linking ..
/rbspeexenc
86 $(SILENT
)$(CC
) $(CFLAGS
) -o ..
/rbspeexenc
$(OUT
)/rbspeexenc.o
$(LIBS
) -lm
$(TARGET_DIR
)librbspeex
$(RBARCH
).a
88 ..
/rbspeexdec
: $(OBJS
) librbspeex
$(RBARCH
).a
$(OUT
)/rbspeexdec.o
89 @echo Linking ..
/rbspeexdec
90 $(SILENT
)$(CC
) $(CFLAGS
) -o ..
/rbspeexdec
$(OUT
)/rbspeexdec.o
$(LIBS
) -lm
$(TARGET_DIR
)librbspeex
$(RBARCH
).a
94 $(SILENT
)$(CC
) $(CFLAGS
) -c
$< -o
$@
96 # some trickery to build ppc and i386 from a single call
99 make RBARCH
=i386 TARGET_DIR
=$(TARGET_DIR
) librbspeexi386.a
102 make RBARCH
=ppc TARGET_DIR
=$(TARGET_DIR
) librbspeexppc.a
105 librbspeex-universal
: librbspeexi386.a librbspeexppc.a
106 @echo lipo librbspeex.a
107 $(SILENT
) rm -f
$(TARGET_DIR
)librbspeex.a
108 lipo
-create
$(TARGET_DIR
)librbspeexppc.a
$(TARGET_DIR
)librbspeexi386.a
-output
$(TARGET_DIR
)librbspeex.a
111 rm -f
$(OBJS
) $(TARGET_DIR
)librbspeex
* ..
/rbspeexenc ..
/rbspeexdec
$(TARGET_DIR
)dep-speex
116 $(SILENT
)mkdir
$(OUT
)