diff options
author | Dominik Riebeling <Dominik.Riebeling@gmail.com> | 2013-05-11 20:25:15 +0200 |
---|---|---|
committer | Dominik Riebeling <Dominik.Riebeling@gmail.com> | 2013-05-11 20:34:12 +0200 |
commit | 4877f618d664f53694132b91fc7712844566bfbb (patch) | |
tree | b50b3417631f47c8bd8fcf58000fb9df85e2cf5a | |
parent | 071ccc78a9f3a2360d43ad5ca7a931481a206e8a (diff) | |
download | rockbox-4877f618d664f53694132b91fc7712844566bfbb.tar.gz rockbox-4877f618d664f53694132b91fc7712844566bfbb.zip |
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
-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 24a0cedd8c..713111dd2e 100644 --- a/tools/rbspeex/Makefile +++ b/tools/rbspeex/Makefile | |||
@@ -70,31 +70,21 @@ TARGET_DIR ?= $(shell pwd)/ | |||
70 | BUILD_DIR ?= $(TARGET_DIR)build$(COMPILETARGET) | 70 | BUILD_DIR ?= $(TARGET_DIR)build$(COMPILETARGET) |
71 | SOURCES = $(SRC:%.c=$(SPEEXSRC)/%.c) rbspeex.c rbspeexenc.c rbspeexdec.c | 71 | SOURCES = $(SRC:%.c=$(SPEEXSRC)/%.c) rbspeex.c rbspeexenc.c rbspeexdec.c |
72 | OBJS = $(addprefix $(BUILD_DIR)/,$(SRC:%.c=%.o)) | 72 | OBJS = $(addprefix $(BUILD_DIR)/,$(SRC:%.c=%.o)) |
73 | DEPFILE = $(BUILD_DIR)/dep-speex | ||
74 | DIRS = | 73 | DIRS = |
75 | 74 | ||
76 | .PHONY : all | 75 | .PHONY : all |
77 | 76 | ||
78 | all: ../rbspeexenc ../rbspeexdec | 77 | all: ../rbspeexenc ../rbspeexdec |
79 | 78 | ||
80 | $(DEPFILE): $(SOURCES) | 79 | $(foreach src,$(SOURCES),$(eval $(BUILD_DIR)/$(subst .c,.o,$(notdir $(src))): $(src))) |
81 | @echo MKDIR $(BUILD_DIR) | 80 | $(foreach src,$(SOURCES),$(eval $(BUILD_DIR)/$(subst .c,.d,$(notdir $(src))): $(src))) |
82 | $(SILENT)mkdir -p $(BUILD_DIR) | 81 | DEPS = $(addprefix $(BUILD_DIR)/,$(subst .c,.d,$(notdir $(SOURCES)))) |
83 | @echo Creating dependencies | 82 | -include $(DEPS) |
84 | $(SILENT)rm -f $(DEPFILE) | 83 | |
85 | $(SILENT)(for each in $(SOURCES) x; do \ | 84 | %.d: |
86 | if test "x" != "$$each"; then \ | 85 | @echo DEP $(notdir $@) |
87 | obj=`echo $$each | sed -e 's/\.[cS]/.o/' | sed -e 's/^.*\///' `; \ | 86 | $(SILENT)$(call mkdir,$(BUILD_DIR)) |
88 | $(CC) -MG -MM -MT "$(BUILD_DIR)/$$obj" $(CFLAGS) $$each 2>/dev/null; \ | 87 | $(SILENT)$(CC) -MG -MM -MT $(subst .d,.o,$@) $(CFLAGS) -o $(BUILD_DIR)/$(notdir $@) $< |
89 | fi; \ | ||
90 | if test -n "$$del"; then \ | ||
91 | rm $$del; \ | ||
92 | del=""; \ | ||
93 | fi \ | ||
94 | done > $(DEPFILE); \ | ||
95 | echo "oo" > /dev/null ) | ||
96 | |||
97 | include $(DEPFILE) | ||
98 | 88 | ||
99 | dll: $(TARGET_DIR)rbspeex.dll | 89 | dll: $(TARGET_DIR)rbspeex.dll |
100 | 90 | ||
@@ -105,7 +95,6 @@ $(TARGET_DIR)rbspeex.dll: $(OBJS) $(BUILD_DIR)/rbspeex.o | |||
105 | 95 | ||
106 | $(TARGET_DIR)librbspeex.a: $(OBJS) $(BUILD_DIR)/rbspeex.o | 96 | $(TARGET_DIR)librbspeex.a: $(OBJS) $(BUILD_DIR)/rbspeex.o |
107 | @echo AR $(notdir $@) | 97 | @echo AR $(notdir $@) |
108 | $(SILENT)rm -f $@ | ||
109 | $(SILENT)$(CROSS)$(AR) rcs $@ $^ > /dev/null 2>&1 | 98 | $(SILENT)$(CROSS)$(AR) rcs $@ $^ > /dev/null 2>&1 |
110 | 99 | ||
111 | librbspeex.a: $(TARGET_DIR)librbspeex.a | 100 | librbspeex.a: $(TARGET_DIR)librbspeex.a |
@@ -125,7 +114,8 @@ librbspeex.a: $(TARGET_DIR)librbspeex.a | |||
125 | $(SILENT)$(CROSS)$(CC) $(CFLAGS) $(ARCHFLAGS) -c $< -o $@ | 114 | $(SILENT)$(CROSS)$(CC) $(CFLAGS) $(ARCHFLAGS) -c $< -o $@ |
126 | 115 | ||
127 | clean: | 116 | clean: |
128 | rm -f $(OBJS) $(TARGET_DIR)librbspeex* ../rbspeexenc ../rbspeexdec $(TARGET_DIR)dep-speex | 117 | rm -f $(OBJS) $(TARGET_DIR)librbspeex* ../rbspeexenc ../rbspeexdec |
118 | rm -f $(DEPS) | ||
129 | rm -rf build* | 119 | rm -rf build* |
130 | 120 | ||
131 | $(BUILD_DIR): | 121 | $(BUILD_DIR): |