According to the GNU standards file, in the part on installing stuff
from Makefiles:
Optionally, you may prepend the value of `DESTDIR' to the target
filename. Doing this allows the installer to create a snapshot of the
installation to be copied onto the real target filesystem later. Do not
set the value of `DESTDIR' in your Makefile, and do not include it in
any installed files. With support for `DESTDIR', the above examples
become:
$(INSTALL_PROGRAM) foo $(DESTDIR)$(bindir)/foo
$(INSTALL_DATA) libfoo.a $(DESTDIR)$(libdir)/libfoo.a
(Lots of non-GNU stuff supports this too.)
For Athena at MIT, we build and install everything into AFS and then
workstations install/update by syncing their local disk with the OS
image in AFS. I know that some other large sites do similar things.
So, this patch adds DESTDIR support. It's a lot of lines, but it's all
pretty simple.
diff -c nmh-1.0/Makefile.in.orig nmh-1.0/Makefile.in
*** nmh-1.0/Makefile.in.orig 1999/02/09 19:58:13
--- nmh-1.0/Makefile.in 1999/02/11 18:53:50
***************
*** 57,63 ****
# flags passed to recursive makes in subdirectories
MAKEDEFS = CC='$(CC)' CPPFLAGS='$(CPPFLAGS)' DEFS='$(DEFS)' \
! CFLAGS='$(CFLAGS)' LDFLAGS='$(LDFLAGS)' LIBS='$(LIBS)' \
prefix='$(prefix)' exec_prefix='$(exec_prefix)' bindir='$(bindir)' \
etcdir='$(etcdir)' libdir='$(libdir)' mandir='$(mandir)' \
mailspool='$(mailspool)' sendmailpath='$(sendmailpath)' \
--- 57,63 ----
# flags passed to recursive makes in subdirectories
MAKEDEFS = CC='$(CC)' CPPFLAGS='$(CPPFLAGS)' DEFS='$(DEFS)' \
! CFLAGS='$(CFLAGS)' LDFLAGS='$(LDFLAGS)' LIBS='$(LIBS)' DESTDIR='$(DESTDIR)' \
prefix='$(prefix)' exec_prefix='$(exec_prefix)' bindir='$(bindir)' \
etcdir='$(etcdir)' libdir='$(libdir)' mandir='$(mandir)' \
mailspool='$(mailspool)' sendmailpath='$(sendmailpath)' \
diff -c nmh-1.0/etc/Makefile.in.orig nmh-1.0/etc/Makefile.in
*** nmh-1.0/etc/Makefile.in.orig 1999/02/07 18:14:19
--- nmh-1.0/etc/Makefile.in 1999/02/11 18:59:53
***************
*** 71,106 ****
install: install-files install-scripts
install-files:
! $(top_srcdir)/mkinstalldirs $(etcdir)
for file in $(DIST_FILES); do \
! if [ -f $(etcdir)/$$file ]; then \
! mv $(etcdir)/$$file $(etcdir)/$$file.old; \
fi; \
! $(INSTALL_DATA) $(srcdir)/$$file $(etcdir)/$$file; \
done
for file in $(GEN_FILES); do \
! if [ -f $(etcdir)/$$file ]; then \
! mv $(etcdir)/$$file $(etcdir)/$$file.old; \
fi; \
! $(INSTALL_DATA) $$file $(etcdir)/$$file; \
done
install-scripts:
! $(top_srcdir)/mkinstalldirs $(libdir)
for script in $(SCRIPTS); do \
! $(INSTALL_PROGRAM) $(srcdir)/$$script $(libdir)/$$script; \
done
uninstall: uninstall-files uninstall-scripts
uninstall-files:
for file in $(FILES); do \
! rm -f $(etcdir)/$$file; \
done
uninstall-scripts:
for script in $(SCRIPTS); do \
! rm -f $(libdir)/$$script; \
done
# ========== DEPENDENCIES FOR CLEANUP ==========
--- 71,106 ----
install: install-files install-scripts
install-files:
! $(top_srcdir)/mkinstalldirs $(DESTDIR)$(etcdir)
for file in $(DIST_FILES); do \
! if [ -f $(DESTDIR)$(etcdir)/$$file ]; then \
! mv $(DESTDIR)$(etcdir)/$$file $(DESTDIR)$(etcdir)/$$file.old; \
fi; \
! $(INSTALL_DATA) $(srcdir)/$$file $(DESTDIR)$(etcdir)/$$file; \
done
for file in $(GEN_FILES); do \
! if [ -f $(DESTDIR)$(etcdir)/$$file ]; then \
! mv $(DESTDIR)$(etcdir)/$$file $(DESTDIR)$(etcdir)/$$file.old; \
fi; \
! $(INSTALL_DATA) $$file $(DESTDIR)$(etcdir)/$$file; \
done
install-scripts:
! $(top_srcdir)/mkinstalldirs $(DESTDIR)$(libdir)
for script in $(SCRIPTS); do \
! $(INSTALL_PROGRAM) $(srcdir)/$$script $(DESTDIR)$(libdir)/$$script; \
done
uninstall: uninstall-files uninstall-scripts
uninstall-files:
for file in $(FILES); do \
! rm -f $(DESTDIR)$(etcdir)/$$file; \
done
uninstall-scripts:
for script in $(SCRIPTS); do \
! rm -f $(DESTDIR)$(libdir)/$$script; \
done
# ========== DEPENDENCIES FOR CLEANUP ==========
diff -c nmh-1.0/man/Makefile.in.orig nmh-1.0/man/Makefile.in
*** nmh-1.0/man/Makefile.in.orig 1999/02/07 18:14:22
--- nmh-1.0/man/Makefile.in 1999/02/11 19:01:47
***************
*** 129,156 ****
# install the include file for man pages
install-hdr:
! $(top_srcdir)/mkinstalldirs $(etcdir)
! $(INSTALL_DATA) tmac.h $(etcdir)/tmac.h
# install the man pages in man1
install-man1:
! $(top_srcdir)/mkinstalldirs $(mandir)/man$(manext1)
for file in $(MAN1); do \
! $(INSTALL_DATA) $$file $(mandir)/man$(manext1) ; \
done
# install the man pages in man5
install-man5:
! $(top_srcdir)/mkinstalldirs $(mandir)/man$(manext5)
for file in $(MAN5); do \
! $(INSTALL_DATA) $$file $(mandir)/man$(manext5) ; \
done
# install the man pages in man8
install-man8:
! $(top_srcdir)/mkinstalldirs $(mandir)/man$(manext8)
for file in $(MAN8); do \
! $(INSTALL_DATA) $$file $(mandir)/man$(manext8) ; \
done
# ========= UNINSTALL TARGETS =========
--- 129,156 ----
# install the include file for man pages
install-hdr:
! $(top_srcdir)/mkinstalldirs $(DESTDIR)$(etcdir)
! $(INSTALL_DATA) tmac.h $(DESTDIR)$(etcdir)/tmac.h
# install the man pages in man1
install-man1:
! $(top_srcdir)/mkinstalldirs $(DESTDIR)$(mandir)/man$(manext1)
for file in $(MAN1); do \
! $(INSTALL_DATA) $$file $(DESTDIR)$(mandir)/man$(manext1) ; \
done
# install the man pages in man5
install-man5:
! $(top_srcdir)/mkinstalldirs $(DESTDIR)$(mandir)/man$(manext5)
for file in $(MAN5); do \
! $(INSTALL_DATA) $$file $(DESTDIR)$(mandir)/man$(manext5) ; \
done
# install the man pages in man8
install-man8:
! $(top_srcdir)/mkinstalldirs $(DESTDIR)$(mandir)/man$(manext8)
for file in $(MAN8); do \
! $(INSTALL_DATA) $$file $(DESTDIR)$(mandir)/man$(manext8) ; \
done
# ========= UNINSTALL TARGETS =========
***************
*** 159,182 ****
# uninstall the include file for man pages
uninstall-hdr:
! rm -f $(etcdir)/tmac.h
# uninstall the man pages in man1
uninstall-man1:
for file in $(MAN1); do \
! rm -f $(mandir)/man$(manext1)/$$file; \
done
# uninstall the man pages in man5
uninstall-man5:
for file in $(MAN5); do \
! rm -f $(mandir)/man$(manext5)/$$file; \
done
# uninstall the man pages in man8
uninstall-man8:
for file in $(MAN8); do \
! rm -f $(mandir)/man$(manext8)/$$file; \
done
# ========== DEPENDENCIES FOR CLEANUP ==========
--- 159,182 ----
# uninstall the include file for man pages
uninstall-hdr:
! rm -f $(DESTDIR)$(etcdir)/tmac.h
# uninstall the man pages in man1
uninstall-man1:
for file in $(MAN1); do \
! rm -f $(DESTDIR)$(mandir)/man$(manext1)/$$file; \
done
# uninstall the man pages in man5
uninstall-man5:
for file in $(MAN5); do \
! rm -f $(DESTDIR)$(mandir)/man$(manext5)/$$file; \
done
# uninstall the man pages in man8
uninstall-man8:
for file in $(MAN8); do \
! rm -f $(DESTDIR)$(mandir)/man$(manext8)/$$file; \
done
# ========== DEPENDENCIES FOR CLEANUP ==========
diff -c nmh-1.0/mts/Makefile.in.orig nmh-1.0/mts/Makefile.in
*** nmh-1.0/mts/Makefile.in.orig 1999/02/07 18:14:12
--- nmh-1.0/mts/Makefile.in 1999/02/11 18:55:39
***************
*** 11,17 ****
# flags passed to recursive makes in subdirectories
MAKEDEFS = CC='$(CC)' CPPFLAGS='$(CPPFLAGS)' DEFS='$(DEFS)' \
! CFLAGS='$(CFLAGS)' LDFLAGS='$(LDFLAGS)' LIBS='$(LIBS)' \
prefix='$(prefix)' exec_prefix='$(exec_prefix)' bindir='$(bindir)' \
etcdir='$(etcdir)' libdir='$(libdir)' mandir='$(mandir)' \
mailspool='$(mailspool)' sendmailpath='$(sendmailpath)' \
--- 11,17 ----
# flags passed to recursive makes in subdirectories
MAKEDEFS = CC='$(CC)' CPPFLAGS='$(CPPFLAGS)' DEFS='$(DEFS)' \
! CFLAGS='$(CFLAGS)' LDFLAGS='$(LDFLAGS)' LIBS='$(LIBS)' DESTDIR='$(DESTDIR)' \
prefix='$(prefix)' exec_prefix='$(exec_prefix)' bindir='$(bindir)' \
etcdir='$(etcdir)' libdir='$(libdir)' mandir='$(mandir)' \
mailspool='$(mailspool)' sendmailpath='$(sendmailpath)' \
diff -c nmh-1.0/uip/Makefile.in.orig nmh-1.0/uip/Makefile.in
*** nmh-1.0/uip/Makefile.in.orig 1999/02/07 18:14:18
--- nmh-1.0/uip/Makefile.in 1999/02/11 19:07:42
***************
*** 242,279 ****
# install commands
install-cmds:
! $(top_srcdir)/mkinstalldirs $(bindir)
for cmd in $(CMDS); do \
! $(INSTALL_PROGRAM) $$cmd $(bindir)/$$cmd; \
done
# install links
install-lcmds:
! rm -f $(bindir)/flists
! rm -f $(bindir)/folders
! rm -f $(bindir)/prev
! rm -f $(bindir)/next
! $(LN) $(bindir)/flist $(bindir)/flists
! $(LN) $(bindir)/folder $(bindir)/folders
! $(LN) $(bindir)/show $(bindir)/prev
! $(LN) $(bindir)/show $(bindir)/next
# install misc support binaries
install-misc:
! $(top_srcdir)/mkinstalldirs $(libdir)
for misc in $(MISC); do \
! $(INSTALL_PROGRAM) $$misc $(libdir)/$$misc; \
done
uninstall:
for cmd in $(CMDS); do \
! rm -f $(bindir)/$$cmd; \
done
for lcmd in $(LCMDS); do \
! rm -f $(bindir)/$$lcmd; \
done
for misc in $(MISC); do \
! rm -f $(libdir)/$$misc; \
done
# ========== DEPENDENCIES FOR CLEANUP ==========
--- 242,279 ----
# install commands
install-cmds:
! $(top_srcdir)/mkinstalldirs $(DESTDIR)$(bindir)
for cmd in $(CMDS); do \
! $(INSTALL_PROGRAM) $$cmd $(DESTDIR)$(bindir)/$$cmd; \
done
# install links
install-lcmds:
! rm -f $(DESTDIR)$(bindir)/flists
! rm -f $(DESTDIR)$(bindir)/folders
! rm -f $(DESTDIR)$(bindir)/prev
! rm -f $(DESTDIR)$(bindir)/next
! $(LN) $(DESTDIR)$(bindir)/flist $(DESTDIR)$(bindir)/flists
! $(LN) $(DESTDIR)$(bindir)/folder $(DESTDIR)$(bindir)/folders
! $(LN) $(DESTDIR)$(bindir)/show $(DESTDIR)$(bindir)/prev
! $(LN) $(DESTDIR)$(bindir)/show $(DESTDIR)$(bindir)/next
# install misc support binaries
install-misc:
! $(top_srcdir)/mkinstalldirs $(DESTDIR)$(libdir)
for misc in $(MISC); do \
! $(INSTALL_PROGRAM) $$misc $(DESTDIR)$(libdir)/$$misc; \
done
uninstall:
for cmd in $(CMDS); do \
! rm -f $(DESTDIR)$(bindir)/$$cmd; \
done
for lcmd in $(LCMDS); do \
! rm -f $(DESTDIR)$(bindir)/$$lcmd; \
done
for misc in $(MISC); do \
! rm -f $(DESTDIR)$(libdir)/$$misc; \
done
# ========== DEPENDENCIES FOR CLEANUP ==========
diff -c nmh-1.0/zotnet/Makefile.in.orig nmh-1.0/zotnet/Makefile.in
*** nmh-1.0/zotnet/Makefile.in.orig 1999/02/07 18:14:11
--- nmh-1.0/zotnet/Makefile.in 1999/02/11 18:54:44
***************
*** 15,21 ****
# flags passed to recursive makes in subdirectories
MAKEDEFS = CC='$(CC)' CPPFLAGS='$(CPPFLAGS)' DEFS='$(DEFS)' \
! CFLAGS='$(CFLAGS)' LDFLAGS='$(LDFLAGS)' LIBS='$(LIBS)' \
prefix='$(prefix)' exec_prefix='$(exec_prefix)' bindir='$(bindir)' \
etcdir='$(etcdir)' libdir='$(libdir)' mandir='$(mandir)' \
mailspool='$(mailspool)' sendmailpath='$(sendmailpath)' \
--- 15,21 ----
# flags passed to recursive makes in subdirectories
MAKEDEFS = CC='$(CC)' CPPFLAGS='$(CPPFLAGS)' DEFS='$(DEFS)' \
! CFLAGS='$(CFLAGS)' LDFLAGS='$(LDFLAGS)' LIBS='$(LIBS)' DESTDIR='$(DESTDIR)' \
prefix='$(prefix)' exec_prefix='$(exec_prefix)' bindir='$(bindir)' \
etcdir='$(etcdir)' libdir='$(libdir)' mandir='$(mandir)' \
mailspool='$(mailspool)' sendmailpath='$(sendmailpath)' \