You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by GitBox <gi...@apache.org> on 2021/12/21 19:44:08 UTC

[GitHub] [incubator-nuttx] AlanRosenthal opened a new pull request #5055: Improve Makefile.unix::context's dependencies

AlanRosenthal opened a new pull request #5055:
URL: https://github.com/apache/incubator-nuttx/pull/5055


   This pull request improves the dependencies for Makefile.unix::context rule.
   * `include/math.h`, `include/float.h`, `include/stdarg.h`, `include/setjmp.h` are only added to `context`'s dependency if the Kconfig value is set. This prevents `context` from trying to make `include/math.h` only to find out there's no command to create the file.
   * Instead of executing $(CONTEXTDIRS) in a for loop in the `context` rule, $(CONTEXTDIRS) are added as a dependency to `context` and a rule is created to create the targets. Real files are used, to prevent needlessly rebuilding the same `context` over and over and over again.
   * Instead of making the directory `staging`, add it as an order-only dependency for `context`. this ensures the directory is only created if it doesn't exist.
   
   Tested by running:
   ```
   (cd tools && ./configure.sh -a ../incubator-nuttx-apps stm32f3discovery:nsh)
   make context
   ```
   
   First time running context:
   ```
   ➜  incubator-nuttx git:(improve-make-context) time make context
   make[1]: Entering directory '/home/user/code/fitbit/incubator-nuttx/tools'
   make[1]: Leaving directory '/home/user/code/fitbit/incubator-nuttx/tools'
   make[1]: Entering directory '/home/user/code/fitbit/incubator-nuttx'
   make[2]: Entering directory '/home/user/code/fitbit/incubator-nuttx/boards'
   make[2]: Leaving directory '/home/user/code/fitbit/incubator-nuttx/boards'
   make[2]: Entering directory '/home/user/code/fitbit/incubator-nuttx-apps'
   make[3]: Entering directory '/home/user/code/fitbit/incubator-nuttx-apps/platform'
   make[3]: Leaving directory '/home/user/code/fitbit/incubator-nuttx-apps/platform'
   make[3]: Entering directory '/home/user/code/fitbit/incubator-nuttx-apps/builtin'
   make[3]: Leaving directory '/home/user/code/fitbit/incubator-nuttx-apps/builtin'
   make[2]: Leaving directory '/home/user/code/fitbit/incubator-nuttx-apps'
   make[2]: Entering directory '/home/user/code/fitbit/incubator-nuttx/graphics'
   make[3]: Entering directory '/home/user/code/fitbit/incubator-nuttx/graphics/nxglib'
   make[3]: Leaving directory '/home/user/code/fitbit/incubator-nuttx/graphics/nxglib'
   make[3]: Entering directory '/home/user/code/fitbit/incubator-nuttx/graphics/nxglib'
   make[3]: Leaving directory '/home/user/code/fitbit/incubator-nuttx/graphics/nxglib'
   make[3]: Entering directory '/home/user/code/fitbit/incubator-nuttx/graphics/nxglib'
   make[3]: Leaving directory '/home/user/code/fitbit/incubator-nuttx/graphics/nxglib'
   make[2]: Leaving directory '/home/user/code/fitbit/incubator-nuttx/graphics'
   make[1]: Leaving directory '/home/user/code/fitbit/incubator-nuttx'
   Create .version
   make[1]: Entering directory '/home/user/code/fitbit/incubator-nuttx/tools'
   make[1]: Leaving directory '/home/user/code/fitbit/incubator-nuttx/tools'
   Create version.h
   LN: include/arch to arch/arm/include
   LN: include/arch/board to /home/user/code/fitbit/incubator-nuttx/boards/arm/stm32/stm32f3discovery/include
   LN: include/arch/chip to arch/arm/include/stm32
   LN: arch/arm/src/board to /home/user/code/fitbit/incubator-nuttx/boards/arm/stm32/stm32f3discovery/../common
   LN: arch/arm/src/board/board to /home/user/code/fitbit/incubator-nuttx/boards/arm/stm32/stm32f3discovery/src
   LN: arch/arm/src/chip to arch/arm/src/stm32
   LN: /home/user/code/fitbit/incubator-nuttx/drivers/platform to /home/user/code/fitbit/incubator-nuttx/drivers/dummy
   make[1]: Entering directory '/home/user/code/fitbit/incubator-nuttx/boards'
   make[1]: Leaving directory '/home/user/code/fitbit/incubator-nuttx/boards'
   make[1]: Entering directory '/home/user/code/fitbit/incubator-nuttx-apps'
   make[2]: Entering directory '/home/user/code/fitbit/incubator-nuttx-apps/platform'
   LN: platform/board to /home/user/code/fitbit/incubator-nuttx-apps/platform/dummy
   make[2]: Leaving directory '/home/user/code/fitbit/incubator-nuttx-apps/platform'
   make[1]: Leaving directory '/home/user/code/fitbit/incubator-nuttx-apps'
   make context  0.95s user 0.45s system 109% cpu 1.281 total
   ```
   second time running context:
   ```
   ➜  incubator-nuttx git:(improve-make-context) time make context
   Create .version
   Create version.h
   LN: include/arch/board to /home/user/code/fitbit/incubator-nuttx/boards/arm/stm32/stm32f3discovery/include
   make[1]: Entering directory '/home/user/code/fitbit/incubator-nuttx/boards'
   make[1]: Nothing to be done for 'dirlinks'.
   make[1]: Leaving directory '/home/user/code/fitbit/incubator-nuttx/boards'
   make[1]: Entering directory '/home/user/code/fitbit/incubator-nuttx-apps'
   make[2]: Entering directory '/home/user/code/fitbit/incubator-nuttx-apps/platform'
   LN: platform/board to /home/user/code/fitbit/incubator-nuttx-apps/platform/dummy
   make[2]: Leaving directory '/home/user/code/fitbit/incubator-nuttx-apps/platform'
   make[1]: Leaving directory '/home/user/code/fitbit/incubator-nuttx-apps'
   make context  0.30s user 0.20s system 121% cpu 0.414 total
   ```
   
   ## Summary
   
   ## Impact
   
   ## Testing
   
   


