summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorDominik Riebeling <Dominik.Riebeling@gmail.com>2009-10-08 21:26:39 +0000
committerDominik Riebeling <Dominik.Riebeling@gmail.com>2009-10-08 21:26:39 +0000
commit21a712cba1e49eea5a141b441b62a41965bd380e (patch)
tree6707ce35590811dc452847178a0fb50be335e864 /tools
parentdf4f9710ba39b4c8e55ac011b0e88074dfe111ac (diff)
downloadrockbox-21a712cba1e49eea5a141b441b62a41965bd380e.tar.gz
rockbox-21a712cba1e49eea5a141b441b62a41965bd380e.zip
If available, use the systems libspeex when linking rbspeex(enc|dec) and rbutil dynamically. This is similar to FS#9233 but utilizes pkg-config.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23016 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'tools')
-rw-r--r--tools/rbspeex/Makefile14
1 files changed, 12 insertions, 2 deletions
diff --git a/tools/rbspeex/Makefile b/tools/rbspeex/Makefile
index 41bf775d38..8c46677ce8 100644
--- a/tools/rbspeex/Makefile
+++ b/tools/rbspeex/Makefile
@@ -31,9 +31,19 @@ ifdef RBARCH
CFLAGS += -arch $(RBARCH)
endif
+# don't try to use the systems libspeex when building a static binary.
+ifndef STATIC
+SYS_SPEEX = $(shell pkg-config --libs speex)
+endif
+# fall back to our own librbspeex if no suitable found.
+ifeq ($(SYS_SPEEX),)
# This sets up 'SRC' based on the files mentioned in SOURCES
SRC := $(shell cat $(SPEEXSRC)/SOURCES | $(CC) $(CFLAGS) -E -P - | grep -v "^\#" | grep -v "^$$")
+LIBS = $(TARGET_DIR)librbspeex$(RBARCH).a
+else
+LIBS = $(SYS_SPEEX)
+endif
OUT = $(TARGET_DIR)build$(RBARCH)
SOURCES = $(SRC:%.c=$(SPEEXSRC)/%.c) rbspeex.c rbspeexenc.c rbspeexdec.c
@@ -73,11 +83,11 @@ librbspeex$(RBARCH).a: $(OUT)/librbspeex.a
../rbspeexenc: $(OBJS) $(OUT)/rbspeexenc.o librbspeex$(RBARCH).a
@echo Linking ../rbspeexenc
- $(SILENT)$(CC) $(CFLAGS) -o ../rbspeexenc $(OUT)/rbspeexenc.o librbspeex$(RBARCH).a -lm
+ $(SILENT)$(CC) $(CFLAGS) -o ../rbspeexenc $(OUT)/rbspeexenc.o $(LIBS) -lm $(TARGET_DIR)librbspeex$(RBARCH).a
../rbspeexdec: $(OBJS) librbspeex$(RBARCH).a $(OUT)/rbspeexdec.o
@echo Linking ../rbspeexdec
- $(SILENT)$(CC) $(CFLAGS) -o ../rbspeexdec $(OUT)/rbspeexdec.o librbspeex$(RBARCH).a -lm
+ $(SILENT)$(CC) $(CFLAGS) -o ../rbspeexdec $(OUT)/rbspeexdec.o $(LIBS) -lm $(TARGET_DIR)librbspeex$(RBARCH).a
%.o:
@echo CC $<