summaryrefslogtreecommitdiffstats
path: root/Makefile.am
blob: a7c342e7cf74109e3eda624b695b9b0fd7c6ef2d (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
# Makefile for libvirt python library

SUBDIRS= . tests

INCLUDES = \
        $(WARN_CFLAGS) \
        -I$(PYTHON_INCLUDES) \
	-I$(top_srcdir)/include \
	-I$(top_builddir)/include \
	-I$(top_builddir)/$(subdir)

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

DOCS = ${srcdir}/TODO

CLASSES_EXTRA = virConnect.py

EXTRA_DIST =		\
	libvir.c	\
	types.c		\
	generator.py	\
	libvirt_wrap.h	\
	libvirt.py	\
	libvir.py	\
	libvirt-python-api.xml \
	$(CLASSES_EXTRA) \
	$(DOCS)

if WITH_PYTHON
mylibs = $(top_builddir)/src/libvirt.la

all-local: libvirt.py

python_LTLIBRARIES = libvirtmod.la

libvirtmod_la_SOURCES = libvir.c types.c libvirt-py.c libvirt-py.h
# Python <= 2.4 header files contain a redundant decl, hence we
# need extra flags here
libvirtmod_la_CFLAGS = @WARN_PYTHON_CFLAGS@

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

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

generated.stamp: $(srcdir)/$(GENERATE) $(API_DESC)
	$(PYTHON) $(srcdir)/$(GENERATE) $(srcdir)
	touch $@

$(GENERATED): generated.stamp

libvirt.py: $(srcdir)/libvir.py $(GENERATED) $(CLASSES_EXTRA)
	cat $(srcdir)/libvir.py libvirtclass.py > $@-t
	mv $@-t $@

$(libvirtmod_la_OBJECTS): $(GENERATED)

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

uninstall-local:
	rm -f $(DESTDIR)$(pythondir)/libvirt.py

CLEANFILES= $(GENERATED) generated.stamp libvirt.py

else
all:
endif

dummy:

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