summaryrefslogtreecommitdiffstats
path: root/Makefile.am
blob: 55c5e41a4890bb3577d60f4a9fdb6c7ca368564a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
# Makefile for libvirt python library

## Copyright (C) 2005-2012 Red Hat, Inc.
## See COPYING.LIB for the License of this software

SUBDIRS= . tests

INCLUDES = \
	$(PYTHON_INCLUDES) \
	-I$(top_builddir)/gnulib/lib \
	-I$(top_srcdir)/gnulib/lib \
	-I$(top_builddir)/src \
	-I$(top_srcdir)/src \
	-I$(top_srcdir)/src/util \
	-I$(top_builddir)/include \
	-I$(top_srcdir)/include \
	$(GETTEXT_CPPFLAGS)

AM_CFLAGS = $(WARN_CFLAGS)

DOCS_DIR = $(datadir)/doc/libvirt-python-$(VERSION)

DOCS = ${srcdir}/TODO

CLASSES_EXTRA = \
	libvirt-override-virConnect.py \
	libvirt-override-virDomain.py \
	libvirt-override-virDomainSnapshot.py \
	libvirt-override-virStream.py

EXTRA_DIST =			\
	generator.py		\
	typewrappers.c		\
	typewrappers.h		\
	libvirt-override.c	\
	libvirt-override.py	\
	libvirt-override-api.xml \
	libvirt-lxc-override.c	\
	libvirt-lxc-override-api.xml \
	libvirt-qemu-override.c	\
	libvirt-qemu-override-api.xml \
	$(CLASSES_EXTRA) \
	$(DOCS)

if WITH_PYTHON
mylibs = \
	$(top_builddir)/src/libvirt.la \
	$(top_builddir)/gnulib/lib/libgnu.la
myqemulibs = \
	$(top_builddir)/src/libvirt-qemu.la \
	$(top_builddir)/gnulib/lib/libgnu.la
mylxclibs = \
	$(top_builddir)/src/libvirt-lxc.la \
	$(top_builddir)/gnulib/lib/libgnu.la

all-local: libvirt.py libvirt_qemu.py libvirt_lxc.py

pyexec_LTLIBRARIES = libvirtmod.la libvirtmod_qemu.la libvirtmod_lxc.la

libvirtmod_la_SOURCES = libvirt-override.c typewrappers.c
nodist_libvirtmod_la_SOURCES = libvirt.c libvirt.h
# Python <= 2.4 header files contain a redundant decl, hence we
# need extra flags here
libvirtmod_la_CFLAGS = $(WARN_CFLAGS) $(WARN_PYTHON_CFLAGS)

libvirtmod_la_LDFLAGS = -module -avoid-version -shared -L$(top_builddir)/src/.libs \
	$(CYGWIN_EXTRA_LDFLAGS)
libvirtmod_la_LIBADD = $(mylibs) \
	$(CYGWIN_EXTRA_LIBADD) $(CYGWIN_EXTRA_PYTHON_LIBADD)

libvirtmod_qemu_la_SOURCES = libvirt-qemu-override.c typewrappers.c
nodist_libvirtmod_qemu_la_SOURCES = libvirt-qemu.c libvirt-qemu.h
# Python <= 2.4 header files contain a redundant decl, hence we
# need extra flags here
libvirtmod_qemu_la_CFLAGS = $(WARN_PYTHON_CFLAGS)

libvirtmod_qemu_la_LDFLAGS = -module -avoid-version -shared -L$(top_builddir)/src/.libs \
	$(CYGWIN_EXTRA_LDFLAGS)
libvirtmod_qemu_la_LIBADD = $(myqemulibs) \
	$(CYGWIN_EXTRA_LIBADD) $(CYGWIN_EXTRA_PYTHON_LIBADD)

libvirtmod_lxc_la_SOURCES = libvirt-lxc-override.c typewrappers.c
nodist_libvirtmod_lxc_la_SOURCES = libvirt-lxc.c libvirt-lxc.h
# Python <= 2.4 header files contain a redundant decl, hence we
# need extra flags here
libvirtmod_lxc_la_CFLAGS = $(WARN_PYTHON_CFLAGS)

libvirtmod_lxc_la_LDFLAGS = -module -avoid-version -shared -L$(top_builddir)/src/.libs \
	$(CYGWIN_EXTRA_LDFLAGS)
libvirtmod_lxc_la_LIBADD = $(mylxclibs) \
	$(CYGWIN_EXTRA_LIBADD) $(CYGWIN_EXTRA_PYTHON_LIBADD)

GENERATE = generator.py
API_DESC = $(top_srcdir)/docs/libvirt-api.xml $(srcdir)/libvirt-override-api.xml
GENERATED= libvirt-export.c \
	   libvirt.c \
	   libvirt.h \
	   libvirt.py

QEMU_API_DESC = $(top_srcdir)/docs/libvirt-qemu-api.xml $(srcdir)/libvirt-qemu-override-api.xml
QEMU_GENERATED= libvirt-qemu-export.c \
	   libvirt-qemu.c \
	   libvirt-qemu.h \
	   libvirt_qemu.py

LXC_API_DESC = $(top_srcdir)/docs/libvirt-lxc-api.xml $(srcdir)/libvirt-lxc-override-api.xml
LXC_GENERATED= libvirt-lxc-export.c \
	   libvirt-lxc.c \
	   libvirt-lxc.h \
	   libvirt_lxc.py

$(GENERATE).stamp: $(srcdir)/$(GENERATE) $(API_DESC) $(QEMU_API_DESC) $(LXC_API_DESC)
	$(AM_V_GEN)$(PYTHON) $(srcdir)/$(GENERATE) $(PYTHON) && \
	touch $@

$(GENERATED) $(QEMU_GENERATED) $(LXC_GENERATED): $(GENERATE).stamp

$(libvirtmod_la_OBJECTS): $(GENERATED)
$(libvirtmod_qemu_la_OBJECTS): $(QEMU_GENERATED)
$(libvirtmod_lxc_la_OBJECTS): $(LXC_GENERATED)

EXTRA_DIST += sanitytest.py

check-local:
	$(AM_V_GEN)../run $(PYTHON) $(srcdir)/sanitytest.py

install-data-local:
	$(mkinstalldirs) $(DESTDIR)$(pyexecdir)
	$(INSTALL) -m 0644 libvirt.py $(DESTDIR)$(pyexecdir)
	$(INSTALL) -m 0644 libvirt_lxc.py $(DESTDIR)$(pyexecdir)
	$(INSTALL) -m 0644 libvirt_qemu.py $(DESTDIR)$(pyexecdir)
	$(mkinstalldirs) $(DESTDIR)$(DOCS_DIR)
	@(for doc in $(DOCS) ; \
	   do $(INSTALL) -m 0644 $$doc $(DESTDIR)$(DOCS_DIR) ; done)

uninstall-local:
	rm -f $(DESTDIR)$(pyexecdir)/libvirt.py
	rm -f $(DESTDIR)$(pyexecdir)/libvirt_lxc.py
	rm -f $(DESTDIR)$(pyexecdir)/libvirt_qemu.py

CLEANFILES= $(GENERATED) $(QEMU_GENERATED) $(LXC_GENERATED) $(GENERATE).stamp

else
all:
endif

dummy:

tests test: all dummy
	-@(cd tests && $(MAKE) MAKEFLAGS+=--silent tests)