Makefile: install manual page for endurance-extract-process-cgroups
[maemo-tools:sp-endurance.git] / Makefile
1 # build and install rules for endurance tools and scripts
2
3 CFLAGS ?= -O2 -Wall -g
4
5 # add some extra warnings
6 CFLAGS += -Wmissing-prototypes -Wstrict-prototypes -Wsign-compare\
7  -Wbad-function-cast -Wcast-qual -Wpointer-arith -Wshadow\
8  -Wwrite-strings -Wcast-align -W
9
10 BIN = measure/proc2csv measure/sp-noncached
11 SRC = Makefile src/proc2csv.c src/sp_noncached.c
12 MAN = endurance-mem-overview.1 \
13     endurance-plot.1 \
14     endurance-report.1 \
15     endurance-extract-process-smaps.1 \
16     endurance-parse-snapshots.1 \
17     endurance-recompress-snapshots.1 \
18     endurance-extract-process-cgroups.1 \
19     endurance-snapshot.1 \
20     endurance-split-snapshots.1 \
21     proc2csv.1 \
22     syslog_parse.py.1 \
23     sp-noncached.1
24     
25 ifeq ($(NO_X),)
26 BIN += measure/xmeminfo
27 SRC += src/xmeminfo.c
28 MAN += xmeminfo.1
29 endif
30 DOC = README
31
32 ALL = $(SRC) $(BIN) $(DOC) postproc-lib
33
34 .PHONY: all
35 all: $(ALL)
36
37 postproc-lib/Makefile:
38         cd postproc-lib && perl Makefile.PL
39
40 .PHONY: postproc-lib
41 postproc-lib: postproc-lib/Makefile
42         cd postproc-lib && $(MAKE)
43
44 measure/proc2csv: src/proc2csv.c
45         $(CC) $(CFLAGS) -o $@ $<
46
47 measure/xmeminfo: src/xmeminfo.c
48         $(CC) -I/usr/X11R6/include $(CFLAGS) -o $@ $< -lXRes -lX11
49
50 measure/sp-noncached: src/sp_noncached.c
51         $(CC) $(CFLAGS) -o $@ $<
52
53 .PHONY: clean
54 clean: 
55         $(RM) measure/proc2csv
56         $(RM) measure/xmeminfo
57         $(RM) measure/sp-noncached
58         [ ! -f postproc-lib/Makefile ] || $(MAKE) -C postproc-lib clean
59         $(RM) postproc-lib/Makefile.old
60         $(RM) man/endurance-recompress-snapshots.1
61         $(RM) man/endurance-extract-process-cgroups.1
62         $(RM) postproc/syslog_parse.pyc
63
64 .PHONY: test
65 test:
66         [ ! -f postproc-lib/Makefile ] || $(MAKE) -C postproc-lib test
67
68 mandir:
69         install -d $(DESTDIR)/usr/share/man/man1/
70         
71 endurance-recompress-snapshots.1: postproc/endurance-recompress-snapshots mandir
72         pod2man postproc/endurance-recompress-snapshots > man/$@
73         install -m 644 man/$@ $(DESTDIR)/usr/share/man/man1/
74
75 endurance-extract-process-cgroups.1: postproc/endurance-extract-process-cgroups mandir
76         pod2man postproc/endurance-extract-process-cgroups > man/$@
77         install -m 644 man/$@ $(DESTDIR)/usr/share/man/man1/
78
79 %.1: man/$@ mandir
80         install -m 644 man/$@ $(DESTDIR)/usr/share/man/man1/
81
82 DOCDIR ?= /usr/share/doc
83
84 .PHONY: install-measure
85 install-measure:
86         install -d $(DESTDIR)/usr/bin/
87         cp measure/* $(DESTDIR)/usr/bin/
88
89 .PHONY: install-postproc-lib
90 install-postproc-lib:
91         cd postproc-lib && $(MAKE) install DESTDIR=$(DESTDIR)
92
93 .PHONY: install-postproc
94 install-postproc:
95         install -d $(DESTDIR)/usr/bin/
96         cp postproc/* $(DESTDIR)/usr/bin/
97         install -d $(DESTDIR)/$(DOCDIR)/sp-endurance-postproc/
98         cp README $(DESTDIR)/$(DOCDIR)/sp-endurance-postproc/
99         cp doc/endurance.pdf $(DESTDIR)/$(DOCDIR)/sp-endurance-postproc/
100         install -d $(DESTDIR)/usr/share/sp-endurance-postproc/
101         cp -a syslog-parser-configurations/* $(DESTDIR)/usr/share/sp-endurance-postproc/
102
103 .PHONY: install-tests
104 install-tests:
105         install -d $(DESTDIR)/usr/share/sp-endurance-tests/
106         cp -a tests/* $(DESTDIR)/usr/share/sp-endurance-tests/
107
108 .PHONY: install-compat-symlinks
109 install-compat-symlinks:
110         install -d $(DESTDIR)/usr/bin/
111         ln -s -f endurance-extract-process-smaps   $(DESTDIR)/usr/bin/extract-endurance-process-smaps
112         ln -s -f endurance-extract-process-cgroups $(DESTDIR)/usr/bin/extract-endurance-process-cgroups
113         ln -s -f endurance-parse-snapshots         $(DESTDIR)/usr/bin/parse-endurance-measurements
114         ln -s -f endurance-plot                    $(DESTDIR)/usr/bin/endurance_plot
115         ln -s -f endurance-recompress-snapshots    $(DESTDIR)/usr/bin/recompress-endurance-measurements
116         ln -s -f endurance-report                  $(DESTDIR)/usr/bin/endurance_report.py
117         ln -s -f endurance-snapshot                $(DESTDIR)/usr/bin/save-incremental-endurance-stats
118         ln -s -f endurance-split-snapshots         $(DESTDIR)/usr/bin/split-endurance-measurements
119
120 .PHONY: install
121 install: $(MAN) install-measure install-postproc-lib install-postproc install-tests