"make install" et al
authorH. Peter Anvin <hpa@zytor.com>
Fri, 11 Jan 2008 05:58:16 +0000 (21:58 -0800)
committerH. Peter Anvin <hpa@zytor.com>
Fri, 11 Jan 2008 05:58:16 +0000 (21:58 -0800)
MCONFIG.in
Makefile
configure.in

index d46ca5d..298528b 100644 (file)
@@ -1,3 +1,25 @@
+prefix                 = @prefix@
+exec_prefix            = @exec_prefix@
+
+# Directory for user binaries
+bindir                 = @bindir@
+
+# Man page tree
+mandir                 = @mandir@
+
+# System binaries
+sbindir                = @sbindir@
+
+# Install into chroot area
+# Useful when making rpms and similar
+INSTALLROOT            =
+
+# Install program
+INSTALL                = @INSTALL@
+INSTALL_PROGRAM        = @INSTALL_PROGRAM@
+INSTALL_DATA           = @INSTALL_DATA@
+MKDIR_P                        = @MKDIR_P@
+
 CC                     = @CC@
 CFLAGS                 = @CFLAGS@
 LDFLAGS                        = @LDFLAGS@
index 1ae7159..248c3f6 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -29,6 +29,18 @@ reloc.o: reloc.S reloc/reloc.bin
 wraplinux: main.o linux.o reloc.o elf.o nbi.o segment.o mapfile.o xmalloc.o
        $(CC) $(LDFLAGS) -o $@ $^
 
+#
+# Install
+#
+install: all
+       $(MKDIR_P) $(INSTALLROOT)$(bindir)
+       $(INSTALL_PROGRAM) wraplinux $(INSTALLROOT)$(bindir)
+       $(MKDIR_P) $(INSTALLROOT)$(mandir)/man1
+       $(INSTALL_DATA) wraplinux.1 $(INSTALLROOT)$(mandir)/man1
+
+#
+# Cleanup
+#
 clean:
        rm -f wraplinux *.o reloc/*.o reloc/*.bin reloc/*.elf
 
@@ -41,6 +53,9 @@ distclean: cleaner
 spotless: distclean
        rm -rf configure config.h.in wraplinux.spec
 
+#
+# Prepare a release
+#
 release:
        $(MAKE) depend
        $(MAKE) spec
index 8ca0269..7a00e8d 100644 (file)
@@ -41,6 +41,7 @@ AH_TEMPLATE([HAVE_GETOPT_LONG],
 AC_PROG_SED
 AC_PROG_RANLIB
 AC_PROG_INSTALL
+AC_PROG_MKDIR_P
 
 AC_CONFIG_HEADER(config.h)
 AC_OUTPUT(MCONFIG)