ifeq ($(PYTHON_PROJECT),)
PYTHON_PROJECT=True

ifeq ($(BASE_DIR),)
   include ../Makefile.common
   BASE_DIR=$(shell pwd)
   PYTHON_ROOT=True
endif

PYTHON_BASE=@PYTHON_BASE@
PYTHON_VERSION=@PYTHON_VERSION@
PYTHON_INCLUDE=-I$(PYTHON_BASE)/include/python$(PYTHON_VERSION)
PYTHON_LIBS=-L@PYTHON_DIR@ -lpython$(PYTHON_VERSION) @PYTHON_LIBS@

PYTHON_BASE_DIR := $(BASE_DIR)

ifneq ($(PYTHON_BASE),no)
PYTHON_SRC_DIRS = $(PYTHON_BASE_DIR)/src
else
PYTHON_SRC_DIRS = $(PYTHON_BASE_DIR)/src2
endif

SRC_DIRS += $(PYTHON_SRC_DIRS)
C_SRCS = \
  $(foreach name,$(PYTHON_SRC_DIRS),$(notdir $(wildcard $(name)/*$(C_EXT))))
PYTHON_OBJ_DIR = $(PYTHON_BASE_DIR)/obj
OBJ_DIR = $(PYTHON_OBJ_DIR)

CFLAGS = -g -O2 $(PYTHON_INCLUDE) `pkg-config gtk+-2.0 --cflags`

PROJECT_FILE = python

ifneq ($(PYTHON_BASE),no)
   LDFLAGS += $(PYTHON_LIBS)
   PYTHON_SRCS=$(C_SRCS)
endif

ifneq ($(strip $(PYTHON_SRCS)),)
   LIBS := $(PYTHON_OBJ_DIR)/libpython$(AR_EXT) $(LIBS)
endif

ifeq ($(PYTHON_ROOT),True)
   include ../builder/src/Makefile.generic
else
   DEPS_PROJECTS += $(PYTHON_BASE_DIR)/python
endif

endif
