1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157
|
# Plug-in module only valid if module is listed in PLUGINS.
ifneq (,$(findstring cspython,$(PLUGINS)))
# Plugin description
DESCRIPTION.cspython = Crystal Script Python plug-in
DESCRIPTION.cspythonswig = Crystal Script Python SWIG interface
#------------------------------------------------------------- rootdefines ---#
ifeq ($(MAKESECTION),rootdefines)
# Plugin-specific help commands
PLUGINHELP += \
$(NEWLINE)echo $" make cspython Make the $(DESCRIPTION.cspython)$"
endif # ifeq ($(MAKESECTION),rootdefines)
#------------------------------------------------------------- roottargets ---#
ifeq ($(MAKESECTION),roottargets)
.PHONY: cspython cspythonclean cspythonswig
all plugins: cspython
cspython:
$(MAKE_TARGET) MAKE_DLL=yes
cspythonclean:
$(MAKE_CLEAN)
cspythonswig:
$(MAKE_TARGET) MAKE_DLL=yes
endif # ifeq ($(MAKESECTION),roottargets)
#------------------------------------------------------------- postdefines ---#
ifeq ($(MAKESECTION),postdefines)
# For custom compiled python with tk/tcl
#TCLTK=-ltk8.0 -ltcl8.0 -L/usr/X11R6/lib -lX11
# For python 2.0+
#LIBUTIL=-lutil
ifneq (,$(filter python2%, $(notdir $(PYTHON_LIB))))
LIBUTIL=-lutil
endif
ifneq ($(OS),NEXT)
PTHREAD=-lpthread
endif
ifneq (,$(strip $(PYTHON_INC)))
CFLAGS.PYTHON += $(CFLAGS.I)$(PYTHON_INC)
endif
CFLAGS.PYTHON += -DSWIG_GLOBAL
ifeq (,$(strip $(LIBS.CSPYTHON.SYSTEM)))
ifneq (,$(strip $(PYTHON_LIB)))
# PYTHON_LIB points at the Python library directory (which is often
# /usr/lib/python1.5). The actual static link library usually resides in a
# "config" subdirectory of the library directory. The library's name is the
# same as the directory, thus in this example, the library would be called
# "libpython1.5.a".
LIBS.CSPYTHON.SYSTEM = \
$(LFLAGS.L)$(PYTHON_LIB)/config $(LFLAGS.L)$(PYTHON_LIB) \
$(LFLAGS.l)$(notdir $(PYTHON_LIB)) $(TCLTK) $(PTHREAD) $(LIBUTIL)
endif
endif
ifeq ($(USE_PLUGINS),yes)
CSPYTHON = $(OUTDLL)cspython$(DLL)
LIB.CSPYTHON = $(foreach d,$(DEP.CSPYTHON),$($d.LIB))
LIB.CSPYTHON.LOCAL = $(LIBS.CSPYTHON.SYSTEM)
TO_INSTALL.DYNAMIC_LIBS += $(CSPYTHON)
else
CSPYTHON = $(OUT)$(LIB_PREFIX)cspy$(LIB)
DEP.EXE += $(CSPYTHON)
LIBS.EXE += $(LIBS.CSPYTHON.SYSTEM)
SCF.STATIC += cspython
TO_INSTALL.STATIC_LIBS += $(CSPYTHON)
endif
TO_INSTALL.ROOT += python.cex
SWIG.INTERFACE = include/ivaria/cs.i
SWIG.CSPYTHON = plugins/cscript/cspython/cs_pyth.cpp
SWIG.CSPYTHON.OBJ = $(addprefix $(OUT),$(notdir $(SWIG.CSPYTHON:.cpp=$O)))
TRASH.CSPYTHON = $(wildcard $(addprefix scripts/python/,*.pyc *.pyo))
INC.CSPYTHON = $(wildcard plugins/cscript/cspython/*.h)
SRC.CSPYTHON = \
$(sort $(wildcard plugins/cscript/cspython/*.cpp) $(SWIG.CSPYTHON))
OBJ.CSPYTHON = $(addprefix $(OUT),$(notdir $(SRC.CSPYTHON:.cpp=$O)))
DEP.CSPYTHON = CSGEOM CSSYS CSUTIL CSSYS CSUTIL
MSVC.DSP += CSPYTHON
DSP.CSPYTHON.NAME = cspython
DSP.CSPYTHON.TYPE = plugin
DSP.CSPYTHON.RESOURCES = $(SWIG.INTERFACE)
DSP.CSPYTHON.CFLAGS = /D "SWIG_GLOBAL"
endif # ifeq ($(MAKESECTION),postdefines)
#----------------------------------------------------------------- targets ---#
ifeq ($(MAKESECTION),targets)
.PHONY: cspython cspythonclean cspythonswig csjavaswigclean
all: $(CSPYTHON.LIB)
cspython: $(OUTDIRS) $(CSPYTHON) python.cex
clean: cspythonclean
$(SWIG.CSPYTHON.OBJ): $(SWIG.CSPYTHON)
$(filter-out -W -Wunused -Wall,$(DO.COMPILE.CPP) $(CFLAGS.PYTHON))
$(OUT)%$O: plugins/cscript/cspython/%.cpp
$(DO.COMPILE.CPP) $(CFLAGS.PYTHON)
$(OUT)%$O: plugins/cscript/cspython/%.c
$(DO.COMPILE.C) $(CFLAGS.PYTHON)
$(SWIG.CSPYTHON): $(SWIG.INTERFACE)
swig -python -c++ -docstring -dascii -Sbefore -shadow -Iinclude/ -o $(SWIG.CSPYTHON) $(SWIG.INTERFACE)
mv plugins/cscript/cspython/cspace.py scripts/python/
python.cex: plugins/cscript/cspython/python.cin
@echo Generate python cs-config extension...
@echo "#!/bin/sh" > python.cex
@echo "# WARNING: This file is automatically generated by cspython.mak" >> python.cex
@echo "PYTH_LIBS=\"$(LIB.CSPYTHON.LOCAL)\"" >> python.cex
@echo "PYTH_CFLAGS=\"$(CFLAGS.PYTHON)\"" >> python.cex
@echo "PYTH_CXXFLAGS=\"$(CFLAGS.PYTHON)\"" >> python.cex
@echo "PYTH_DEPS=\"\"" >> python.cex
@cat plugins/cscript/cspython/python.cin >> python.cex
@echo ok
$(CSPYTHON): $(OBJ.CSPYTHON) $(LIB.CSPYTHON)
$(DO.PLUGIN.PREAMBLE) \
$(DO.PLUGIN.CORE) $(LIB.CSPYTHON.LOCAL) \
$(DO.PLUGIN.POSTAMBLE)
cspythonclean:
-$(RM) $(CSPYTHON) $(OBJ.CSPYTHON) $(TRASH.CSPYTHON) python.cex
cspythonswig: cspythonswigclean cspython
cspythonswigclean:
-$(RM) $(CSPYTHON) $(SWIG.CSPYTHON) $(OUT)cs_pyth.cpp
ifdef DO_DEPEND
dep: $(OUTOS)cspython.dep
$(OUTOS)cspython.dep: $(SRC.CSPYTHON)
$(DO.DEP1) $(CFLAGS.PYTHON) $(DO.DEP2)
else
-include $(OUTOS)cspython.dep
endif
endif # ifeq ($(MAKESECTION),targets)
endif # ifneq (,$(findstring cspython,$(PLUGINS)))
|