diff options
author | Dominik Riebeling <Dominik.Riebeling@gmail.com> | 2008-07-20 15:47:47 +0000 |
---|---|---|
committer | Dominik Riebeling <Dominik.Riebeling@gmail.com> | 2008-07-20 15:47:47 +0000 |
commit | fd61460c4504da289635c7ece2ce4973311921cf (patch) | |
tree | 605e2b1d878db3a0b0d664fd6b0e4124014c55a0 /tools/rbspeex | |
parent | 903a048ddcf5b95dc85d1c440daf0f397b6d60b0 (diff) | |
download | rockbox-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
Diffstat (limited to 'tools/rbspeex')
-rw-r--r-- | tools/rbspeex/Makefile | 54 |
1 files changed, 37 insertions, 17 deletions
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 | |||
28 | endif | 28 | endif |
29 | 29 | ||
30 | ifdef ARCH | 30 | ifdef ARCH |
31 | ARCH_CMD = -arch $(ARCH) | 31 | CFLAGS += -arch $(ARCH) |
32 | endif | 32 | endif |
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 |
36 | SRC := $(shell cat $(SPEEXSRC)/SOURCES | $(CC) $(CFLAGS) -E -P - | grep -v "^\#") | 36 | SRC := $(shell cat $(SPEEXSRC)/SOURCES | $(CC) $(CFLAGS) -E -P - | grep -v "^\#" | grep -v "^$$") |
37 | 37 | ||
38 | OUT = build$(ARCH) | ||
38 | SOURCES = $(SRC:%.c=$(SPEEXSRC)/%.c) rbspeex.c rbspeexenc.c rbspeexdec.c | 39 | SOURCES = $(SRC:%.c=$(SPEEXSRC)/%.c) rbspeex.c rbspeexenc.c rbspeexdec.c |
39 | OBJS := $(SRC:%.c=%.o) | 40 | OBJS = $(addprefix $(OUT)/,$(SRC:%.c=%.o)) |
40 | DEPFILE = dep-speex | 41 | DEPFILE = $(OUT)/dep-speex |
41 | DIRS = | 42 | DIRS = |
42 | 43 | ||
43 | .PHONY : all | 44 | .PHONY : all |
44 | 45 | ||
45 | all: ../rbspeexenc ../rbspeexdec | 46 | all: ../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 | ||
61 | librbspeex$(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 | 68 | librbspeex$(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 | ||
84 | ifeq ($(ARCH),) | ||
85 | librbspeexi386.a: | ||
86 | make ARCH=i386 librbspeexi386.a | ||
76 | 87 | ||
77 | universal: librbspeexppc.a librbspeexi386.a | 88 | librbspeexppc.a: |
78 | @echo lipo libusb.a | 89 | make ARCH=ppc librbspeexppc.a |
90 | endif | ||
91 | |||
92 | librbspeex-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 | ||
81 | clean: | 97 | clean: |
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 | |||
101 | build$(ARCH): | ||
102 | @echo MKDIR build$(ARCH) | ||
103 | $(SILENT)mkdir build$(ARCH) | ||
83 | 104 | ||
84 | -include $(DEPFILE) | ||