Show status about downloading build information in the status bar.
[kugel-rb.git] / tools / rbspeex / Makefile
blob87ce08f3e7bd9ff30bfb5cbd80b7dfb0f02460fc
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 --silence-errors --libs speex)
37 ifneq ($(SYS_SPEEX),)
38 SYS_SPEEX += $(shell pkg-config --silence-errors --libs speexdsp)
39 endif
40 endif
42 # fall back to our own librbspeex if no suitable found.
43 ifeq ($(SYS_SPEEX),)
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
47 else
48 LIBS = $(SYS_SPEEX)
49 endif
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
55 DIRS =
57 .PHONY : all
59 all: ../rbspeexenc ../rbspeexdec
61 $(DEPFILE): $(SOURCES)
62 @echo MKDIR $(OUT)
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; \
70 fi; \
71 if test -n "$$del"; then \
72 rm $$del; \
73 del=""; \
74 fi \
75 done > $(DEPFILE); \
76 echo "oo" > /dev/null )
78 -include $(DEPFILE)
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
95 %.o:
96 @echo CC $<
97 $(SILENT)$(CC) $(CFLAGS) -c $< -o $@
99 # some trickery to build ppc and i386 from a single call
100 ifeq ($(RBARCH),)
101 librbspeexi386.a:
102 make RBARCH=i386 TARGET_DIR=$(TARGET_DIR) librbspeexi386.a
104 librbspeexppc.a:
105 make RBARCH=ppc TARGET_DIR=$(TARGET_DIR) librbspeexppc.a
106 endif
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
113 clean:
114 rm -f $(OBJS) $(TARGET_DIR)librbspeex* ../rbspeexenc ../rbspeexdec $(TARGET_DIR)dep-speex
115 rm -rf build*
117 $(OUT):
118 @echo MKDIR $(OUT)
119 $(SILENT)mkdir $(OUT)