From b2e80edd1671833dc80eb0c5334cb6a2c58808e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nils=20Wallm=C3=A9nius?= Date: Mon, 1 Jul 2013 21:59:44 +0200 Subject: [PATCH] Change CODECFLAGS to a "simply-expanded" var to give the individual codec makefiles larger freedom in what they can do to it. Use this in libopus to prepend the libopus searchpaths to CODECFLAGS so that its internal config.h will be picked up before our global one. This avoids having to do a s/config.h/opus_config.h/ when syncing which will be handy soon. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I018d729aa0c8300fa3149f22a5a8c5668b339dfa Reviewed-on: http://gerrit.rockbox.org/496 Reviewed-by: Nils Wallménius --- apps/rbcodecconfig.h | 3 ++- lib/rbcodec/codecs/codecs.make | 26 ++++++++++++------------ lib/rbcodec/codecs/libopus/libopus.make | 6 ++++-- lib/rbcodec/codecs/libopus/opus_config.h | 2 +- 4 files changed, 20 insertions(+), 17 deletions(-) diff --git a/apps/rbcodecconfig.h b/apps/rbcodecconfig.h index cc51595cc4..c92415979f 100644 --- a/apps/rbcodecconfig.h +++ b/apps/rbcodecconfig.h @@ -1,7 +1,8 @@ #ifndef RBCODECCONFIG_H_INCLUDED #define RBCODECCONFIG_H_INCLUDED -#include "config.h" +/* Explicit path to avoid issues with name clashes (libopus) */ +#include "../firmware/export/config.h" #ifndef __ASSEMBLER__ diff --git a/lib/rbcodec/codecs/codecs.make b/lib/rbcodec/codecs/codecs.make index 08554d9628..13ad28fa65 100644 --- a/lib/rbcodec/codecs/codecs.make +++ b/lib/rbcodec/codecs/codecs.make @@ -21,6 +21,19 @@ OTHER_INC += -I$(RBCODECLIB_DIR)/codecs/lib # extra libraries CODEC_LIBS := $(CODECLIB) $(FIXEDPOINTLIB) +# compile flags for codecs +CODECFLAGS := $(CFLAGS) $(RBCODEC_CFLAGS) -fstrict-aliasing \ + -I$(RBCODECLIB_DIR)/codecs -I$(RBCODECLIB_DIR)/codecs/lib -DCODEC + +ifdef APP_TYPE + CODECLDFLAGS = $(SHARED_LDFLAG) -Wl,--gc-sections -Wl,-Map,$(CODECDIR)/$*.map + CODECFLAGS += $(SHARED_CFLAGS) # <-- from Makefile +else + CODECLDFLAGS = -T$(CODECLINK_LDS) -Wl,--gc-sections -Wl,-Map,$(CODECDIR)/$*.map + CODECFLAGS += -UDEBUG -DNDEBUG +endif +CODECLDFLAGS += $(GLOBAL_LDOPTS) + # the codec libraries include $(RBCODECLIB_DIR)/codecs/demac/libdemac.make include $(RBCODECLIB_DIR)/codecs/liba52/liba52.make @@ -53,10 +66,6 @@ include $(RBCODECLIB_DIR)/codecs/libgme/libkss.make include $(RBCODECLIB_DIR)/codecs/libgme/libemu2413.make include $(RBCODECLIB_DIR)/codecs/libopus/libopus.make -# compile flags for codecs -CODECFLAGS = $(CFLAGS) $(RBCODEC_CFLAGS) -fstrict-aliasing \ - -I$(RBCODECLIB_DIR)/codecs -I$(RBCODECLIB_DIR)/codecs/lib -DCODEC - # set CODECFLAGS per codec lib, since gcc takes the last -Ox and the last # in a -ffoo -fno-foo pair, there is no need to filter them out $(A52LIB) : CODECFLAGS += -O1 @@ -188,15 +197,6 @@ $(CODECDIR)/%.o: $(RBCODECLIB_DIR)/codecs/%.S $(call PRINTS,CC $(subst $(ROOTDIR)/,,$<))$(CC) \ -I$(dir $<) $(CODECFLAGS) $(ASMFLAGS) -c $< -o $@ -ifdef APP_TYPE - CODECLDFLAGS = $(SHARED_LDFLAG) -Wl,--gc-sections -Wl,-Map,$(CODECDIR)/$*.map - CODECFLAGS += $(SHARED_CFLAGS) # <-- from Makefile -else - CODECLDFLAGS = -T$(CODECLINK_LDS) -Wl,--gc-sections -Wl,-Map,$(CODECDIR)/$*.map - CODECFLAGS += -UDEBUG -DNDEBUG -endif -CODECLDFLAGS += $(GLOBAL_LDOPTS) - $(CODECDIR)/%-pre.map: $(CODEC_CRT0) $(CODECLINK_LDS) $(CODECDIR)/%.o $(CODECS_LIBS) $(call PRINTS,LD $(@F))$(CC) $(CODECFLAGS) -o $(CODECDIR)/$*-pre.elf \ $(filter %.o, $^) \ diff --git a/lib/rbcodec/codecs/libopus/libopus.make b/lib/rbcodec/codecs/libopus/libopus.make index ab93a5a5cc..5cfb34aac3 100644 --- a/lib/rbcodec/codecs/libopus/libopus.make +++ b/lib/rbcodec/codecs/libopus/libopus.make @@ -13,10 +13,12 @@ OPUSLIB_SRC := $(call preprocess, $(RBCODECLIB_DIR)/codecs/libopus/SOURCES) OPUSLIB_OBJ := $(call c2obj, $(OPUSLIB_SRC)) # codec specific compilation flags -$(OPUSLIB) : CODECFLAGS += -DHAVE_CONFIG_H \ +# prepend paths to avoid name clash issues +$(OPUSLIB) : CODECFLAGS := -DHAVE_CONFIG_H \ -I$(RBCODECLIB_DIR)/codecs/libopus \ -I$(RBCODECLIB_DIR)/codecs/libopus/celt \ - -I$(RBCODECLIB_DIR)/codecs/libopus/silk + -I$(RBCODECLIB_DIR)/codecs/libopus/silk \ + $(CODECFLAGS) $(OPUSLIB): $(OPUSLIB_OBJ) $(SILENT)$(shell rm -f $@) diff --git a/lib/rbcodec/codecs/libopus/opus_config.h b/lib/rbcodec/codecs/libopus/opus_config.h index 922ec607e5..39abc8d8d4 100644 --- a/lib/rbcodec/codecs/libopus/opus_config.h +++ b/lib/rbcodec/codecs/libopus/opus_config.h @@ -1,7 +1,7 @@ #ifndef CONFIG_H #define CONFIG_H -#include "config.h" +#include "rbcodecconfig.h" #include "codeclib.h" #include "ogg/ogg.h"