1#############################################################################
2# Software Testing Automation Framework (STAF)                              #
3# (C) Copyright IBM Corp. 2001                                              #
4#                                                                           #
5# This software is licensed under the Eclipse Public License (EPL) V1.0.    #
6#############################################################################
7
8ifeq ($(PYTHON_BUILD_V32),1)
9
10# On Windows, starting in Python 2.5, the only filename extension for Python
11# extension modules that is searched for is .pyd (.dll is no longer supported
12# by Python 2.5+)
13ifeq ($(OS_NAME),win32)
14  LIB_PYSTAF = PYSTAF.pyd
15else
16  ifeq ($(OS_NAME),macosx)
17    LIB_PYSTAF = PYSTAF.so
18  else
19    LIB_PYSTAF = PYSTAF$(OS_SHARED_LIB_SUFFIX)
20  endif
21endif
22
23SUBSYS_REL_PYTHON = lang/python/python32
24
25stafif_python32_targets += \
26  $(REL)/lib/python32/$(LIB_PYSTAF)
27Targets += $(stafif_python32_targets)
28CleanupTargets += cleanup_stafif_python32
29
30$(stafif_python32_targets): SUBSYS_REL := lang/python/python32
31SUBSYS_REL := lang/python/python32
32
33#=====================================================================
34#   C/C++ Info Flags
35#=====================================================================
36
37$(stafif_python32_targets): LIBS = STAF $(PYTHON_V32_LIBS)
38$(stafif_python32_targets): LIBDIRS = STAF $(PYTHON_V32_LIBDIRS)
39$(stafif_python32_targets): OBJS = $(stafif_python32_objs)
40$(stafif_python32_targets): INCLUDEDIRS = $(PYTHON_V32_INCLUDEDIRS)
41
42stafif_python32_objs :=\
43  PYSTAF
44
45stafif_python32_objs := $(foreach obj,$(stafif_python32_objs),$(O)/$(SUBSYS_REL)/$(obj)$(OS_OE))
46stafif_python32_dependents  := $(stafif_python32_objs:$(OS_OE)=.d)
47$(stafif_python32_dependents): SUBSYS_REL = $(SUBSYS_REL_PYTHON)
48$(stafif_python32_dependents): INCLUDEDIRS = $(PYTHON_V32_INCLUDEDIRS)
49
50ifeq ($(OS_NAME),win32)
51    stafif_python32_objs += $(SRC)/lang/python/python32/PYSTAF.def
52endif
53
54# Include dependencies
55ifneq ($(InCleanup), "1")
56    include $(stafif_python32_dependents)
57endif
58
59# Include inference rules
60include $(InferenceRules)
61
62# Need to copy the PYSTAF.cpp file into the python32 directory
63$(SRC)/lang/python/python32/PYSTAF.cpp: $(SRC)/lang/python/PYSTAF.cpp $(MAKEFILE_NAME)
64	@echo "*** Copying $(SRC)/lang/python/PYSTAF.cpp to $(SRC)/lang/python/python32/PYSTAF.cpp ***"
65	$(COPY_FILE)
66
67# These two rules allow us to build the Python specific versions from the common
68# parent tree
69
70$(O)/$(SUBSYS_REL)/%.d: $(SRC)/$(SUBSYS_REL)/../%.cpp
71	$(C_DEPEND_IT)
72
73$(O)/$(SUBSYS_REL)/%$(OS_OE): $(SRC)/$(SUBSYS_REL)/../%.cpp
74	$(COMPILE_IT)
75
76# STAF Python targets
77
78$(REL)/lib/python32/$(LIB_PYSTAF): $(stafif_python32_objs) $(LIB_STAF_FP) $(MAKEFILE_NAME)
79	$(SHARED_LIB_IT)
80
81cleanup_stafif_python32:
82	-@$(DEL) $(O)/stafif/python/* $(OUT_ERR_TO_DEV_NULL)
83	-@$(DEL) $(REL)/lib/python32/$(LIB_PYSTAF) $(OUT_ERR_TO_DEV_NULL)
84
85endif
86