update make config
This commit is contained in:
@ -31,3 +31,5 @@ CHECK_RELEASE = YES
|
||||
# You must rebuild in the iocBoot directory for this to
|
||||
# take effect.
|
||||
#IOCS_APPL_TOP = </IOC/path/to/application/top>
|
||||
|
||||
PYTHON ?= python
|
||||
|
@ -5,4 +5,9 @@ include $(TOP)/configure/CONFIG
|
||||
TARGETS = $(CONFIG_TARGETS)
|
||||
CONFIGS += $(subst ../,,$(wildcard $(CONFIG_INSTALLS)))
|
||||
|
||||
TARGETS += CONFIG_PY
|
||||
|
||||
include $(TOP)/configure/RULES
|
||||
|
||||
CONFIG_PY: $(TOP)/makehelper.py
|
||||
$(PYTHON) $< $@
|
||||
|
@ -5,16 +5,19 @@ include $(TOP)/configure/CONFIG
|
||||
# ADD MACRO DEFINITIONS AFTER THIS LINE
|
||||
#=============================
|
||||
|
||||
PYTHON = python
|
||||
# EG 2.7
|
||||
PY_VER = $(shell $(PYTHON) -c 'from distutils.sysconfig import get_config_var; print get_config_var("VERSION")')
|
||||
# EG -I/usr/include/python2.7
|
||||
PY_CFLAGS := -I$(shell $(PYTHON) -c 'from distutils.sysconfig import get_python_inc; print get_python_inc()')
|
||||
# EG -L/usr/lib
|
||||
PY_LIBDIR := -L$(shell $(PYTHON) -c 'from distutils.sysconfig import get_config_var; print get_config_var("LIBDIR")')
|
||||
ifdef T_A
|
||||
include $(TOP)/configure/O.$(T_A)/CONFIG_PY
|
||||
ifneq ($(PY_OK),YES)
|
||||
$(error Unable to get python configuration)
|
||||
endif
|
||||
endif
|
||||
|
||||
USR_CPPFLAGS += $(PY_CFLAGS)
|
||||
USR_LDFLAGS += $(PY_LIBDIR)
|
||||
USR_CPPFLAGS += $(PY_INCDIRS:%=-I%)
|
||||
USR_LDFLAGS += $(PY_LIBDIRS:%=-L%)
|
||||
|
||||
ifeq ($(HAVE_NUMPY),YES)
|
||||
USR_CPPFLAGS += -DHAVE_NUMPY
|
||||
endif
|
||||
|
||||
#=============================
|
||||
# Build the IOC application
|
||||
@ -53,3 +56,11 @@ include $(TOP)/configure/RULES
|
||||
#----------------------------------------
|
||||
# ADD RULES AFTER THIS LINE
|
||||
|
||||
pyconfig:
|
||||
@echo "Python Configuration for interpreter: $(PYTHON)"
|
||||
@echo "Version: $(PY_VER)"
|
||||
@echo "Found numpy: $(HAVE_NUMPY)"
|
||||
@echo "Includes: $(PY_INCDIRS)"
|
||||
@echo "Library path: $(PY_LIBDIRS)"
|
||||
@echo "USR_CPPFLAGS: $(USR_CPPFLAGS)"
|
||||
@echo "USR_LDFLAGS: $(USR_LDFLAGS)"
|
||||
|
44
makehelper.py
Normal file
44
makehelper.py
Normal file
@ -0,0 +1,44 @@
|
||||
#!/usr/bin/env python
|
||||
"""
|
||||
Set some python derived Makefile variables.
|
||||
|
||||
Emits something like the following
|
||||
|
||||
PY_OK := YES # indicates success of this script
|
||||
HAVE_NUMPY := YES/NO
|
||||
PY_VER := 2.6
|
||||
PY_INCDIRS := /path ...
|
||||
PY_LIBDIRS := /path ...
|
||||
"""
|
||||
|
||||
import sys
|
||||
|
||||
if len(sys.argv)<2:
|
||||
out = sys.stdout
|
||||
else:
|
||||
out = open(sys.argv[1], 'w')
|
||||
|
||||
from distutils.sysconfig import get_config_var, get_python_inc
|
||||
|
||||
incdirs = [get_python_inc()]
|
||||
libdirs = [get_config_var('LIBDIR')]
|
||||
|
||||
have_np='NO'
|
||||
try:
|
||||
from numpy.distutils.misc_util import get_numpy_include_dirs
|
||||
incdirs += get_numpy_include_dirs()
|
||||
have_np='YES'
|
||||
except ImportError:
|
||||
pass
|
||||
|
||||
incdirs = [get_python_inc()]+get_numpy_include_dirs()
|
||||
libdirs = [get_config_var('LIBDIR')]
|
||||
|
||||
print >>out,'PY_VER :=',get_config_var('VERSION')
|
||||
print >>out,'PY_INCDIRS :=',' '.join(incdirs)
|
||||
print >>out,'PY_LIBDIRS :=',' '.join(libdirs)
|
||||
print >>out,'HAVE_NUMPY :=',have_np
|
||||
|
||||
print >>out,'PY_OK := YES'
|
||||
|
||||
out.close()
|
Reference in New Issue
Block a user