Merge branch 'new-baudrate-code'
[libftdi] / bindings / python / Makefile.am
CommitLineData
05c0dae8
TH
1
2## Process this file with automake to produce Makefile.in
3
4if HAVE_SWIG
5if HAVE_PYTHON
6if ENABLE_PYTHON_BINDING
7
8LIBFTDI_INTERFACE = $(top_srcdir)/src/ftdi.h
9SWIG_INTERFACE = ../ftdi.i
10
11BUILT_SOURCES = ftdi_wrap.c ftdi.py
12CLEANFILES = ftdi_wrap.c ftdi.py
13
14all-local: ftdi_wrap.c ftdi.py
15 @case "`uname`" in \
16 MINGW*) \
17 $(PYTHON) setup.py build --compiler=mingw32 \
18 ;; \
19 *) \
fe1b45c8 20 CPPFLAGS="$(CPPFLAGS)" $(PYTHON) setup.py build \
05c0dae8
TH
21 ;; \
22 esac;
23
24# python on MinGW/MSYS requires pure Windows style paths
25# Using following (cd $dir && pwd -W) hack to get a nearly
26# native Windows path, then translating the forward slash
27# to a backward slash to make python distutils jolly.
28# P.S. the backslash has to be escaped thrice, hence a single
29# backslash turns into a sequence of eight (neat, huh?)
30#
31install-exec-local:
32 @case "`uname`" in \
33 MINGW*) \
34 NATIVE_WINDOWS_PREFIX="`cd $(DESTDIR)$(prefix) && pwd -W`"; \
35 NATIVE_WINDOWS_PREFIX="`echo $$NATIVE_WINDOWS_PREFIX | sed -e 's|/|\\\\\\\\|g'`"; \
36 $(PYTHON) setup.py install --prefix="$$NATIVE_WINDOWS_PREFIX" \
37 ;; \
38 *) \
fe1b45c8 39 CPPFLAGS="$(CPPFLAGS)" $(PYTHON) setup.py install --prefix=$(DESTDIR)$(prefix) \
05c0dae8
TH
40 ;; \
41 esac;
42
43# This rule cleans up stuff installed by Python's setup.py
44# Unfortunately, Python's distutils do not provide an uninstall
45# command, so we have to make up for it here in uninstall-local
46# hook. This might break if distutils' behaviour changes as automake
47# has no control over what distutils install command does.
48#
49uninstall-local:
50 rm -rf $(DESTDIR)$(libdir)/python*/site-packages/*ftdi*
51
52clean-local:
53 $(PYTHON) setup.py clean --all
54
55ftdi_wrap.c ftdi.py: $(SWIG_INTERFACE) $(LIBFTDI_INTERFACE)
56 $(SWIG) -python -I$(top_srcdir)/src -o ftdi_wrap.c -outdir . $(srcdir)/$(SWIG_INTERFACE)
57
58
59endif # ENABLE_PYTHON_BINDING
60endif # HAVE_PYTHON
61endif # HAVE_SWIG