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.

Change-Id: I018d729aa0c8300fa3149f22a5a8c5668b339dfa
Reviewed-on: http://gerrit.rockbox.org/496
Reviewed-by: Nils Wallménius <nils@rockbox.org>
This commit is contained in:
Nils Wallménius 2013-07-01 21:59:44 +02:00
parent fbc4ef7822
commit b2e80edd16
4 changed files with 20 additions and 17 deletions

View file

@ -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__

View file

@ -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, $^) \

View file

@ -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 $@)

View file

@ -1,7 +1,7 @@
#ifndef CONFIG_H
#define CONFIG_H
#include "config.h"
#include "rbcodecconfig.h"
#include "codeclib.h"
#include "ogg/ogg.h"