'make install' installs programs and man pages
[virt-mem.git] / Makefile.in
index 192b027..84461c4 100644 (file)
@@ -20,31 +20,40 @@ PACKAGE             = @PACKAGE_NAME@
 VERSION                = @PACKAGE_VERSION@
 
 INSTALL                = @INSTALL@
+datarootdir    = @datarootdir@
+mandir         = @mandir@
 
 HAVE_PERLDOC    = @HAVE_PERLDOC@
 
 TOOLS          = uname dmesg
 
-SUBDIRS                = lib $(TOOLS)
-
 ifeq ($(HAVE_PERLDOC),perldoc)
-TARGETS         += virt-mem.1 virt-mem.txt $(TOOLS:%=virt-%.1)
+MANPAGES        = virt-mem.1 $(TOOLS:%=virt-%.1)
+TEXTMANPAGES   = virt-mem.txt
 endif
 
-all install: $(TARGETS)
-       for d in $(SUBDIRS) po; do \
+TARGETS                = $(MANPAGES) $(TEXTMANPAGES)
+
+all: $(TARGETS)
+       for d in lib $(TOOLS) po; do \
+         $(MAKE) -C $$d $@; \
+         if [ $$? -ne 0 ]; then exit 1; fi; \
+       done
+
+install: install-man
+       for d in lib $(TOOLS) po; do \
          $(MAKE) -C $$d $@; \
          if [ $$? -ne 0 ]; then exit 1; fi; \
        done
 
 depend doc:
-       for d in $(SUBDIRS); do \
+       for d in lib $(TOOLS); do \
          $(MAKE) -C $$d $@; \
          if [ $$? -ne 0 ]; then exit 1; fi; \
        done
 
 clean:
-       for d in . $(SUBDIRS); do \
+       for d in . lib $(TOOLS); do \
          (cd $$d; rm -f *.cmi *.cmo *.cmx *.cma *.cmxa *.o *.a \
            *.so *.opt *~ *.dll *.exe *.annot core); \
        done
@@ -72,6 +81,14 @@ virt-mem.txt: virt-mem.pod
 
 virt-%.1:
        echo '.so man1/virt-mem.1' > $@
+
+install-man:
+       $(INSTALL) -m 0644 $(MANPAGES) $(DESTDIR)$(mandir)/man1/
+
+else
+
+install-man:
+
 endif
 
 # Distribution.