summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDominik Riebeling <Dominik.Riebeling@gmail.com>2008-07-20 15:47:47 +0000
committerDominik Riebeling <Dominik.Riebeling@gmail.com>2008-07-20 15:47:47 +0000
commitfd61460c4504da289635c7ece2ce4973311921cf (patch)
tree605e2b1d878db3a0b0d664fd6b0e4124014c55a0
parent903a048ddcf5b95dc85d1c440daf0f397b6d60b0 (diff)
downloadrockbox-fd61460c4504da289635c7ece2ce4973311921cf.tar.gz
rockbox-fd61460c4504da289635c7ece2ce4973311921cf.zip
Extend rbspeex Makefile to allow easier building a universal binary needed for rbutil.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@18103 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--rbutil/rbutilqt/rbutilqt.pro15
-rw-r--r--tools/rbspeex/Makefile54
2 files changed, 40 insertions, 29 deletions
diff --git a/rbutil/rbutilqt/rbutilqt.pro b/rbutil/rbutilqt/rbutilqt.pro
index e9dd5ab10d..f0c95ac5a0 100644
--- a/rbutil/rbutilqt/rbutilqt.pro
+++ b/rbutil/rbutilqt/rbutilqt.pro
@@ -15,21 +15,12 @@ RCC_DIR = build/rcc
15# add a custom rule for pre-building librbspeex 15# add a custom rule for pre-building librbspeex
16!mac { 16!mac {
17rbspeex.commands = @$(MAKE) -C ../../tools/rbspeex librbspeex.a 17rbspeex.commands = @$(MAKE) -C ../../tools/rbspeex librbspeex.a
18QMAKE_EXTRA_TARGETS += rbspeex
19PRE_TARGETDEPS += rbspeex
20} 18}
21mac { 19mac {
22rbspeex0.commands = @$(MAKE) -C ../../tools/rbspeex clean 20rbspeex.commands = @$(MAKE) -C ../../tools/rbspeex librbspeex-universal
23rbspeex1.commands = @$(MAKE) -C ../../tools/rbspeex ARCH=ppc librbspeexppc.a
24rbspeex2.commands = @$(MAKE) -C ../../tools/rbspeex clean
25rbspeex3.commands = @$(MAKE) -C ../../tools/rbspeex ARCH=i386 librbspeexi386.a
26rbspeex4.commands = @$(MAKE) -C ../../tools/rbspeex universal
27rbspeex2.depends = rbspeex1
28rbspeex3.depends = rbspeex2
29rbspeex4.depends = rbspeex3
30QMAKE_EXTRA_TARGETS += rbspeex1 rbspeex2 rbspeex3 rbspeex4
31PRE_TARGETDEPS += rbspeex1 rbspeex2 rbspeex4 rbspeex4
32} 21}
22QMAKE_EXTRA_TARGETS += rbspeex
23PRE_TARGETDEPS += rbspeex
33 24
34# rule for creating ctags file 25# rule for creating ctags file
35tags.commands = ctags -R --c++-kinds=+p --fields=+iaS --extra=+q $(SOURCES) 26tags.commands = ctags -R --c++-kinds=+p --fields=+iaS --extra=+q $(SOURCES)
diff --git a/tools/rbspeex/Makefile b/tools/rbspeex/Makefile
index 2511393833..383acc986a 100644
--- a/tools/rbspeex/Makefile
+++ b/tools/rbspeex/Makefile
@@ -28,28 +28,29 @@ CC = gcc
28endif 28endif
29 29
30ifdef ARCH 30ifdef ARCH
31ARCH_CMD = -arch $(ARCH) 31CFLAGS += -arch $(ARCH)
32endif 32endif
33 33
34 34
35# This sets up 'SRC' based on the files mentioned in SOURCES 35# This sets up 'SRC' based on the files mentioned in SOURCES
36SRC := $(shell cat $(SPEEXSRC)/SOURCES | $(CC) $(CFLAGS) -E -P - | grep -v "^\#") 36SRC := $(shell cat $(SPEEXSRC)/SOURCES | $(CC) $(CFLAGS) -E -P - | grep -v "^\#" | grep -v "^$$")
37 37
38OUT = build$(ARCH)
38SOURCES = $(SRC:%.c=$(SPEEXSRC)/%.c) rbspeex.c rbspeexenc.c rbspeexdec.c 39SOURCES = $(SRC:%.c=$(SPEEXSRC)/%.c) rbspeex.c rbspeexenc.c rbspeexdec.c
39OBJS := $(SRC:%.c=%.o) 40OBJS = $(addprefix $(OUT)/,$(SRC:%.c=%.o))
40DEPFILE = dep-speex 41DEPFILE = $(OUT)/dep-speex
41DIRS = 42DIRS =
42 43
43.PHONY : all 44.PHONY : all
44 45
45all: ../rbspeexenc ../rbspeexdec 46all: ../rbspeexenc ../rbspeexdec
46 47
47$(DEPFILE): $(SOURCES) 48$(DEPFILE): $(SOURCES) $(OUT)
48 $(SILENT)rm -f $(DEPFILE) 49 $(SILENT)rm -f $(DEPFILE)
49 $(SILENT)(for each in $(SOURCES) x; do \ 50 $(SILENT)(for each in $(SOURCES) x; do \
50 if test "x" != "$$each"; then \ 51 if test "x" != "$$each"; then \
51 obj=`echo $$each | sed -e 's/\.[cS]/.o/' | sed -e 's/^.*\///' `; \ 52 obj=`echo $$each | sed -e 's/\.[cS]/.o/' | sed -e 's/^.*\///' `; \
52 $(CC) -MG -MM -MT "$$obj" $(CFLAGS) $$each 2>/dev/null; \ 53 $(CC) -MG -MM -MT "$(OUT)/$$obj" $(CFLAGS) $$each 2>/dev/null; \
53 fi; \ 54 fi; \
54 if test -n "$$del"; then \ 55 if test -n "$$del"; then \
55 rm $$del; \ 56 rm $$del; \
@@ -58,27 +59,46 @@ $(DEPFILE): $(SOURCES)
58 done > $(DEPFILE); \ 59 done > $(DEPFILE); \
59 echo "oo" > /dev/null ) 60 echo "oo" > /dev/null )
60 61
61librbspeex$(ARCH).a: $(OBJS) $(DEPFILE) rbspeex.o 62-include $(DEPFILE)
62 @echo AR librbspeex.a 63
64$(OUT)/librbspeex.a: $(OBJS) $(DEPFILE) $(OUT)/rbspeex.o
65 @echo AR $(OUT)/librbspeex$(ARCH).a
63 $(SILENT)$(AR) ruv $@ $+ > /dev/null 2>&1 66 $(SILENT)$(AR) ruv $@ $+ > /dev/null 2>&1
64 67
65../rbspeexenc: $(OBJS) rbspeexenc.o librbspeex.a 68librbspeex$(ARCH).a: $(OUT)/librbspeex.a
69 $(SILENT)cp $(OUT)/librbspeex.a librbspeex$(ARCH).a
70
71../rbspeexenc: $(OBJS) $(OUT)/rbspeexenc.o librbspeex$(ARCH).a
66 @echo Linking ../rbspeexenc 72 @echo Linking ../rbspeexenc
67 $(SILENT)$(CC) $(CFLAGS) -o ../rbspeexenc rbspeexenc.o librbspeex.a -lm 73 $(SILENT)$(CC) $(CFLAGS) -o ../rbspeexenc $(OUT)/rbspeexenc.o librbspeex$(ARCH).a -lm
68 74
69../rbspeexdec: $(OBJS) librbspeex.a rbspeexdec.o 75../rbspeexdec: $(OBJS) librbspeex$(ARCH).a $(OUT)/rbspeexdec.o
70 @echo Linking ../rbspeexdec 76 @echo Linking ../rbspeexdec
71 $(SILENT)$(CC) $(CFLAGS) -o ../rbspeexdec rbspeexdec.o librbspeex.a -lm 77 $(SILENT)$(CC) $(CFLAGS) -o ../rbspeexdec $(OUT)/rbspeexdec.o librbspeex$(ARCH).a -lm
72 78
73%.o: 79%.o:
74 @echo CC $< 80 @echo CC $<
75 $(SILENT)$(CC) $(CFLAGS) -c $< -o $@ $(ARCH_CMD) 81 $(SILENT)$(CC) $(CFLAGS) -c $< -o $@
82
83# some trickery to build ppc and i386 from a single call
84ifeq ($(ARCH),)
85librbspeexi386.a:
86 make ARCH=i386 librbspeexi386.a
76 87
77universal: librbspeexppc.a librbspeexi386.a 88librbspeexppc.a:
78 @echo lipo libusb.a 89 make ARCH=ppc librbspeexppc.a
90endif
91
92librbspeex-universal: librbspeexi386.a librbspeexppc.a
93 @echo lipo librbspeex.a
94 $(SILENT) rm -f librbspeex.a
79 lipo -create librbspeexppc.a librbspeexi386.a -output librbspeex.a 95 lipo -create librbspeexppc.a librbspeexi386.a -output librbspeex.a
80 96
81clean: 97clean:
82 rm -f $(OBJS) rbspeex.o libspeex.a librbspeex.a rbspeexenc.o ../rbspeexenc dep-speex 98 rm -f $(OBJS) librbspeex* ../rbspeexenc ../rbspeexdec dep-speex
99 rm -rf build*
100
101build$(ARCH):
102 @echo MKDIR build$(ARCH)
103 $(SILENT)mkdir build$(ARCH)
83 104
84-include $(DEPFILE)