VERSION=1.0
CURDIR=pythonmod
LOCAL_CLEAN=std_local_clean clean-recursive
LOCAL_INSTALL=std_local_install pythonmod_dir install-recursive
DIRS=pythonlib
ifeq ($(shell test -d /usr/include/python2.1 && echo ok),ok)
PYTHONVER=2.1
else
ifeq ($(shell test -d /usr/include/python2.0 && echo ok),ok)
PYTHONVER=2.0
else
ifeq ($(shell test -d /usr/include/python1.5 && echo ok),ok)
PYTHONVER=1.5
endif
endif
endif

ifdef PYTHONVER
all: all-recursive $(CURDIR).so
OBJS =  pythonmod.os _dict.os pymodule.os
include ../rules.mak
include ../stdmod.mak
else
all:
	@echo Nothing to build, python not available
install:
	@echo Nothing to install
endif

PROTOUPDHEAD=

EXTRAMODLIBS=-L/usr/lib/python$(PYTHONVER)/config/ -lpython$(PYTHONVER) \
	-lpthread -Wl,-rpath,/usr/lib/linuxconf/pythonlib pythonlib/*.so \
	-lutil -ldb
FLAGS+=-I/usr/include/python$(PYTHONVER)

pythonmod_dir:
	mkdir -p $(RPM_BUILD_ROOT)/usr/lib/linuxconf/pythonmod

all-recursive install-recursive clean-recursive:
	@target=`echo $@ | sed s/-recursive//`; \
	for d in $(DIRS); do cd $$d; make $$target; cd ..; done
