diff options
| author | Steven Rostedt <srostedt@redhat.com> | 2010-06-09 17:12:33 -0400 |
|---|---|---|
| committer | Steven Rostedt <rostedt@goodmis.org> | 2010-06-09 17:12:33 -0400 |
| commit | d01b699fffc573e7653e00d608444735c04f9dca (patch) | |
| tree | 8acfd9965f918b5f7a74b834f09d0f27a12b7216 /Documentation | |
| parent | 1a6b5e8e4c95426d6803d320160f864f3dd87caf (diff) | |
build: Add DESTDIR to make
Add the variable DESTDIR that allows a user to install into
a directory that will later be moved to another host. This
facilitates the creation of distribution packages.
make DESTDIR=/tmp/build prefix=/usr install
Will install the program files into /tmp/build/usr/..
but the program will expect to find itself in the /usr/..
directories.
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Diffstat (limited to 'Documentation')
| -rw-r--r-- | Documentation/Makefile | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/Documentation/Makefile b/Documentation/Makefile index d161703..b7c17e7 100644 --- a/Documentation/Makefile +++ b/Documentation/Makefile | |||
| @@ -12,7 +12,7 @@ else | |||
| 12 | Q = @ | 12 | Q = @ |
| 13 | print_asciidoc = echo ' ASCIIDOC '`basename $@`; | 13 | print_asciidoc = echo ' ASCIIDOC '`basename $@`; |
| 14 | print_xsltproc = echo ' XSLTPROC '`basename $@`; | 14 | print_xsltproc = echo ' XSLTPROC '`basename $@`; |
| 15 | print_install = echo ' INSTALL '`basename $1`' to '$2; | 15 | print_install = echo ' INSTALL '`basename $1`' to $(DESTDIR_SQ)'$2; |
| 16 | hide_xsltproc_output = 2> /dev/null | 16 | hide_xsltproc_output = 2> /dev/null |
| 17 | endif | 17 | endif |
| 18 | 18 | ||
| @@ -69,21 +69,23 @@ MAN5 = $(patsubst %.5.txt,$(obj)/%.5, ${TEXT5}) | |||
| 69 | 69 | ||
| 70 | all: $(MAN1) $(MAN5) | 70 | all: $(MAN1) $(MAN5) |
| 71 | 71 | ||
| 72 | # Need to find out how to export a macro instead of | ||
| 73 | # copying this from the main Makefile. | ||
| 72 | define do_install | 74 | define do_install |
| 73 | $(print_install) \ | 75 | $(print_install) \ |
| 74 | if [ ! -d $2 ]; then \ | 76 | if [ ! -d '$(DESTDIR_SQ)$2' ]; then \ |
| 75 | $(INSTALL) -d -m 755 $2 ; \ | 77 | $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$2'; \ |
| 76 | fi; \ | 78 | fi; \ |
| 77 | $(INSTALL) $1 $2; | 79 | $(INSTALL) $1 '$(DESTDIR_SQ)$2' |
| 78 | endef | 80 | endef |
| 79 | 81 | ||
| 80 | MAN1_INSTALL = $(MAN1:%.1=%.1.install) | 82 | MAN1_INSTALL = $(MAN1:%.1=%.1.install) |
| 81 | MAN5_INSTALL = $(MAN5:%.5=%.5.install) | 83 | MAN5_INSTALL = $(MAN5:%.5=%.5.install) |
| 82 | 84 | ||
| 83 | $(MAN1_INSTALL): %.1.install : %.1 force | 85 | $(MAN1_INSTALL): %.1.install : %.1 force |
| 84 | $(Q)$(call do_install, $<, '$(man_dir_SQ)/man1') | 86 | $(Q)$(call do_install,$<,$(man_dir_SQ)/man1) |
| 85 | $(MAN5_INSTALL): %.5.install : %.5 force | 87 | $(MAN5_INSTALL): %.5.install : %.5 force |
| 86 | $(Q)$(call do_install, $<, '$(man_dir_SQ)/man5') | 88 | $(Q)$(call do_install,$<,$(man_dir_SQ)/man5) |
| 87 | 89 | ||
| 88 | install: $(MAN1_INSTALL) $(MAN5_INSTALL) | 90 | install: $(MAN1_INSTALL) $(MAN5_INSTALL) |
| 89 | 91 | ||
