| 1 | |
| 2 | ## Process this file with automake to produce Makefile.in |
| 3 | |
| 4 | if HAVE_SWIG |
| 5 | if HAVE_PYTHON |
| 6 | if ENABLE_PYTHON_BINDING |
| 7 | |
| 8 | LIBFTDI_INTERFACE = $(top_srcdir)/src/ftdi.h |
| 9 | SWIG_INTERFACE = ../ftdi.i |
| 10 | |
| 11 | BUILT_SOURCES = ftdi_wrap.c ftdi.py |
| 12 | CLEANFILES = ftdi_wrap.c ftdi.py |
| 13 | |
| 14 | all-local: ftdi_wrap.c ftdi.py |
| 15 | @case "`uname`" in \ |
| 16 | MINGW*) \ |
| 17 | $(PYTHON) setup.py build --compiler=mingw32 \ |
| 18 | ;; \ |
| 19 | *) \ |
| 20 | CPPFLAGS="$(CPPFLAGS)" $(PYTHON) setup.py build \ |
| 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 | # |
| 31 | install-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 | *) \ |
| 39 | CPPFLAGS="$(CPPFLAGS)" $(PYTHON) setup.py install --prefix=$(DESTDIR)$(prefix) \ |
| 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 | # |
| 49 | uninstall-local: |
| 50 | rm -rf $(DESTDIR)$(libdir)/python*/site-packages/*ftdi* |
| 51 | |
| 52 | clean-local: |
| 53 | $(PYTHON) setup.py clean --all |
| 54 | |
| 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) |
| 57 | |
| 58 | |
| 59 | endif # ENABLE_PYTHON_BINDING |
| 60 | endif # HAVE_PYTHON |
| 61 | endif # HAVE_SWIG |