Advertisement
Guest User

Untitled

a guest
Dec 25th, 2013
375
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Make 1.81 KB | None | 0 0
  1. #or gcc $CFLAGS -I/usr/include/python2.7 -o main main.c -lpython2.7 -lpthread -lm -lutil -ldl
  2. # Makefile for creating our standalone Cython program
  3. PYTHON=python
  4. PYVERSION=$(shell $(PYTHON) -c "import sys; print(sys.version[:3])")
  5.  
  6. INCDIR=$(shell $(PYTHON) -c "from distutils import sysconfig; print(sysconfig.get_python_inc())")
  7. PLATINCDIR=$(shell $(PYTHON) -c "from distutils import sysconfig; print(sysconfig.get_python_inc(plat_specific=True))")
  8. LIBDIR1=$(shell $(PYTHON) -c "from distutils import sysconfig; print(sysconfig.get_config_var('LIBDIR'))")
  9. LIBDIR2=$(shell $(PYTHON) -c "from distutils import sysconfig; print(sysconfig.get_config_var('LIBPL'))")
  10. PYLIB=$(shell $(PYTHON) -c "from distutils import sysconfig; print(sysconfig.get_config_var('LIBRARY')[3:-2])")
  11.  
  12. CC=$(shell $(PYTHON) -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('CC'))")
  13. LINKCC=$(shell $(PYTHON) -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LINKCC'))")
  14. LINKFORSHARED=$(shell $(PYTHON) -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LINKFORSHARED'))")
  15. LIBS=$(shell $(PYTHON) -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBS'))")
  16. SYSLIBS= $(shell $(PYTHON) -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('SYSLIBS'))")
  17.  
  18. embedded: embedded.o
  19.     $(LINKCC) -o $@ $^ -L$(LIBDIR1) -L$(LIBDIR2) -l$(PYLIB) $(LIBS) $(SYSLIBS) $(LINKFORSHARED)
  20.  
  21. embedded.o: embedded.c
  22.     $(CC) -c $^ -I$(INCDIR) -I$(PLATINCDIR)
  23.  
  24. CYTHON=/usr/local/bin/cython
  25. embedded.c: embedded.pyx
  26.     @$(PYTHON) $(CYTHON) --embed embedded.pyx
  27.  
  28. all: embedded
  29.  
  30. clean:
  31.     @echo Cleaning Demos/embed
  32.     @rm -f *~ *.o *.so core core.* *.c embedded test.output
  33.  
  34. test: clean all
  35.     ./embedded > test.output
  36.     $(PYTHON) assert_equal.py embedded.output test.output
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement