filters/gp_filter_resize_alloc: Check w and h
[gfxprim.git] / pywrap.mk
blob76d18b48302aa59f4b8bb19ad2d9b4e24560c2cd
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 # All swig sources depend on common.i
34 $(SWIG_C): ../common.i
36 $(SWIG_LIB): $(SWIG_C)
37 ifdef VERBOSE
38 $(CC) $< $(CFLAGS) -D_GNU_SOURCE=1 $(LDFLAGS) $(PYTHON_INCLUDE) --shared $(LDLIBS) -lgfxprim -L$(TOPDIR)/build/ -o $@
39 else # VERBOSE
40 @echo "LD $@"
41 @$(CC) $< $(CFLAGS) -D_GNU_SOURCE=1 $(LDFLAGS) $(PYTHON_INCLUDE) --shared $(LDLIBS) -lgfxprim -L$(TOPDIR)/build/ -o $@
42 endif # VERBOSE
44 # Install python libraries into right places
45 INSTALL_FILES+=__init__.py $(SWIG_PY) $(SWIG_LIB)
47 include $(TOPDIR)/pyinst.mk
49 CLEAN+=$(SWIG_C) $(SWIG_PY) $(SWIG_LIB) *.pyc
51 endif # PYTHON_CONFIG
52 endif # SWIG