1
0
Fork 0
forked from len0rd/rockbox

Rework rbspeex dependency generation to use single dependency files.

Similar as done in d2b8f91 change dependency generation to use one file per
source file. This removes the need to have external tools installed on Windows.
Previously Cygwin or msys tools needed to be in the system PATH which was
problematic at times.

This means that now building on Windows (using MinGW) doesn't require
additional tools anymore.

Change-Id: I4c0675e99c3cc3a729b91beefd58320db498ae0a
This commit is contained in:
Dominik Riebeling 2013-05-11 20:25:15 +02:00
parent 071ccc78a9
commit 4877f618d6

View file

@ -70,31 +70,21 @@ TARGET_DIR ?= $(shell pwd)/
BUILD_DIR ?= $(TARGET_DIR)build$(COMPILETARGET)
SOURCES = $(SRC:%.c=$(SPEEXSRC)/%.c) rbspeex.c rbspeexenc.c rbspeexdec.c
OBJS = $(addprefix $(BUILD_DIR)/,$(SRC:%.c=%.o))
DEPFILE = $(BUILD_DIR)/dep-speex
DIRS =
.PHONY : all
all: ../rbspeexenc ../rbspeexdec
$(DEPFILE): $(SOURCES)
@echo MKDIR $(BUILD_DIR)
$(SILENT)mkdir -p $(BUILD_DIR)
@echo Creating dependencies
$(SILENT)rm -f $(DEPFILE)
$(SILENT)(for each in $(SOURCES) x; do \
if test "x" != "$$each"; then \
obj=`echo $$each | sed -e 's/\.[cS]/.o/' | sed -e 's/^.*\///' `; \
$(CC) -MG -MM -MT "$(BUILD_DIR)/$$obj" $(CFLAGS) $$each 2>/dev/null; \
fi; \
if test -n "$$del"; then \
rm $$del; \
del=""; \
fi \
done > $(DEPFILE); \
echo "oo" > /dev/null )
$(foreach src,$(SOURCES),$(eval $(BUILD_DIR)/$(subst .c,.o,$(notdir $(src))): $(src)))
$(foreach src,$(SOURCES),$(eval $(BUILD_DIR)/$(subst .c,.d,$(notdir $(src))): $(src)))
DEPS = $(addprefix $(BUILD_DIR)/,$(subst .c,.d,$(notdir $(SOURCES))))
-include $(DEPS)
include $(DEPFILE)
%.d:
@echo DEP $(notdir $@)
$(SILENT)$(call mkdir,$(BUILD_DIR))
$(SILENT)$(CC) -MG -MM -MT $(subst .d,.o,$@) $(CFLAGS) -o $(BUILD_DIR)/$(notdir $@) $<
dll: $(TARGET_DIR)rbspeex.dll
@ -105,7 +95,6 @@ $(TARGET_DIR)rbspeex.dll: $(OBJS) $(BUILD_DIR)/rbspeex.o
$(TARGET_DIR)librbspeex.a: $(OBJS) $(BUILD_DIR)/rbspeex.o
@echo AR $(notdir $@)
$(SILENT)rm -f $@
$(SILENT)$(CROSS)$(AR) rcs $@ $^ > /dev/null 2>&1
librbspeex.a: $(TARGET_DIR)librbspeex.a
@ -125,7 +114,8 @@ librbspeex.a: $(TARGET_DIR)librbspeex.a
$(SILENT)$(CROSS)$(CC) $(CFLAGS) $(ARCHFLAGS) -c $< -o $@
clean:
rm -f $(OBJS) $(TARGET_DIR)librbspeex* ../rbspeexenc ../rbspeexdec $(TARGET_DIR)dep-speex
rm -f $(OBJS) $(TARGET_DIR)librbspeex* ../rbspeexenc ../rbspeexdec
rm -f $(DEPS)
rm -rf build*
$(BUILD_DIR):