make install fails to install man pages

Simon Horman horms at
Mon Feb 22 02:53:00 EST 2010

On Tue, Jan 19, 2010 at 12:57:59PM -0500, Marcus Watts wrote:
> When building kexec-tools 2.0.1, I noticed that "make install"
> failed to install any man pages.  Upon looking, I found that
> what "make install" had tried to do was:
> 	for file in build/sbin/kexec .. kexec/kexec.8 kdump/kdump.8; do
> 	if test `dirname $file` =     "build/sbin" ; then
> 	...
> 	if test `dirname $file` =     "build/man/man8" ; then
> 		mkdir -p     /tmp/kex//usr/share/man/man8/
> 		/usr/bin/install -c -m 644 $file /tmp/kex//usr/share/man/man8/
> 	fi
> 	...
> 	done
> Since the man pages don't start with "build/", they don't
> match the if clause so aren't installed.
> Source in the makefile looks like this:
> 	if test `$(DIRNAME) $$file` =     "$(MAN8DIR)" ; then \
> A test that might better express what you are trying to do:
> 	if test `basename x/foo.8 .8` = foo
> perhaps something like this:
> 	AC_CHECK_PROG([BASENAME],  basename,  basename,  "no", [$PATH])
> 	if test "$BASENAME" = "no"; then AC_MSG_ERROR([ basename not found]) fi
> 	if test `$(BASENAME) $$file .8` =     "$$file" ; then \

Hi Marcus,

Sorry for overlooking this, it got lost in my INBOX somehow.

I have taken an slightly different approach to this problem,
which is to ensure that the manpages are in build/. Does this
with the problem you are seeing?


Install man pages

Ensure that the man pages are built (end up in build/) so that they get

* Use variables set in kexec/Makefile and kdump/Makefile for the
  correct lotion of the "built" man pages.
* For consistency, use variables set in kexec/Makefile and kdump/Makefile
  for the location of built binaries too
* Use = instead of := for TARGETS and the variables that comprise it
  so that they are re-evaluated after kexec/Makefile and kdump/Makefile
  are sourced
* Move the building of targets to below the inclusion of
  kexec/Makefile and kdump/Makefile. This seems to be necessary
  for $(TARGETS) to be correctly evaluated when used as a source.
* Make sure all remains the first target without moving more rules
  than necessary to below where kexec/Makefile and kdump/Makefile -
  I'm concerned about unexpected consequences.

The kexec-tools build system is a bit special.

Reported-by: Marcus Watts <mdw at>
Signed-off-by: Simon Horman <horms at>

Index: kexec-tools/
--- kexec-tools.orig/	2010-02-22 18:45:47.000000000 +1100
+++ kexec-tools/	2010-02-22 18:45:53.000000000 +1100
@@ -104,15 +104,14 @@ PKGDATADIR=$(DATADIR)/$(PACKAGE_NAME)
-MAN_PAGES:= kexec/kexec.8
-MAN_PAGES+= kdump/kdump.8
-BINARIES_i386:=  $(SBINDIR)/kexec $(PKGLIBDIR)/kexec_test
-BINARIES_x86_64:=$(SBINDIR)/kexec $(PKGLIBDIR)/kexec_test
-all: $(TARGETS)
+all: targets
 # generic build rules
 %.o: %.c
@@ -180,6 +179,9 @@ SRCS:= $(dist)
 PSRCS:=$(foreach s, $(SRCS), $(PACKAGE_NAME)-$(PACKAGE_VERSION)/$(s))
+targets: $(TARGETS)
 Makefile: config.status
@@ -326,5 +328,5 @@ install: $(TARGETS)
 		fi; \
-.PHONY: echo install all clean dist-clean distclean maintainer-clean 	\
-	maintainerclean tarball rpm
+.PHONY: echo install all targets clean dist-clean distclean \
+	maintainer-clean maintainerclean tarball rpm

More information about the kexec mailing list