rbutil: store the voice language in the correct setting.
[kugel-rb.git] / tools / rbspeex / Makefile
blob8c46677ce8a14804a22c40669f8152a5ac33a894
1 # __________ __ ___.
2 # Open \______ \ ____ ____ | | _\_ |__ _______ ___
3 # Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
4 # Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
5 # Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
6 # \/ \/ \/ \/ \/
7 # $Id$
10 ifndef V
11 SILENT = @
12 endif
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)
23 CFLAGS+=-mno-cygwin
24 endif
25 # on mingw32, make sure CC is set to gcc
26 ifeq ($(findstring MINGW,$(shell uname)),MINGW)
27 CC = gcc
28 endif
30 ifdef RBARCH
31 CFLAGS += -arch $(RBARCH)
32 endif
34 # don't try to use the systems libspeex when building a static binary.
35 ifndef STATIC
36 SYS_SPEEX = $(shell pkg-config --libs speex)
37 endif
39 # fall back to our own librbspeex if no suitable found.
40 ifeq ($(SYS_SPEEX),)
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
44 else
45 LIBS = $(SYS_SPEEX)
46 endif
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
52 DIRS =
54 .PHONY : all
56 all: ../rbspeexenc ../rbspeexdec
58 $(DEPFILE): $(SOURCES)
59 @echo MKDIR $(OUT)
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; \
67 fi; \
68 if test -n "$$del"; then \
69 rm $$del; \
70 del=""; \
71 fi \
72 done > $(DEPFILE); \
73 echo "oo" > /dev/null )
75 -include $(DEPFILE)
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
92 %.o:
93 @echo CC $<
94 $(SILENT)$(CC) $(CFLAGS) -c $< -o $@
96 # some trickery to build ppc and i386 from a single call
97 ifeq ($(RBARCH),)
98 librbspeexi386.a:
99 make RBARCH=i386 TARGET_DIR=$(TARGET_DIR) librbspeexi386.a
101 librbspeexppc.a:
102 make RBARCH=ppc TARGET_DIR=$(TARGET_DIR) librbspeexppc.a
103 endif
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
110 clean:
111 rm -f $(OBJS) $(TARGET_DIR)librbspeex* ../rbspeexenc ../rbspeexdec $(TARGET_DIR)dep-speex
112 rm -rf build*
114 $(OUT):
115 @echo MKDIR $(OUT)
116 $(SILENT)mkdir $(OUT)