1db3843169af868a85d5693f627bcced7220a3b1
[virt-top.git] / Makefile.in
1 # ocaml-libvirt
2 # Copyright (C) 2007 Red Hat Inc., Richard W.M. Jones
3 #
4 # This library is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU Lesser General Public
6 # License as published by the Free Software Foundation; either
7 # version 2 of the License, or (at your option) any later version.
8 #
9 # This library is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12 # Lesser General Public License for more details.
13 #
14 # You should have received a copy of the GNU Lesser General Public
15 # License along with this library; if not, write to the Free Software
16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA
17
18 PACKAGE         = @PACKAGE_NAME@
19 VERSION         = @PACKAGE_VERSION@
20
21 INSTALL         = @INSTALL@
22
23 pkg_lablgtk2    = @pkg_lablgtk2@
24 pkg_curses      = @pkg_curses@
25 pkg_xml_light   = @pkg_xml_light@
26
27 OCAMLDOCFLAGS   := -html -sort
28
29 SUBDIRS         := libvirt examples mlvirsh
30
31 ifeq ($(pkg_lablgtk2),yes)
32 SUBDIRS         += mlvirtmanager
33 endif
34
35 ifeq ($(pkg_curses),yes)
36 SUBDIRS         += virt-top
37 endif
38
39 ifeq ($(pkg_xml_light),yes)
40 SUBDIRS         += virt-df
41 endif
42
43 all opt depend install:
44         for d in $(SUBDIRS); do \
45           $(MAKE) -C $$d $@; \
46           if [ $$? -ne 0 ]; then exit 1; fi; \
47         done
48
49 clean:
50         for d in . $(SUBDIRS); do \
51           (cd $$d; rm -f *.cmi *.cmo *.cmx *.cma *.cmxa *.o *.a *.so *.opt *~ core); \
52         done
53         rm -f examples/list_domains
54         rm -f mlvirsh/mlvirsh
55         rm -f mlvirtmanager/mlvirtmanager
56         rm -f virt-top/virt-top
57
58 distclean: clean
59         rm -f config.h config.log config.status configure
60         rm -rf autom4te.cache
61         rm -f META
62         rm -f libvirt/libvirt_version.ml
63         rm -f Makefile
64         rm -f libvirt/Makefile
65         rm -f examples/Makefile
66         rm -f mlvirsh/Makefile
67         rm -f mlvirtmanager/Makefile
68         rm -f virt-top/Makefile
69         rm -f virt-df/Makefile
70
71 # Developer documentation (in html/ subdirectory).
72
73 doc:
74         rm -rf html
75         mkdir html
76         -cd libvirt; \
77         ocamlfind ocamldoc $(OCAMLDOCFLAGS) -d ../html \
78           libvirt.{ml,mli} libvirt_version.{ml,mli}
79
80 # Update configure and rerun.
81
82 configure: force
83         autoreconf
84         CFLAGS=-g \
85           ./configure \
86           --enable-debug=yes --with-libvirt=/home/rjones/local
87
88 # Distribution.
89
90 dist:
91         $(MAKE) check-manifest
92         rm -rf $(PACKAGE)-$(VERSION)
93         mkdir $(PACKAGE)-$(VERSION)
94         tar -cf - -T MANIFEST | tar -C $(PACKAGE)-$(VERSION) -xf -
95         $(INSTALL) -m 0755 configure $(PACKAGE)-$(VERSION)/
96         tar zcf $(PACKAGE)-$(VERSION).tar.gz $(PACKAGE)-$(VERSION)
97         rm -rf $(PACKAGE)-$(VERSION)
98         ls -l $(PACKAGE)-$(VERSION).tar.gz
99
100 check-manifest:
101         hg manifest | sort > .check-manifest; \
102         sort MANIFEST > .orig-manifest; \
103         diff -u .orig-manifest .check-manifest; rv=$$?; \
104         rm -f .orig-manifest .check-manifest; \
105         exit $$rv
106
107 # Do a release (update the website).
108
109 release: configure
110         $(MAKE) release_stage_2
111
112 release_stage_2: clean all opt doc dist
113         $(MAKE) release_stage_3
114
115 WEBSITE = ../redhat/websites
116
117 release_stage_3:
118         rm -f $(WEBSITE)/ocaml-libvirt/html/*.{html,css}
119         cp html/*.{html,css} $(WEBSITE)/ocaml-libvirt/html/
120         cp README $(WEBSITE)/ocaml-libvirt/README.txt
121         cp ChangeLog $(WEBSITE)/ocaml-libvirt/ChangeLog.txt
122 #       cp virt-top/virt-top.txt $(WEBSITE)/virt-top/
123 #       cp ChangeLog $(WEBSITE)/virt-top/ChangeLog.txt
124
125 # Upload to main website.
126
127 upload:
128         cd $(WEBSITE)/ocaml-libvirt && \
129         scp ChangeLog.txt index.html README.txt Screenshot*.png \
130           libvirt.org:/data/www/libvirt.org/ocaml && \
131         scp css/*.css \
132           libvirt.org:/data/www/libvirt.org/ocaml/css/ && \
133         scp html/*.html html/*.css \
134           libvirt.org:/data/www/libvirt.org/ocaml/html/
135         scp $(PACKAGE)-$(VERSION).tar.gz libvirt.org:/data/ftp/libvirt/ocaml/
136
137 force:
138
139 .PHONY: all opt depend install clean distclean configure dist check-manifest \
140         release release_stage_2 release_stage_3 force