diff options
-rw-r--r-- | Documentation/Makefile | 24 | ||||
-rw-r--r-- | Makefile | 7 |
2 files changed, 29 insertions, 2 deletions
diff --git a/Documentation/Makefile b/Documentation/Makefile index 4644dc5..d5785bf 100644 --- a/Documentation/Makefile +++ b/Documentation/Makefile | |||
@@ -6,11 +6,13 @@ ifeq ($(VERBOSE),1) | |||
6 | Q = | 6 | Q = |
7 | print_asciidoc = | 7 | print_asciidoc = |
8 | print_xsltproc = | 8 | print_xsltproc = |
9 | print_install = | ||
9 | hide_xsltproc_output = | 10 | hide_xsltproc_output = |
10 | else | 11 | else |
11 | Q = @ | 12 | Q = @ |
12 | print_asciidoc = echo ' ASCIIDOC '`basename $@`; | 13 | print_asciidoc = echo ' ASCIIDOC '`basename $@`; |
13 | print_xsltproc = echo ' XSLTPROC '`basename $@`; | 14 | print_xsltproc = echo ' XSLTPROC '`basename $@`; |
15 | print_install = echo ' INSTALL '`basename $1`' to '$2; | ||
14 | hide_xsltproc_output = 2> /dev/null | 16 | hide_xsltproc_output = 2> /dev/null |
15 | endif | 17 | endif |
16 | 18 | ||
@@ -49,11 +51,29 @@ $(obj)/%.1: $(obj)/%.xsl | |||
49 | 51 | ||
50 | TEXT = $(wildcard *.txt) | 52 | TEXT = $(wildcard *.txt) |
51 | XML = $(patsubst %.txt,$(obj)/%.xsl, ${TEXT}) | 53 | XML = $(patsubst %.txt,$(obj)/%.xsl, ${TEXT}) |
52 | MAN = $(patsubst %.txt,$(obj)/%.1, ${TEXT}) | 54 | MAN1 = $(patsubst %.txt,$(obj)/%.1, ${TEXT}) |
53 | 55 | ||
54 | all: ${MAN} | 56 | all: $(MAN1) |
55 | 57 | ||
56 | 58 | ||
59 | define do_install | ||
60 | $(print_install) \ | ||
61 | if [ ! -d $2 ]; then \ | ||
62 | $(INSTALL) -d -m 755 $2 ; \ | ||
63 | fi; \ | ||
64 | $(INSTALL) $1 $2; | ||
65 | endef | ||
66 | |||
67 | MAN1_INSTALL = $(subst .1,.install,$(MAN1)) | ||
68 | |||
69 | $(MAN1_INSTALL): %.install : %.1 force | ||
70 | $(Q)$(call do_install, $<, '$(man_dir_SQ)/man1') | ||
71 | |||
72 | install: $(MAN1_INSTALL) | ||
73 | |||
57 | clean: | 74 | clean: |
58 | (cd $(obj); \ | 75 | (cd $(obj); \ |
59 | $(RM) *.xml *.xsl *.1) | 76 | $(RM) *.xml *.xsl *.1) |
77 | |||
78 | .PHONE: force | ||
79 | force: \ No newline at end of file | ||
@@ -21,6 +21,10 @@ INSTALL = install | |||
21 | prefix ?= /usr/local | 21 | prefix ?= /usr/local |
22 | bindir_relative = bin | 22 | bindir_relative = bin |
23 | bindir = $(prefix)/$(bindir_relative) | 23 | bindir = $(prefix)/$(bindir_relative) |
24 | man_dir = $(prefix)/share/man | ||
25 | man_dir_SQ = '$(subst ','\'',$(man_dir))' | ||
26 | |||
27 | export man_dir man_dir_SQ INSTALL | ||
24 | 28 | ||
25 | ifeq ($(prefix),$(HOME)) | 29 | ifeq ($(prefix),$(HOME)) |
26 | plugin_dir = $(HOME)/.trace-cmd/plugins | 30 | plugin_dir = $(HOME)/.trace-cmd/plugins |
@@ -424,6 +428,9 @@ doc: | |||
424 | doc_clean: | 428 | doc_clean: |
425 | $(MAKE) -C $(src)/Documentation clean | 429 | $(MAKE) -C $(src)/Documentation clean |
426 | 430 | ||
431 | install_doc: | ||
432 | $(MAKE) -C $(src)/Documentation install | ||
433 | |||
427 | clean: | 434 | clean: |
428 | $(RM) *.o *~ $(TARGETS) *.a *.so ctracecmd_wrap.c .*.d | 435 | $(RM) *.o *~ $(TARGETS) *.a *.so ctracecmd_wrap.c .*.d |
429 | $(RM) tags TAGS trace_plugin_dir | 436 | $(RM) tags TAGS trace_plugin_dir |