Makefile for C program that uses numpy extensions
Question: Please what is the simplest / most elegant way of how to determine correct
paths for numpy include as they are present on target system ? And then use it
by make command ? At the moment I am using

gcc ... -I/usr/include/python2.7/ -I/usr/lib/python2.7/site-
packages/numpy/core/include/numpy/

and I would like to have those two includes automatically selected based on
system on which the build is perfromed on.

It seems like I can get the second include like this:

    
    
    python -c "import numpy; print numpy.__path__[0] + 'core/include/numpy/'"
    

but I am not sure about the first one and even if I was I still wouldn't be
sure how to best use it from makefile (in an easy / elegant way)


Answer: `numpy.get_include()` is the easiest/best way to get the includes. If your C
extension module uses numpy then in
[Extension](http://docs.python.org/distutils/apiref.html#distutils.core.Extension)
you have to use `include_dirs=[numpy.get_include()]`. Why
`numpy.get_include()` doesn't seem to have any documentation I don't know.

Then you can do as user1056255 suggests but just a bit better...

    
    
    CFLAGS = $(shell python-config --includes) $(shell python -c "import numpy; print '-I' + numpy.get_include()")
    

