modify Makefile so its possible to build a universal lib. Building is still complicated.
[kugel-rb.git] / tools / rbspeex / Makefile
blob5ed8d67425081740479d60368f1795fced66d280
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 ifeq ($(findstring Darwin,$(shell uname)),Darwin)
31 ARCH_CMD = -arch $(ARCH)
32 endif
35 # This sets up 'SRC' based on the files mentioned in SOURCES
36 SRC := $(shell cat $(SPEEXSRC)/SOURCES | $(CC) $(CFLAGS) -E -P - | grep -v "^\#")
38 SOURCES = $(SRC:%.c=$(SPEEXSRC)/%.c) rbspeex.c rbspeexenc.c rbspeexdec.c
39 OBJS := $(SRC:%.c=%.o)
40 DEPFILE = dep-speex
41 DIRS =
43 .PHONY : all
45 all: ../rbspeexenc ../rbspeexdec
47 $(DEPFILE): $(SOURCES)
48 $(SILENT)rm -f $(DEPFILE)
49 $(SILENT)(for each in $(SOURCES) x; do \
50 if test "x" != "$$each"; then \
51 obj=`echo $$each | sed -e 's/\.[cS]/.o/' | sed -e 's/^.*\///' `; \
52 $(CC) -MG -MM -MT "$$obj" $(CFLAGS) $$each 2>/dev/null; \
53 fi; \
54 if test -n "$$del"; then \
55 rm $$del; \
56 del=""; \
57 fi \
58 done > $(DEPFILE); \
59 echo "oo" > /dev/null )
61 librbspeex$(ARCH_CMD).a: $(OBJS) $(DEPFILE) rbspeex.o
62 @echo AR librbspeex.a
63 $(SILENT)$(AR) ruv $@ $+ > /dev/null 2>&1
65 ../rbspeexenc: $(OBJS) rbspeexenc.o librbspeex.a
66 @echo Linking ../rbspeexenc
67 $(SILENT)$(CC) $(CFLAGS) -o ../rbspeexenc rbspeexenc.o librbspeex.a -lm
69 ../rbspeexdec: $(OBJS) librbspeex.a rbspeexdec.o
70 @echo Linking ../rbspeexdec
71 $(SILENT)$(CC) $(CFLAGS) -o ../rbspeexdec rbspeexdec.o librbspeex.a -lm
73 %.o:
74 @echo CC $<
75 $(SILENT)$(CC) $(CFLAGS) -c $< -o $@ $(ARCH_CMD)
77 universal: librbspeexppc.a librbspeexi386.a
78 @echo lipo libusb.a
79 @(SILENT) lipo -create librbspeexppc.a librbspeexi386.a -output librbspeex.a
81 clean:
82 rm -f $(OBJS) rbspeex.o libspeex.a librbspeex.a rbspeexenc.o ../rbspeexenc dep-speex
84 -include $(DEPFILE)