-- 
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: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] Ouss4 commented on a change in pull request #5055: Improve Makefile.[unix|win]::context's dependencies

Posted by GitBox <gi...@apache.org>.
Ouss4 commented on a change in pull request #5055:
URL: https://github.com/apache/incubator-nuttx/pull/5055#discussion_r773503017



##########
File path: tools/Makefile.win
##########
@@ -315,9 +315,36 @@ 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 %%G in ($(CONTEXTDIRS)) do ( $(MAKE) -C %%G context )
+# Generate a pattern to make Directories.mk context
+
+CONTEXTDIRS_DEPS = $(patsubst %,%\.context,$(CONTEXTDIRS))
+
+context: include\nuttx\config.h include\nuttx\version.h $(CONTEXTDIRS_DEPS) dirlinks | staging
+
+staging:
+	$(Q) mkdir -p $@
+
+# Pattern rule for $(CONTEXTDIRS_DEPS)
+
+%.context:
+	$(MAKE) -C $(patsubst %.context,%,$@) TOPDIR="$(TOPDIR)" context;
+	touch $@

Review comment:
       ```suggestion
   	$(Q) $(MAKE) -C $(patsubst %.context,%,$@) TOPDIR="$(TOPDIR)" context;
   	$(Q) touch $@
   ```




-- 
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: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] Ouss4 commented on a change in pull request #5055: Improve Makefile.unix::context's dependencies

Posted by GitBox <gi...@apache.org>.
Ouss4 commented on a change in pull request #5055:
URL: https://github.com/apache/incubator-nuttx/pull/5055#discussion_r773471087



##########
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 dirlinks $(CONTEXTDIRS_DEPS) | staging
+
+
+staging:

Review comment:
       ```suggestion
   staging:
   ```

##########
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))

Review comment:
       ```suggestion
   # Generate a pattern to make Directories.mk context
   
   CONTEXTDIRS_DEPS = $(patsubst %,%/.context,$(CONTEXTDIRS))
   ```

##########
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 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:

