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 <[email protected]>
Signed-off-by: Dan Williams <[email protected]>
---
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(-)

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 \

_______________________________________________
Linux-nvdimm mailing list
[email protected]
https://lists.01.org/mailman/listinfo/linux-nvdimm

Reply via email to