cca638845d968cc7e4082328ee305efbd974905b
[virt-mem.git] / Makefile.in
1 # virt-mem
2 # @configure_input@
3 # Copyright (C) 2008 Red Hat Inc., Richard W.M. Jones
4 #
5 # This library is free software; you can redistribute it and/or
6 # modify it under the terms of the GNU Lesser General Public
7 # License as published by the Free Software Foundation; either
8 # version 2 of the License, or (at your option) any later version.
9 #
10 # This library is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13 # Lesser General Public License for more details.
14 #
15 # You should have received a copy of the GNU Lesser General Public
16 # License along with this library; if not, write to the Free Software
17 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA
18
19 PACKAGE         = @PACKAGE_NAME@
20 VERSION         = @PACKAGE_VERSION@
21
22 INSTALL         = @INSTALL@
23 MKDIR_P         = @MKDIR_P@
24 datarootdir     = @datarootdir@
25 mandir          = @mandir@
26
27 HAVE_PERLDOC    = @HAVE_PERLDOC@
28
29 TOOLS           = uname dmesg ps
30 export TOOLS
31
32 SUBDIRS_NOT_PO  = lib $(TOOLS) mem
33 SUBDIRS         = $(SUBDIRS_NOT_PO) po
34
35 ifeq ($(HAVE_PERLDOC),perldoc)
36 MANPAGES        = virt-mem.1 $(TOOLS:%=virt-%.1)
37 TEXTMANPAGES    = virt-mem.txt
38 endif
39
40 TARGETS         = $(MANPAGES) $(TEXTMANPAGES)
41
42 all: $(TARGETS)
43         for d in $(SUBDIRS); do \
44           $(MAKE) -C $$d $@; \
45           if [ $$? -ne 0 ]; then exit 1; fi; \
46         done
47
48 install: install-man
49         for d in $(SUBDIRS); do \
50           $(MAKE) -C $$d $@; \
51           if [ $$? -ne 0 ]; then exit 1; fi; \
52         done
53
54 depend doc:
55         for d in $(SUBDIRS_NOT_PO); do \
56           $(MAKE) -C $$d $@; \
57           if [ $$? -ne 0 ]; then exit 1; fi; \
58         done
59
60 clean:
61         for d in . $(SUBDIRS); do \
62           (cd $$d; rm -f *.cmi *.cmo *.cmx *.cma *.cmxa *.o *.a \
63             *.so *.opt *~ *.dll *.exe *.annot core); \
64         done
65         rm -f uname/virt-uname
66         rm -f dmesg/virt-dmesg
67         rm -f ps/virt-ps
68         rm -f mem/virt-mem
69
70 distclean: clean
71         rm -f config.h config.log config.status configure
72         rm -rf autom4te.cache
73         rm -f Makefile
74         rm -f */Makefile
75
76 # Manual page.
77
78 ifeq ($(HAVE_PERLDOC),perldoc)
79 virt-mem.1: virt-mem.pod
80         pod2man -c "Virtualization Support" --release "$(PACKAGE)-$(VERSION)" \
81           $< > $@
82
83 virt-mem.txt: virt-mem.pod
84         pod2text $< > $@
85
86 virt-%.1:
87         echo '.so man1/virt-mem.1' > $@
88
89 install-man:
90         $(MKDIR_P) $(DESTDIR)$(mandir)/man1
91         $(INSTALL) -m 0644 $(MANPAGES) $(DESTDIR)$(mandir)/man1/
92
93 else
94
95 install-man:
96
97 endif
98
99 # Distribution.
100
101 dist:
102         $(MAKE) check-manifest
103         rm -rf $(PACKAGE)-$(VERSION)
104         mkdir $(PACKAGE)-$(VERSION)
105         tar -cf - -T MANIFEST | tar -C $(PACKAGE)-$(VERSION) -xf -
106         hg log --style changelog > $(PACKAGE)-$(VERSION)/ChangeLog
107         $(INSTALL) -m 0755 configure $(PACKAGE)-$(VERSION)/
108         $(INSTALL) -m 0644 config.h.in $(PACKAGE)-$(VERSION)/
109         tar zcf $(PACKAGE)-$(VERSION).tar.gz $(PACKAGE)-$(VERSION)
110         rm -rf $(PACKAGE)-$(VERSION)
111         ls -l $(PACKAGE)-$(VERSION).tar.gz
112
113 check-manifest:
114         hg manifest | sort > .check-manifest; \
115         sort MANIFEST > .orig-manifest; \
116         diff -u .orig-manifest .check-manifest; rv=$$?; \
117         rm -f .orig-manifest .check-manifest; \
118         exit $$rv
119
120 .PHONY: all opt depend install clean distclean configure dist check-manifest \
121         release release_stage_2 release_stage_3 force