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"