From 4877f618d664f53694132b91fc7712844566bfbb Mon Sep 17 00:00:00 2001 From: Dominik Riebeling Date: Sat, 11 May 2013 20:25:15 +0200 Subject: [PATCH] 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 --- tools/rbspeex/Makefile | 30 ++++++++++-------------------- 1 file changed, 10 insertions(+), 20 deletions(-) diff --git a/tools/rbspeex/Makefile b/tools/rbspeex/Makefile index 24a0cedd8c..713111dd2e 100644 --- a/tools/rbspeex/Makefile +++ b/tools/rbspeex/Makefile @@ -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):