Review comment:
       ```suggestion
   # Pattern rule for $(CONTEXTDIRS_CLEAN_DEPS)
   
   %.clean_context:
   ```

##########
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 dirlinks $(CONTEXTDIRS_DEPS) | staging
+
+
+staging:
+	$(Q) mkdir -p $@
+
+# Pattern rule for $(CONTEXTDIRS_DEPS)
+%.context:

Review comment:
       ```suggestion
   # Pattern rule for $(CONTEXTDIRS_DEPS)
   
   %.context:
   ```




-- 
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: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a change in pull request #5055: Improve Makefile.[unix|win]::context's dependencies

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on a change in pull request #5055:
URL: https://github.com/apache/incubator-nuttx/pull/5055#discussion_r773574721



##########
File path: tools/Makefile.unix
##########
@@ -336,11 +328,36 @@ 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 dirlinks $(CONTEXTDIRS_DEPS) | staging
+
+staging:
+	$(Q) mkdir -p $@
+
+# Pattern rule for $(CONTEXTDIRS_DEPS)
+
+%.context: include/nuttx/config.h dirlinks
+	$(MAKE) -C $(patsubst %.context,%,$@) TOPDIR="$(TOPDIR)" context;

Review comment:
       remove ;

##########
File path: tools/Makefile.win
##########
@@ -315,9 +315,36 @@ 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 %%G in ($(CONTEXTDIRS)) do ( $(MAKE) -C %%G context )
+# Generate a pattern to make Directories.mk context
+
+CONTEXTDIRS_DEPS = $(patsubst %,%\.context,$(CONTEXTDIRS))
+
+context: include\nuttx\config.h include\nuttx\version.h $(CONTEXTDIRS_DEPS) dirlinks | staging
+
+staging:
+	$(Q) mkdir -p $@
+
+# Pattern rule for $(CONTEXTDIRS_DEPS)
+
+%.context: include\nuttx\config.h dirlinks
+	$(MAKE) -C $(patsubst %.context,%,$@) TOPDIR="$(TOPDIR)" context;

Review comment:
       remove ; too




-- 
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: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] Ouss4 commented on pull request #5055: Improve Makefile.[unix|win]::context's dependencies

Posted by GitBox <gi...@apache.org>.
Ouss4 commented on pull request #5055:
URL: https://github.com/apache/incubator-nuttx/pull/5055#issuecomment-999160530


   There seems to be some dependency issues when building in parallel. 


-- 
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: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] xiaoxiang781216 commented on pull request #5055: Improve Makefile.[unix|win]::context's dependencies

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on pull request #5055:
URL: https://github.com/apache/incubator-nuttx/pull/5055#issuecomment-999257930


   And let's squash the intermediate change into one like @gustavonihei's suggestion.


-- 
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: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] Ouss4 commented on a change in pull request #5055: Improve Makefile.unix::context's dependencies

Posted by GitBox <gi...@apache.org>.
Ouss4 commented on a change in pull request #5055:
URL: https://github.com/apache/incubator-nuttx/pull/5055#discussion_r773464517



##########
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:
       Oh I see, this works without warnings.  Thanks!




-- 
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: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] gustavonihei commented on a change in pull request #5055: Improve Makefile.[unix|win]::context's dependencies

Posted by GitBox <gi...@apache.org>.
gustavonihei commented on a change in pull request #5055:
URL: https://github.com/apache/incubator-nuttx/pull/5055#discussion_r773770591



##########
File path: tools/Makefile.win
##########
@@ -315,9 +315,36 @@ 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 %%G in ($(CONTEXTDIRS)) do ( $(MAKE) -C %%G context )
+# Generate a pattern to make Directories.mk context
+
+CONTEXTDIRS_DEPS = $(patsubst %,%\.context,$(CONTEXTDIRS))
+
+context: include\nuttx\config.h include\nuttx\version.h $(CONTEXTDIRS_DEPS) dirlinks | staging
+
+staging:
+	$(Q) mkdir -p $@
+
+# Pattern rule for $(CONTEXTDIRS_DEPS)
+
+%.context: include\nuttx\config.h dirlinks
+	$(MAKE) -C $(patsubst %.context,%,$@) TOPDIR="$(TOPDIR)" context

