xiaoxiang781216 commented on code in PR #3585: URL: https://github.com/apache/nuttx-apps/pull/3585#discussion_r3526053778
########## Directory.mk: ########## @@ -26,22 +26,32 @@ include $(APPDIR)/Make.defs SUBDIRS := $(dir $(wildcard */Makefile)) CONFIGSUBDIRS := $(filter-out $(dir $(wildcard */Kconfig)),$(SUBDIRS)) -CLEANSUBDIRS := $(dir $(wildcard *$(DELIM).built)) -CLEANSUBDIRS += $(dir $(wildcard */.depend)) -CLEANSUBDIRS += $(dir $(wildcard */.kconfig)) -CLEANSUBDIRS := $(sort $(CLEANSUBDIRS)) ifeq ($(CONFIG_WINDOWS_NATIVE),y) - CONFIGSUBDIRS := $(subst /,\,$(CONFIGSUBDIRS)) - CLEANSUBDIRS := $(subst /,\,$(CLEANSUBDIRS)) + CONFIGSUBDIRS := $(subst /,\\,$(CONFIGSUBDIRS)) + SUBDIRS := $(subst /,\\,$(SUBDIRS)) endif all: nothing .PHONY: nothing clean distclean $(foreach SDIR, $(CONFIGSUBDIRS), $(eval $(call SDIR_template,$(SDIR),preconfig))) -$(foreach SDIR, $(CLEANSUBDIRS), $(eval $(call SDIR_template,$(SDIR),clean))) -$(foreach SDIR, $(CLEANSUBDIRS), $(eval $(call SDIR_template,$(SDIR),distclean))) + +# clean and distclean both use SUBDIRS (all directories with Makefiles). +# clean on un-built directories is harmless (no-op). distclean can reach +# directories whose context:: target created build artefacts even when the +# build failed before .built or .depend markers were written. +# +# The '-' prefix on the recursive make call allows clean/distclean to +# continue even when individual subdirectories fail (e.g. missing tools +# like cargo). TOPDIR is passed so that sub-makes can include +# $(TOPDIR)/Make.defs and define SDIR_template for further recursion. + +$(foreach SDIR, $(SUBDIRS), $(eval .PHONY: $(SDIR)_clean)) Review Comment: let extend SDIR_template instead duplicating the code -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
