diff mbox series

[ndctl,v2] ndctl/build: Fix config.h dependency

Message ID 154777834064.2059786.4819511575939860855.stgit@dwillia2-desk3.amr.corp.intel.com (mailing list archive)
State Accepted
Commit 709968e2898539027d67bea7f4849fd5f2688950
Headers show
Series [ndctl,v2] ndctl/build: Fix config.h dependency | expand

Commit Message

Dan Williams Jan. 18, 2019, 2:28 a.m. UTC
The config.h file needs to be rebuilt whenever ndctl/Makefile.am
changes, not the top-level Makefile. This fixes some missed rebuild
events when adding more definitions.

This also concatenates the commands into one $(AM_V_GEN) statement so
that there is only one "GEN config.h" line in the build output.

Reported-by: Dave Jiang <dave.jiang@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
---
Changes in v2:
* While the previous fix appeared to work it didn't when I did the same
  for daxctl. Then I found what was actually wrong is that we were
  looking at the wrong level of the directory hierarchy for Makefile.am.
* I also noticed that the build output emitted "GEN config.h" multiple
  times.

 ndctl/Makefile.am |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Verma, Vishal L Jan. 18, 2019, 3:11 a.m. UTC | #1
On Thu, 2019-01-17 at 18:28 -0800, Dan Williams wrote:
> The config.h file needs to be rebuilt whenever ndctl/Makefile.am
> changes, not the top-level Makefile. This fixes some missed rebuild
> events when adding more definitions.
> 
> This also concatenates the commands into one $(AM_V_GEN) statement so
> that there is only one "GEN config.h" line in the build output.
> 
> Reported-by: Dave Jiang <dave.jiang@intel.com>
> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
> ---
> Changes in v2:
> * While the previous fix appeared to work it didn't when I did the same
>   for daxctl. Then I found what was actually wrong is that we were
>   looking at the wrong level of the directory hierarchy for Makefile.am.
> * I also noticed that the build output emitted "GEN config.h" multiple
>   times.
> 
>  ndctl/Makefile.am |    6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)

Looks good, applied.

> 
> diff --git a/ndctl/Makefile.am b/ndctl/Makefile.am
> index f96f08974aa6..c7c1ac6ebef6 100644
> --- a/ndctl/Makefile.am
> +++ b/ndctl/Makefile.am
> @@ -4,9 +4,9 @@ bin_PROGRAMS = ndctl
>  
>  DISTCLEANFILES = config.h
>  BUILT_SOURCES = config.h
> -config.h: Makefile
> -	$(AM_V_GEN) echo "/* Autogenerated by ndctl/Makefile.am */" >$@
> -	$(AM_V_GEN) echo '#define NDCTL_CONF_FILE \
> +config.h: $(srcdir)/Makefile.am
> +	$(AM_V_GEN) echo "/* Autogenerated by ndctl/Makefile.am */" >$@ && \
> +	echo '#define NDCTL_CONF_FILE \
>  		"$(ndctl_monitorconfdir)/$(ndctl_monitorconf)"' >>$@
>  
>  ndctl_SOURCES = ndctl.c \
>
diff mbox series

Patch

diff --git a/ndctl/Makefile.am b/ndctl/Makefile.am
index f96f08974aa6..c7c1ac6ebef6 100644
--- a/ndctl/Makefile.am
+++ b/ndctl/Makefile.am
@@ -4,9 +4,9 @@  bin_PROGRAMS = ndctl
 
 DISTCLEANFILES = config.h
 BUILT_SOURCES = config.h
-config.h: Makefile
-	$(AM_V_GEN) echo "/* Autogenerated by ndctl/Makefile.am */" >$@
-	$(AM_V_GEN) echo '#define NDCTL_CONF_FILE \
+config.h: $(srcdir)/Makefile.am
+	$(AM_V_GEN) echo "/* Autogenerated by ndctl/Makefile.am */" >$@ && \
+	echo '#define NDCTL_CONF_FILE \
 		"$(ndctl_monitorconfdir)/$(ndctl_monitorconf)"' >>$@
 
 ndctl_SOURCES = ndctl.c \