Review comment:
       ```suggestion
   	$(Q) $(MAKE) -C $(patsubst %.context,%,$@) TOPDIR="$(TOPDIR)" context
   ```
   Missing silent flag in `make` command




-- 
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: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] AlanRosenthal commented on pull request #5055: Improve Makefile.unix::context's dependencies

Posted by GitBox <gi...@apache.org>.
AlanRosenthal commented on pull request #5055:
URL: https://github.com/apache/incubator-nuttx/pull/5055#issuecomment-999126054


   > @AlanRosenthal Please, don't forget to squash the commits. Also, you may want to link your email to your GitHub account, so that GitHub is able to count your contributions.
   
   thanks for the email suggestion, I've added it!


-- 
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: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] Ouss4 commented on pull request #5055: Improve Makefile.unix::context's dependencies

Posted by GitBox <gi...@apache.org>.
Ouss4 commented on pull request #5055:
URL: https://github.com/apache/incubator-nuttx/pull/5055#issuecomment-999125598


   BTW, the CI is complaining about the newly generated .context files.  We'll have to delete those during `clean_context`.


-- 
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: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] Ouss4 commented on pull request #5055: Improve Makefile.[unix|win]::context's dependencies

Posted by GitBox <gi...@apache.org>.
Ouss4 commented on pull request #5055:
URL: https://github.com/apache/incubator-nuttx/pull/5055#issuecomment-999164330


   > There seems to be some dependency issues when building in parallel.
   
   Since now all the context targets are at the same level of dependency, we are having issues when say the chip context is made before config.h. 


-- 
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: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] Ouss4 commented on a change in pull request #5055: Improve Makefile.unix::context's dependencies

Posted by GitBox <gi...@apache.org>.
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: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] gustavonihei commented on a change in pull request #5055: Improve Makefile.[unix|win]::context's dependencies

Posted by GitBox <gi...@apache.org>.
gustavonihei commented on a change in pull request #5055:
URL: https://github.com/apache/incubator-nuttx/pull/5055#discussion_r773770342



##########
File path: tools/Makefile.unix
##########
@@ -336,11 +328,36 @@ 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 dirlinks $(CONTEXTDIRS_DEPS) | staging
+
+staging:
+	$(Q) mkdir -p $@
+
+# Pattern rule for $(CONTEXTDIRS_DEPS)
+
+%.context: include/nuttx/config.h dirlinks
+	$(MAKE) -C $(patsubst %.context,%,$@) TOPDIR="$(TOPDIR)" context

Review comment:
       ```suggestion
   	$(Q) $(MAKE) -C $(patsubst %.context,%,$@) TOPDIR="$(TOPDIR)" context
   ```
   Missing silent flag in `make` command.




-- 
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: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] AlanRosenthal commented on pull request #5055: Improve Makefile.[unix|win]::context's dependencies

Posted by GitBox <gi...@apache.org>.
AlanRosenthal commented on pull request #5055:
URL: https://github.com/apache/incubator-nuttx/pull/5055#issuecomment-999139064


   Thanks for the review @Ouss4 @gustavonihei, I believe I have addressed all feedback. Let me know if you have any other comments/suggestions.


-- 
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: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] AlanRosenthal commented on a change in pull request #5055: Improve Makefile.unix::context's dependencies

Posted by GitBox <gi...@apache.org>.
AlanRosenthal commented on a change in pull request #5055:
URL: https://github.com/apache/incubator-nuttx/pull/5055#discussion_r773461904



##########
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:
       Since these `context` targets don't define a recipe they can use the single colon without raising a warning.
   From https://www.gnu.org/software/make/manual/html_node/Multiple-Rules.html#Multiple-Rules:
   
   > One file can be the target of several rules. All the prerequisites mentioned in all the rules are merged into one list of prerequisites for the target. If the target is older than any prerequisite from any rule, the recipe is executed.
   > 
   > There can only be one recipe to be executed for a file. If more than one rule gives a recipe for the same file, make uses the last one given and prints an error message. (As a special case, if the file’s name begins with a dot, no error message is printed. This odd behavior is only for compatibility with other implementations of make… you should avoid using it). Occasionally it is useful to have the same target invoke multiple recipes which are defined in different parts of your makefile; you can use double-colon rules (see Double-Colon) for this.

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

