From 562baccae895e641b7f1960d06e0dbdbc286218b Mon Sep 17 00:00:00 2001 From: Dan Willemsen Date: Thu, 25 May 2017 22:10:08 -0700 Subject: [PATCH 1/2] Remove the rest of showcommands, dist goal showcommands is all handled in soong_ui, make/kati/ninja never see the argument. Remove the dist goal, since we'll never pass it to ninja, only to Kati as a modifier. Remove DUMP_%, since that's not used anywhere (it appears to be in our code search via the NDK build system) Test: m -j showcommands dist Change-Id: I0d1498128caece685e98c2c2b5b0c3f545da0e11 --- core/config.mk | 6 +----- core/distdir.mk | 8 -------- core/main.mk | 8 ++------ core/ninja_config.mk | 4 +--- 4 files changed, 4 insertions(+), 22 deletions(-) diff --git a/core/config.mk b/core/config.mk index 42f61489cb..cdc90e513b 100644 --- a/core/config.mk +++ b/core/config.mk @@ -129,11 +129,7 @@ BUILD_HOST_DALVIK_STATIC_JAVA_LIBRARY := $(BUILD_SYSTEM)/host_dalvik_static_java # Parse out any modifier targets. # ############################################################### -# The 'showcommands' goal says to show the full command -# lines being executed, instead of a short message about -# the kind of operation being done. -SHOW_COMMANDS:= $(filter showcommands,$(MAKECMDGOALS)) -hide := $(if $(SHOW_COMMANDS),,@) +hide := @ ################################################################ # Tools needed in product configuration makefiles. diff --git a/core/distdir.mk b/core/distdir.mk index 51ec46efef..89c5966c03 100644 --- a/core/distdir.mk +++ b/core/distdir.mk @@ -17,16 +17,8 @@ # When specifying "dist", the user has asked that we copy the important # files from this build into DIST_DIR. -.PHONY: dist -dist: ; - 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 diff --git a/core/main.mk b/core/main.mk index 1ca2b0ac72..62a9c5f2da 100644 --- a/core/main.mk +++ b/core/main.mk @@ -91,7 +91,7 @@ include $(BUILD_SYSTEM)/cleanbuild.mk # These are the modifier targets that don't do anything themselves, but # change the behavior of the build. # (must be defined before including definitions.make) -INTERNAL_MODIFIER_TARGETS := showcommands all +INTERNAL_MODIFIER_TARGETS := all # EMMA_INSTRUMENT_STATIC merges the static emma library to each emma-enabled module. ifeq (true,$(EMMA_INSTRUMENT_STATIC)) @@ -326,7 +326,7 @@ endef endif -# If they only used the modifier goals (showcommands, etc), we'll actually +# If they only used the modifier goals (all, etc), we'll actually # build the default target. ifeq ($(filter-out $(INTERNAL_MODIFIER_TARGETS),$(MAKECMDGOALS)),) .PHONY: $(INTERNAL_MODIFIER_TARGETS) @@ -1127,10 +1127,6 @@ modules: @echo "$(call module-names-for-tag-list,$(ALL_MODULE_TAGS))" | \ tr -s ' ' '\n' | sort -u | $(COLUMN) -.PHONY: showcommands -showcommands: - @echo >/dev/null - .PHONY: nothing nothing: @echo Successfully read the makefiles. diff --git a/core/ninja_config.mk b/core/ninja_config.mk index f456b8b161..13b50a27bb 100644 --- a/core/ninja_config.mk +++ b/core/ninja_config.mk @@ -7,8 +7,7 @@ endif KATI_OUTPUT_PATTERNS := $(OUT_DIR)/build%.ninja $(OUT_DIR)/ninja%.sh # Modifier goals we don't need to pass to Ninja. -NINJA_EXCLUDE_GOALS := showcommands all dist -.PHONY : $(NINJA_EXCLUDE_GOALS) +NINJA_EXCLUDE_GOALS := all dist # A list of goals which affect parsing of makefiles and we need to pass to Kati. PARSE_TIME_MAKE_GOALS := \ @@ -16,7 +15,6 @@ PARSE_TIME_MAKE_GOALS := \ $(dont_bother_goals) \ all \ APP-% \ - DUMP_% \ ECLIPSE-% \ PRODUCT-% \ AUX-% \ From 9bfcbc8a716303ceb39c59afff13e509af6e18bb Mon Sep 17 00:00:00 2001 From: Dan Willemsen Date: Thu, 25 May 2017 21:25:24 -0700 Subject: [PATCH 2/2] Move APP-% and PRODUCT-% implementation out of Kati This way we'll share ninja files with the equivalent normal configs. We were already parsing them in the make config step in order to fix TARGET_PRODUCT / TARGET_BUILD_VARIANT / TARGET_BUILD_APPS, now they replace themselves in MAKECMDGOALS with the appropriate goals. If we're not going to pass any goals to ninja, pass the default goal. Test: ALLOW_MISSING_DEPENDENCIES=true m -j APP-Calculator Test: m -j PRODUCT-aosp_fugu-eng Test: m -j PRODUCT-aosp_fugu-eng sdk Test: m -j PRODUCT-aosp_fugu-sdk Test: lunch aosp_arm64-userdebug; m -j Test: lunch aosp_arm64-userdebug; m -j dist Test: lunch aosp_arm64-userdebug; m -j adb Change-Id: I73787aff9f74aed328e3fa75c571ae15a28851b0 --- core/ninja_config.mk | 9 +++++---- core/product_config.mk | 35 ++++++++++++----------------------- 2 files changed, 17 insertions(+), 27 deletions(-) diff --git a/core/ninja_config.mk b/core/ninja_config.mk index 13b50a27bb..ca2dceecec 100644 --- a/core/ninja_config.mk +++ b/core/ninja_config.mk @@ -7,16 +7,14 @@ endif KATI_OUTPUT_PATTERNS := $(OUT_DIR)/build%.ninja $(OUT_DIR)/ninja%.sh # Modifier goals we don't need to pass to Ninja. -NINJA_EXCLUDE_GOALS := all dist +NINJA_EXCLUDE_GOALS := all dist APP-% PRODUCT-% # A list of goals which affect parsing of makefiles and we need to pass to Kati. PARSE_TIME_MAKE_GOALS := \ $(PARSE_TIME_MAKE_GOALS) \ $(dont_bother_goals) \ all \ - APP-% \ ECLIPSE-% \ - PRODUCT-% \ AUX-% \ boottarball-nodeps \ brillo_tests \ @@ -65,5 +63,8 @@ ANDROID_GOALS := $(filter-out $(KATI_OUTPUT_PATTERNS) $(CKATI) $(MAKEPARALLEL),\ $(sort $(ORIGINAL_MAKECMDGOALS) $(MAKECMDGOALS))) # Goals we need to pass to Ninja. NINJA_GOALS := $(filter-out $(NINJA_EXCLUDE_GOALS), $(ANDROID_GOALS)) +ifndef NINJA_GOALS + NINJA_GOALS := droid +endif # Goals we need to pass to Kati. -KATI_GOALS := $(filter $(PARSE_TIME_MAKE_GOALS), $(ANDROID_GOALS)) +KATI_GOALS := $(filter $(PARSE_TIME_MAKE_GOALS), $(ANDROID_GOALS)) diff --git a/core/product_config.mk b/core/product_config.mk index e069ff179b..3623aa6b2b 100644 --- a/core/product_config.mk +++ b/core/product_config.mk @@ -88,6 +88,7 @@ INTERNAL_VALID_VARIANTS := user userdebug eng # Provide "PRODUCT--" targets, which lets you build # a particular configuration without needing to set up the environment. # +ifndef KATI product_goals := $(strip $(filter PRODUCT-%,$(MAKECMDGOALS))) ifdef product_goals # Scrape the product and build names out of the goal, @@ -113,54 +114,42 @@ ifdef product_goals $(error "tests" has been deprecated as a build variant. Use it as a build goal instead.) endif - # The build server wants to do make PRODUCT-dream-installclean - # which really means TARGET_PRODUCT=dream make installclean. + # The build server wants to do make PRODUCT-dream-sdk + # which really means TARGET_PRODUCT=dream make sdk. ifneq ($(filter-out $(INTERNAL_VALID_VARIANTS),$(TARGET_BUILD_VARIANT)),) - MAKECMDGOALS := $(MAKECMDGOALS) $(TARGET_BUILD_VARIANT) + override MAKECMDGOALS := $(MAKECMDGOALS) $(TARGET_BUILD_VARIANT) TARGET_BUILD_VARIANT := userdebug default_goal_substitution := else - default_goal_substitution := $(DEFAULT_GOAL) + default_goal_substitution := droid endif # Replace the PRODUCT-* goal with the build goal that it refers to. # Note that this will ensure that it appears in the same relative # position, in case it matters. - # - # Note that modifying this will not affect the goals that make will - # attempt to build, but it's important because we inspect this value - # in certain situations (like for "make sdk"). - # - MAKECMDGOALS := $(patsubst $(goal_name),$(default_goal_substitution),$(MAKECMDGOALS)) - - # Define a rule for the PRODUCT-* goal, and make it depend on the - # patched-up command-line goals as well as any other goals that we - # want to force. - # -.PHONY: $(goal_name) -$(goal_name): $(MAKECMDGOALS) + override MAKECMDGOALS := $(patsubst $(goal_name),$(default_goal_substitution),$(MAKECMDGOALS)) endif +endif # !KATI # else: Use the value set in the environment or buildspec.mk. # --------------------------------------------------------------- # Provide "APP-" targets, which lets you build # an unbundled app. # +ifndef KATI unbundled_goals := $(strip $(filter APP-%,$(MAKECMDGOALS))) ifdef unbundled_goals ifneq ($(words $(unbundled_goals)),1) $(error Only one APP-* goal may be specified; saw "$(unbundled_goals)") endif TARGET_BUILD_APPS := $(strip $(subst -, ,$(patsubst APP-%,%,$(unbundled_goals)))) - ifneq ($(filter $(DEFAULT_GOAL),$(MAKECMDGOALS)),) - MAKECMDGOALS := $(patsubst $(unbundled_goals),,$(MAKECMDGOALS)) + ifneq ($(filter droid,$(MAKECMDGOALS)),) + override MAKECMDGOALS := $(patsubst $(unbundled_goals),,$(MAKECMDGOALS)) else - MAKECMDGOALS := $(patsubst $(unbundled_goals),$(DEFAULT_GOAL),$(MAKECMDGOALS)) + override MAKECMDGOALS := $(patsubst $(unbundled_goals),droid,$(MAKECMDGOALS)) endif - -.PHONY: $(unbundled_goals) -$(unbundled_goals): $(MAKECMDGOALS) endif # unbundled_goals +endif # Default to building dalvikvm on hosts that support it... ifeq ($(HOST_OS),linux)