Ouss4 commented on a change in pull request #5055:
URL: https://github.com/apache/incubator-nuttx/pull/5055#discussion_r773458123



##########
File path: tools/Makefile.unix
##########
@@ -336,11 +334,39 @@ dirlinks: include/arch include/arch/board 
include/arch/chip $(ARCH_SRC)/board $(
 # the config.h and version.h header files in the include/nuttx directory and
 # the establishment of symbolic links to configured directories.
 
-context: include/nuttx/config.h include/nuttx/version.h include/math.h 
include/float.h include/stdarg.h include/setjmp.h dirlinks
-       $(Q) mkdir -p staging
-       $(Q) for dir in $(CONTEXTDIRS) ; do \
-               $(MAKE) -C $$dir context || exit; \
-       done
+# Generate a pattern to make Directories.mk context
+CONTEXTDIRS_DEPS = $(patsubst %,%/.context,$(CONTEXTDIRS))
+
+context: include/nuttx/config.h include/nuttx/version.h include/setjmp.h 
dirlinks $(CONTEXTDIRS_DEPS) | staging
+
+
+staging:
+       $(Q) mkdir -p $@
+
+# Pattern rule for $(CONTEXTDIRS_DEPS)
+%.context:
+       $(MAKE) -C $(patsubst %.context,%,$@) TOPDIR="$(TOPDIR)" context;
+       touch $@
+
+# Pattern rule for $(CONTEXTDIRS_CLEAN_DEPS)
+%.clean_context:
+       $(MAKE) -C $(patsubst %.clean_context,%,$@) TOPDIR="$(TOPDIR)" 
clean_context;
+
+ifeq ($(NEED_MATH_H),y)
+context: include/math.h
+endif
+
+ifeq ($(CONFIG_ARCH_FLOAT_H),y)
+context: include/float.h
+endif
+
+ifeq ($(CONFIG_ARCH_STDARG_H),y)
+context: include/stdarg.h
+endif
+
+ifeq ($(CONFIG_ARCH_SETJMP_H),y)
+context: include/setjmp.h
+endif

Review comment:
       We will have a bunch of warnings here about overriding `context` when 
these options are enabled.  To avoid that, `context` needs to be a double colon 
target.




-- 
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]


Reply via email to