Review comment:
       yes, thank you




-- 
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: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] gustavonihei commented on a change in pull request #5055: Improve Makefile.unix::context's dependencies

Posted by GitBox <gi...@apache.org>.
gustavonihei commented on a change in pull request #5055:
URL: https://github.com/apache/incubator-nuttx/pull/5055#discussion_r773458454



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

Review comment:
       ```suggestion
   context: include/nuttx/config.h include/nuttx/version.h dirlinks $(CONTEXTDIRS_DEPS) | staging
   ```
   Shouldn't `include/setjmp.h` be removed as well?




-- 
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: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] AlanRosenthal commented on pull request #5055: Improve Makefile.[unix|win]::context's dependencies

Posted by GitBox <gi...@apache.org>.
AlanRosenthal commented on pull request #5055:
URL: https://github.com/apache/incubator-nuttx/pull/5055#issuecomment-999174079


   > > There seems to be some dependency issues when building in parallel.
   > 
   > Since now all the context targets are at the same level of dependency, we are having issues when say the chip context is made before config.h.
   
   I believe this is required to ensure config.h and all the simlinks are built before running context rules:
   ```
   %.context: include/nuttx/config.h dirlinks
   ```
   I am testing locally and will push if it looks promising 


-- 
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: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] Ouss4 commented on a change in pull request #5055: Improve Makefile.[unix|win]::context's dependencies

Posted by GitBox <gi...@apache.org>.
Ouss4 commented on a change in pull request #5055:
URL: https://github.com/apache/incubator-nuttx/pull/5055#discussion_r773502482



##########
File path: tools/Makefile.unix
##########
@@ -336,11 +328,36 @@ 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 dirlinks $(CONTEXTDIRS_DEPS) | staging
+
+staging:
+	$(Q) mkdir -p $@
+
+# Pattern rule for $(CONTEXTDIRS_DEPS)
+
+%.context:
+	$(MAKE) -C $(patsubst %.context,%,$@) TOPDIR="$(TOPDIR)" context;
+	touch $@

Review comment:
       ```suggestion
   	$(Q) $(MAKE) -C $(patsubst %.context,%,$@) TOPDIR="$(TOPDIR)" context;
   	$(Q) touch $@
   ```
   I noticed some extra output when building.




-- 
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: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] Ouss4 commented on pull request #5055: Improve Makefile.[unix|win]::context's dependencies

Posted by GitBox <gi...@apache.org>.
Ouss4 commented on pull request #5055:
URL: https://github.com/apache/incubator-nuttx/pull/5055#issuecomment-999423179


   > > > There seems to be some dependency issues when building in parallel.
   > > 
   > > 
   > > Since now all the context targets are at the same level of dependency, we are having issues when say the chip context is made before config.h.
   > 
   > I believe this is required to ensure config.h and all the simlinks are built before running context rules:
   > 
   > ```
   > %.context: include/nuttx/config.h dirlinks
   > ```
   > 
   > I am testing locally and will push if it looks promising
   
   Yes, I think this is enough.  The issue was actually `dirlinks`, this is why we had some `chip/Make.defs not found` errors.  But I also saw some of the other jobs complaining about config.h.


-- 
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: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] gustavonihei commented on pull request #5055: Improve Makefile.unix::context's dependencies

Posted by GitBox <gi...@apache.org>.
gustavonihei commented on pull request #5055:
URL: https://github.com/apache/incubator-nuttx/pull/5055#issuecomment-999122579


   @AlanRosenthal Please, don't forget to squash the commits.
   Also, you may want to link your email to your GitHub account, so that GitHub is able to count your contributions.


-- 
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: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] acassis merged pull request #5055: Improve Makefile.[unix|win]::context's dependencies

Posted by GitBox <gi...@apache.org>.
acassis merged pull request #5055:
URL: https://github.com/apache/incubator-nuttx/pull/5055


   


-- 
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: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org