dist is a strange dual-use target, as both a flag and a goal. make dist
<target> means build <target>, but copy any dist-for-goals files to
$DIST_DIR. make dist without a target means build droid with
dist-for-goals files. This requires special handling of MAKECMDGOALS to
detect the case where dist is the only goal, which breaks when ninja.mk
doesn't pass all the goals to kati. Instead, let ninja handle the
default goal. Pass dist to kati if it is specified in order to turn on
the dist-for-goal rules, but filter it out of the goals passed to
ninja. If there are any other goals, ninja will build them. If there
are no goals, ninja will fall back to the default goal, which is droid.
Change-Id: Iafb184d28cb312cb7c5682cd3ff4f310b2d9f7e9
dist_goal := $(strip $(filter dist,$(MAKECMDGOALS)))
MAKECMDGOALS := $(strip $(filter-out dist,$(MAKECMDGOALS)))
-ifeq (,$(strip $(filter-out $(INTERNAL_MODIFIER_TARGETS),$(MAKECMDGOALS))))
-# The commandline was something like "make dist" or "make dist showcommands".
-# Add a dependency on a real target.
-dist: $(DEFAULT_GOAL)
-endif
ifdef dist_goal
.INTERMEDIATE: ninja.intermediate
ninja.intermediate: $(KATI_OUTPUTS) $(MAKEPARALLEL)
@echo Starting build with ninja
- +$(hide) PATH=prebuilts/ninja/$(HOST_PREBUILT_TAG)/:$$PATH NINJA_STATUS="$(NINJA_STATUS)" $(NINJA_MAKEPARALLEL) $(KATI_NINJA_SH) -C $(TOP) $(NINJA_ARGS) $(ANDROID_TARGETS)
+ +$(hide) PATH=prebuilts/ninja/$(HOST_PREBUILT_TAG)/:$$PATH NINJA_STATUS="$(NINJA_STATUS)" $(NINJA_MAKEPARALLEL) $(KATI_NINJA_SH) -C $(TOP) $(NINJA_ARGS) $(filter-out dist,$(ANDROID_TARGETS))
else
generateonly droid $(ANDROID_TARGETS) $(EXTRA_TARGETS): $(KATI_OUTPUTS)
@#empty