Make extlib an optional dependency.
[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_extlib      = @pkg_extlib@
24 pkg_lablgtk2    = @pkg_lablgtk2@
25 pkg_curses      = @pkg_curses@
26 pkg_xml_light   = @pkg_xml_light@
27
28 OCAMLDOCFLAGS   := -html -sort
29
30 SUBDIRS         := libvirt examples
31
32 ifeq ($(pkg_extlib),yes)
33 SUBDIRS         += mlvirsh
34 endif
35
36 ifeq ($(pkg_lablgtk2),yes)
37 SUBDIRS         += mlvirtmanager
38 endif
39
40 ifeq ($(pkg_extlib)$(pkg_curses),yesyes)
41 SUBDIRS         += virt-top
42 endif
43
44 ifeq ($(pkg_extlib)$(pkg_xml_light),yesyes)
45 SUBDIRS         += virt-df
46 endif
47
48 all opt depend install:
49         for d in $(SUBDIRS); do \
50           $(MAKE) -C $$d $@; \
51           if [ $$? -ne 0 ]; then exit 1; fi; \
52         done
53
54 clean:
55         for d in . $(SUBDIRS); do \
56           (cd $$d; rm -f *.cmi *.cmo *.cmx *.cma *.cmxa *.o *.a *.so *.opt *~ core); \
57         done
58         rm -f examples/list_domains
59         rm -f mlvirsh/mlvirsh
60         rm -f mlvirtmanager/mlvirtmanager
61         rm -f virt-top/virt-top
62         rm -f virt-df/virt-df
63
64 distclean: clean
65         rm -f config.h config.log config.status configure
66         rm -rf autom4te.cache
67         rm -f META
68         rm -f libvirt/libvirt_version.ml
69         rm -f Makefile
70         rm -f libvirt/Makefile
71         rm -f examples/Makefile
72         rm -f mlvirsh/Makefile
73         rm -f mlvirtmanager/Makefile
74         rm -f virt-top/Makefile
75         rm -f virt-df/Makefile
76
77 # Developer documentation (in html/ subdirectory).
78
79 doc:
80         rm -rf html
81         mkdir html
82         -cd libvirt; \
83         ocamlfind ocamldoc $(OCAMLDOCFLAGS) -d ../html \
84           libvirt.{ml,mli} libvirt_version.{ml,mli}
85
86 # Update configure and rerun.
87
88 configure: force
89         autoreconf
90         CFLAGS=-g \
91           ./configure \
92           --enable-debug=yes --with-libvirt=/home/rjones/local
93
94 # Distribution.
95
96 dist:
97         $(MAKE) check-manifest
98         rm -rf $(PACKAGE)-$(VERSION)
99         mkdir $(PACKAGE)-$(VERSION)
100         tar -cf - -T MANIFEST | tar -C $(PACKAGE)-$(VERSION) -xf -
101         $(INSTALL) -m 0755 configure $(PACKAGE)-$(VERSION)/
102         tar zcf $(PACKAGE)-$(VERSION).tar.gz $(PACKAGE)-$(VERSION)
103         rm -rf $(PACKAGE)-$(VERSION)
104         ls -l $(PACKAGE)-$(VERSION).tar.gz
105
106 check-manifest:
107         hg manifest | sort > .check-manifest; \
108         sort MANIFEST > .orig-manifest; \
109         diff -u .orig-manifest .check-manifest; rv=$$?; \
110         rm -f .orig-manifest .check-manifest; \
111         exit $$rv
112
113 # Do a release (update the website).
114
115 release: configure
116         $(MAKE) release_stage_2
117
118 release_stage_2: clean all opt doc dist
119         $(MAKE) release_stage_3
120
121 WEBSITE = ../redhat/websites
122
123 release_stage_3:
124         rm -f $(WEBSITE)/ocaml-libvirt/html/*.{html,css}
125         cp html/*.{html,css} $(WEBSITE)/ocaml-libvirt/html/
126         cp README $(WEBSITE)/ocaml-libvirt/README.txt
127         cp ChangeLog $(WEBSITE)/ocaml-libvirt/ChangeLog.txt
128 #       cp virt-top/virt-top.txt $(WEBSITE)/virt-top/
129 #       cp ChangeLog $(WEBSITE)/virt-top/ChangeLog.txt
130
131 # Upload to main website.
132
133 upload:
134         cd $(WEBSITE)/ocaml-libvirt && \
135         scp ChangeLog.txt index.html README.txt Screenshot*.png \
136           libvirt.org:/data/www/libvirt.org/ocaml && \
137         scp css/*.css \
138           libvirt.org:/data/www/libvirt.org/ocaml/css/ && \
139         scp html/*.html html/*.css \
140           libvirt.org:/data/www/libvirt.org/ocaml/html/
141         scp $(PACKAGE)-$(VERSION).tar.gz libvirt.org:/data/ftp/libvirt/ocaml/
142
143 force:
144
145 .PHONY: all opt depend install clean distclean configure dist check-manifest \
146         release release_stage_2 release_stage_3 force