2 ## Process this file with automake to produce Makefile.in
6 if ENABLE_PYTHON_BINDING
8 LIBFTDI_INTERFACE = $(top_srcdir)/src/ftdi.h
9 SWIG_INTERFACE = ../ftdi.i
11 BUILT_SOURCES = ftdi_wrap.c ftdi.py
12 CLEANFILES = ftdi_wrap.c ftdi.py
14 all-local: ftdi_wrap.c ftdi.py
17 $(PYTHON) setup.py build --compiler=mingw32 \
20 $(PYTHON) setup.py build \
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?)
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" \
39 $(PYTHON) setup.py install --prefix=$(DESTDIR)$(prefix) \
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.
50 rm -rf $(DESTDIR)$(libdir)/python*/site-packages/*ftdi*
53 $(PYTHON) setup.py clean --all
55 ftdi_wrap.c ftdi.py: $(SWIG_INTERFACE) $(LIBFTDI_INTERFACE)
56 $(SWIG) -python -I$(top_srcdir)/src -o ftdi_wrap.c -outdir . $(srcdir)/$(SWIG_INTERFACE)
59 endif # ENABLE_PYTHON_BINDING