diff options
| -rw-r--r-- | tools/rbspeex/Makefile | 32 |
1 files changed, 11 insertions, 21 deletions
diff --git a/tools/rbspeex/Makefile b/tools/rbspeex/Makefile index 24a0ced..713111d 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 ) - -include $(DEPFILE) +$(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) + +%.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): |