# file: Makefile.python # author: Thiebaut Mochel mochel@cecpv.u-strasbg.fr 2008-06-05 # copyright: (C)2008 CECPV # license: Released to the Public Domain. # depends: python 2.4, swig 1.3.35, VRPN 07_15 # tested on: Linux w/ gcc 4.1.2 # references: http://python.org/ http://vrpn.org/ # http://www.swig.org # include ../Makefile PYTHON_VER := $(shell /usr/bin/python -V 2>&1 | sed 's/^[^0-9]*\([0-9]\+.[0-9]\+\)[^0-9].*/\1/') VRPN_ROOT_DIR := .. OBJECT_DIR := $(VRPN_ROOT_DIR)/$(OBJECT_DIR) PYTHON_INCLUDE_DIR := /usr/include/python$(PYTHON_VER) PYTHON_LIB := python$(PYTHON_VER) PYTHON_PACKAGES_DIR := $(LIB_DIR)/python$(PYTHON_VER)/dist-packages QUAT_INCLUDE_DIR := $(VRPN_ROOT_DIR)/quat QUAT_LIB_DIR := $(QUAT_INCLUDE_DIR) QUAT_LIB := quat CXX := g++ ifeq ($(HW_OS), pc_linux64) CXX := g++ -m64 -fPIC endif LIB_OBJECTS = $(patsubst %,$(OBJECT_DIR)/%,$(LIB_FILES:.C=.o)) vrpn-wrapper := $(addsuffix .so,$(basename $(wildcard vrpn_*.i))) vrpn-libs := $(addprefix _,$(vrpn-wrapper)) vrpn-python: $(vrpn-wrapper) $(vrpn-wrapper): $(MAKEFILE) $(LIB_OBJECTS) -mkdir -p $(HW_OS) cp ../$(HW_OS)/.depend $(HW_OS) swig -Wall -classic -c++ -python $(patsubst %.so,%.i,$@) $(CXX) -ggdb -c $(patsubst %.so,%_wrap.cxx,$@) -I$(PYTHON_INCLUDE_DIR) -I$(VRPN_ROOT_DIR) -I$(QUAT_INCLUDE_DIR) cp $(patsubst %.so,%_wrap.o,$@) $(HW_OS) $(CXX) -ggdb -shared $(patsubst _%,%,$(patsubst %.so,%_wrap.o,$@)) $(LIB_OBJECTS) -o _$@ -I$(VRPN_ROOT_DIR) -I$(QUAT_INCLUDE_DIR) -I$(PYTHON_INCLUDE_DIR) -l$(PYTHON_LIB) -L$(QUAT_LIB_DIR)/$(HW_OS) -l$(QUAT_LIB) install-vrpn-python: $(vrpn-libs) -mkdir -p $(PYTHON_PACKAGES_DIR) cp $(vrpn-libs) $(PYTHON_PACKAGES_DIR) cp *.py $(PYTHON_PACKAGES_DIR) clean-vrpn-python: rm -f *.cxx *.py *.pyc *.o *.so rm -rf $(HW_OS)/*