maint: consistent whitespace after 'if'
[libvirt-python/ericb.git] / Makefile.am
blob97f21c387acaaef630f8d4d97ed1fe9b0ee08379
1 # Makefile for libvirt python library
3 ## Copyright (C) 2005-2012 Red Hat, Inc.
4 ## See COPYING.LIB for the License of this software
6 SUBDIRS= . tests
8 INCLUDES = \
9         $(PYTHON_INCLUDES) \
10         -I$(top_builddir)/gnulib/lib \
11         -I$(top_srcdir)/gnulib/lib \
12         -I$(top_builddir)/src \
13         -I$(top_srcdir)/src \
14         -I$(top_srcdir)/src/util \
15         -I$(top_builddir)/include \
16         -I$(top_srcdir)/include \
17         $(GETTEXT_CPPFLAGS)
19 AM_CFLAGS = $(WARN_CFLAGS)
21 DOCS_DIR = $(datadir)/doc/libvirt-python-$(VERSION)
23 DOCS = ${srcdir}/TODO
25 CLASSES_EXTRA = \
26         libvirt-override-virConnect.py \
27         libvirt-override-virDomain.py \
28         libvirt-override-virDomainSnapshot.py \
29         libvirt-override-virStream.py
31 EXTRA_DIST =                    \
32         generator.py            \
33         typewrappers.c          \
34         typewrappers.h          \
35         libvirt-override.c      \
36         libvirt-override.py     \
37         libvirt-override-api.xml \
38         libvirt-qemu-override.c \
39         libvirt-qemu-override-api.xml \
40         $(CLASSES_EXTRA) \
41         $(DOCS)
43 if WITH_PYTHON
44 mylibs = \
45         $(top_builddir)/src/libvirt.la \
46         $(top_builddir)/gnulib/lib/libgnu.la
47 myqemulibs = \
48         $(top_builddir)/src/libvirt-qemu.la \
49         $(top_builddir)/gnulib/lib/libgnu.la
51 all-local: libvirt.py libvirt_qemu.py
53 pyexec_LTLIBRARIES = libvirtmod.la libvirtmod_qemu.la
55 libvirtmod_la_SOURCES = libvirt-override.c typewrappers.c
56 nodist_libvirtmod_la_SOURCES = libvirt.c libvirt.h
57 # Python <= 2.4 header files contain a redundant decl, hence we
58 # need extra flags here
59 libvirtmod_la_CFLAGS = $(WARN_CFLAGS) $(WARN_PYTHON_CFLAGS)
61 libvirtmod_la_LDFLAGS = -module -avoid-version -shared -L$(top_builddir)/src/.libs \
62         $(CYGWIN_EXTRA_LDFLAGS)
63 libvirtmod_la_LIBADD = $(mylibs) \
64         $(CYGWIN_EXTRA_LIBADD) $(CYGWIN_EXTRA_PYTHON_LIBADD)
66 libvirtmod_qemu_la_SOURCES = libvirt-qemu-override.c typewrappers.c
67 nodist_libvirtmod_qemu_la_SOURCES = libvirt-qemu.c libvirt-qemu.h
68 # Python <= 2.4 header files contain a redundant decl, hence we
69 # need extra flags here
70 libvirtmod_qemu_la_CFLAGS = $(WARN_PYTHON_CFLAGS)
72 libvirtmod_qemu_la_LDFLAGS = -module -avoid-version -shared -L$(top_builddir)/src/.libs \
73         $(CYGWIN_EXTRA_LDFLAGS)
74 libvirtmod_qemu_la_LIBADD = $(myqemulibs) \
75         $(CYGWIN_EXTRA_LIBADD) $(CYGWIN_EXTRA_PYTHON_LIBADD)
77 GENERATE = generator.py
78 API_DESC = $(top_srcdir)/docs/libvirt-api.xml $(srcdir)/libvirt-override-api.xml
79 GENERATED= libvirt-export.c \
80            libvirt.c \
81            libvirt.h \
82            libvirt.py
84 QEMU_API_DESC = $(top_srcdir)/docs/libvirt-qemu-api.xml $(srcdir)/libvirt-qemu-override-api.xml
85 QEMU_GENERATED= libvirt-qemu-export.c \
86            libvirt-qemu.c \
87            libvirt-qemu.h \
88            libvirt_qemu.py
90 $(GENERATE).stamp: $(srcdir)/$(GENERATE) $(API_DESC) $(QEMU_API_DESC)
91         $(AM_V_GEN)$(PYTHON) $(srcdir)/$(GENERATE) $(PYTHON) && \
92         touch $@
94 $(GENERATED) $(QEMU_GENERATED): $(GENERATE).stamp
96 $(libvirtmod_la_OBJECTS): $(GENERATED)
97 $(libvirtmod_qemu_la_OBJECTS): $(QEMU_GENERATED)
99 install-data-local:
100         $(mkinstalldirs) $(DESTDIR)$(pyexecdir)
101         $(INSTALL) -m 0644 libvirt.py $(DESTDIR)$(pyexecdir)
102         $(INSTALL) -m 0644 libvirt_qemu.py $(DESTDIR)$(pyexecdir)
103         $(mkinstalldirs) $(DESTDIR)$(DOCS_DIR)
104         @(for doc in $(DOCS) ; \
105            do $(INSTALL) -m 0644 $$doc $(DESTDIR)$(DOCS_DIR) ; done)
107 uninstall-local:
108         rm -f $(DESTDIR)$(pyexecdir)/libvirt.py
109         rm -f $(DESTDIR)$(pyexecdir)/libvirt_qemu.py
111 CLEANFILES= $(GENERATED) $(QEMU_GENERATED) $(GENERATE).stamp
113 else
114 all:
115 endif
117 dummy:
119 tests test: all dummy
120         -@(cd tests && $(MAKE) MAKEFLAGS+=--silent tests)