tests: fix HTML-gen sh script (dash compatibility)
[gfxprim.git] / pywrap.mk
blob9b4fcbae823bc2ac6939d9dd0670194cbe0b94b0
1 ifndef LIBNAME
2 $(error LIBNAME not defined, fix your library Makefile)
3 endif
5 ifdef SWIG
6 ifdef PYTHON_CONFIG
8 INCLUDES+=$(addprefix -I$(TOPDIR)/include/, $(INCLUDE))
9 #PY_SUFFIX=$(shell $(PYTHON_CONFIG) --extension-suffix)
10 PY_SUFFIX=.so
12 SWIG_SRC=$(LIBNAME).i
13 SWIG_C=$(LIBNAME)_wrap.c
14 SWIG_PY=c_$(LIBNAME).py
15 SWIG_LIB=_c_$(LIBNAME)$(PY_SUFFIX)
17 ALL+=$(SWIG_LIB) $(SWIG_PY)
19 # Empty rule to satisfy SWIG_PY
20 $(SWIG_PY): $(SWIG_C)
23 $(SWIG_LIB): $(TOPDIR)/config.gen.mk
25 $(SWIG_C): $(SWIG_SRC)
26 ifdef VERBOSE
27 $(SWIG) $(SWIGOPTS) -python $(INCLUDES) $<
28 else # VERBOSE
29 @echo "SWIG $(LIBNAME)"
30 @$(SWIG) $(SWIGOPTS) -python $(INCLUDES) $<
31 endif # VERBOSE
33 $(SWIG_LIB): $(SWIG_C)
34 ifdef VERBOSE
35 $(CC) $< $(CFLAGS) -D_GNU_SOURCE=1 $(LDFLAGS) $(PYTHON_INCLUDE) --shared -lGP $(LDLIBS) -L$(TOPDIR)/build/ -o $@
36 else # VERBOSE
37 @echo "LD $@"
38 @$(CC) $< $(CFLAGS) -D_GNU_SOURCE=1 $(LDFLAGS) $(PYTHON_INCLUDE) --shared -lGP $(LDLIBS) -L$(TOPDIR)/build/ -o $@
39 endif # VERBOSE
41 # Install python libraries into right places
42 INSTALL_FILES+=__init__.py $(SWIG_PY) $(SWIG_LIB)
44 include $(TOPDIR)/pyinst.mk
46 CLEAN+=$(SWIG_C) $(SWIG_PY) $(SWIG_LIB) *.pyc
48 endif # PYTHON_CONFIG
49 endif # SWIG