make install fails to install man pages

Simon Horman horms at verge.net.au
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:
> configure.ac:
> 	AC_CHECK_PROG([BASENAME],  basename,  basename,  "no", [$PATH])
> 	if test "$BASENAME" = "no"; then AC_MSG_ERROR([ basename not found]) fi
> Makefile.in:
> 	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
installed.

* 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 umich.edu>
Signed-off-by: Simon Horman <horms at verge.net.au>

Index: kexec-tools/Makefile.in
===================================================================
--- kexec-tools.orig/Makefile.in	2010-02-22 18:45:47.000000000 +1100
+++ kexec-tools/Makefile.in	2010-02-22 18:45:53.000000000 +1100
@@ -104,15 +104,14 @@ PKGDATADIR=$(DATADIR)/$(PACKAGE_NAME)
 PKGLIBDIR=$(LIBDIR)/$(PACKAGE_NAME)
 PKGINCLUDEIR=$(INCLUDEDIR)/$(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
-BINARIES:=$(SBINDIR)/kexec $(SBINDIR)/kdump $(BINARIES_$(ARCH))
+MAN_PAGES=$(KEXEC_MANPAGE) $(KDUMP_MANPAGE)
+BINARIES_i386=$(KEXEC_TEST)
+BINARIES_x86_64=$(KEXEC_TEST)
+BINARIES=$(KEXEC) $(KDUMP) $(BINARIES_$(ARCH))
 
-TARGETS:=$(BINARIES) $(MAN_PAGES)
+TARGETS=$(BINARIES) $(MAN_PAGES)
 
-all: $(TARGETS)
+all: targets
 
 # generic build rules
 %.o: %.c
@@ -180,6 +179,9 @@ SRCS:= $(dist)
 PSRCS:=$(foreach s, $(SRCS), $(PACKAGE_NAME)-$(PACKAGE_VERSION)/$(s))
 PGSRCS:=$(foreach s, $(GENERATED_SRCS), $(PACKAGE_NAME)-$(PACKAGE_VERSION)/$(s))
 
+targets: $(TARGETS)
+	@echo TARGETS: $(TARGETS)
+
 Makefile: Makefile.in config.status
 	./config.status
 
@@ -326,5 +328,5 @@ install: $(TARGETS)
 		fi; \
 	done
 
-.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