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