1
2plug_in_name = py_sems
3include Makefile.defs
4
5COREPATH ?=../../core
6
7TTS ?= y
8
9# put used Python modules from lib-dynload here, e.g. time, mysql, _cvs.so etc.
10PYTHON_DYNLOAD_MODULES = $(wildcard $(PYTHON_LIBDIR)/lib-dynload/*.so) \
11	$(wildcard $(PYTHON_LIBDIR)/site-packages/*.so)
12PYTHON_module_cflags = -Wno-write-strings -fno-strict-aliasing -I$(PYTHON_DIR) -Isip/
13PYTHON_module_ldflags = -L$(PYTHON_LIBDIR)/config \
14			-lpython$(PY_VER)
15
16ifeq ($(TTS), y)
17#
18#   flite text to speech
19#
20# uncomment the next lines if you want to have flite text-to-speech (ivr.say("Hello there"); )
21FLITE_DIR = /usr/src/flite-1.2-release
22ALT_FLITE_DIR = /usr/include/flite
23PY_SEMS_TTS_module_ldflags =  -L$(FLITE_DIR)/lib -lm  -lflite_cmu_us_kal  -lflite_usenglish \
24	-lflite_cmulex -lflite
25PY_SEMS_TTS_module_cflags = -I$(FLITE_DIR)/include  -I$(ALT_FLITE_DIR) -DPY_SEMS_WITH_TTS
26endif
27
28LOCAL_INCLUDES = -I$(FLITE_DIR)/lang/usenglish
29
30# On FreeBSD, remove the following flags: -ldl -lpthread
31module_ldflags = -ldl -lpthread -lm \
32	$(PYTHON_module_ldflags) \
33	$(PY_SEMS_TTS_module_ldflags)
34
35module_cflags  = \
36	$(PYTHON_module_cflags) \
37	$(PY_SEMS_TTS_module_cflags) \
38	$(module_additional_cflags)
39
40module_extra_objs = sip/py_sems_lib.a
41extra_target  = sip/py_sems_lib.a python_files
42extra_install = install_python_files
43
44py_src = $(notdir $(wildcard py/*.py))
45py_obj = $(py_src:.py=.pyc)
46
47
48ifeq (all,$(MAKECMDGOALS))
49.PHONY: python_files
50python_files:
51	$(PY_EXE) py_comp -l -q py &&\
52	cp py/*.pyc $(COREPATH)/lib
53
54endif
55
56ifeq (,$(MAKECMDGOALS))
57.PHONY: python_files
58python_files:
59	$(PY_EXE) py_comp -l -q py &&\
60	cp py/*.pyc $(COREPATH)/lib
61
62endif
63
64ifeq (module_package,$(MAKECMDGOALS))
65python_files:
66	$(PY_EXE) py_comp -l -q py
67
68endif
69
70ifeq (install,$(MAKECMDGOALS))
71python_files:
72	$(PY_EXE) py_comp -l -q py
73
74endif
75
76extra_clean = clean_py_sems_lib
77LD=gcc
78
79include $(COREPATH)/plug-in/Makefile.app_module
80
81ifneq ($(OS),macosx)
82ifneq ($(OS),solaris)
83PYTHON_module_ldflags += -Xlinker --export-dynamic
84endif
85endif
86
87.PHONY: install_python_files
88install_python_files: $(DESTDIR)$(modules_prefix)/$(modules_dir)
89	echo "Installing Python object files..."
90	for f in $(py_obj) ; do \
91		if [ -n "py/$$f" ]; then \
92			$(INSTALL_TOUCH) $(DESTDIR)$(modules_prefix)/$(modules_dir)/$$f; \
93			$(INSTALL_MODULES) py/$$f $(DESTDIR)$(modules_prefix)/$(modules_dir)/$$f; \
94		fi ; \
95	done
96
97	echo "Installing py_sems script path..."
98	$(INSTALL_MODULES) -d $(DESTDIR)$(modules_prefix)/$(py-sems-modules_dir)
99
100.PHONY: clean_py_sems_lib
101clean_py_sems_lib:
102	COREPATH=../$(COREPATH) $(MAKE) -C sip/ clean
103	rm -f py/*.pyc
104	rm -f $(module_extra_objs)
105sip/py_sems_lib.a:
106	COREPATH=../$(COREPATH) $(MAKE) -C sip/ Makefile.gen
107	COREPATH=../$(COREPATH) $(MAKE) -C sip/ py_sems_lib.a
108