|
@@ -174,8 +174,9 @@ endif
|
174
|
174
|
# make goals.
|
175
|
175
|
#
|
176
|
176
|
BIN_GOALS := $(filter bin/% bin-%,$(MAKECMDGOALS))
|
177
|
|
-BIN_GOAL_BINS := $(foreach BG,$(BIN_GOALS),$(firstword $(subst /, ,$(BG))))
|
178
|
|
-NUM_BINS := $(words $(sort $(BIN_GOAL_BINS)))
|
|
177
|
+BIN_GOALS_BINS := $(sort $(foreach BG,$(BIN_GOALS),\
|
|
178
|
+ $(firstword $(subst /, ,$(BG)))))
|
|
179
|
+NUM_BINS := $(words $(BIN_GOALS_BINS))
|
179
|
180
|
|
180
|
181
|
ifeq ($(NUM_BINS),0)
|
181
|
182
|
|
|
@@ -191,20 +192,29 @@ ifeq ($(NUM_BINS),1)
|
191
|
192
|
# If exactly one BIN directory was specified, set BIN to match this
|
192
|
193
|
# directory.
|
193
|
194
|
#
|
194
|
|
-BIN := $(firstword $(BIN_GOAL_BINS))
|
|
195
|
+BIN := $(firstword $(BIN_GOALS_BINS))
|
195
|
196
|
|
196
|
197
|
else # NUM_BINS == 1
|
197
|
198
|
|
198
|
199
|
# More than one BIN directory was specified. We cannot handle the
|
199
|
200
|
# latter case within a single make invocation, so set up recursive
|
200
|
|
-# targets for each BIN directory.
|
|
201
|
+# targets for each BIN directory. Use exactly one target for each BIN
|
|
202
|
+# directory since running multiple make invocations within the same
|
|
203
|
+# BIN directory is likely to cause problems.
|
201
|
204
|
#
|
202
|
205
|
# Leave $(BIN) undefined. This has implications for any target that
|
203
|
206
|
# depends on $(BIN); such targets should be made conditional upon the
|
204
|
207
|
# existence of $(BIN).
|
205
|
208
|
#
|
206
|
|
-$(BIN_GOALS) : % : BIN_RECURSE
|
207
|
|
- $(Q)$(MAKE) --no-print-directory BIN=$(firstword $(subst /, ,$@)) $@
|
|
209
|
+BIN_GOALS_FIRST := $(foreach BGB,$(BIN_GOALS_BINS),\
|
|
210
|
+ $(firstword $(filter $(BGB)/%,$(BIN_GOALS))))
|
|
211
|
+BIN_GOALS_OTHER := $(filter-out $(BIN_GOALS_FIRST),$(BIN_GOALS))
|
|
212
|
+
|
|
213
|
+$(BIN_GOALS_FIRST) : % : BIN_RECURSE
|
|
214
|
+ $(Q)$(MAKE) --no-print-directory BIN=$(firstword $(subst /, ,$@)) \
|
|
215
|
+ $(filter $(firstword $(subst /, ,$@))/%, $(BIN_GOALS))
|
|
216
|
+$(BIN_GOALS_OTHER) : % : BIN_RECURSE
|
|
217
|
+ $(Q)$(TRUE)
|
208
|
218
|
.PHONY : BIN_RECURSE
|
209
|
219
|
|
210
|
220
|
endif # NUM_BINS == 1
|