Merge ssh://repo.or.cz/srv/git/gfxprim
[gfxprim.git] / pywrap.mk
blobf41ce63c468eb05cdec218e44d7e76a5c1a1156f
1 ifndef LIBNAME
2 $(error LIBNAME not defined, fix your library Makefile)
3 endif
5 SWIG_SRC=$(LIBNAME).i
6 SWIG_C=$(LIBNAME)_wrap.c
7 SWIG_PY=c_$(LIBNAME).py
8 SWIG_LIB=_c_$(LIBNAME).so
10 ifneq ($(SWIG),)
12 INCLUDES+=$(addprefix -I$(TOPDIR)/include/, $(INCLUDE))
14 ALL+=$(SWIG_LIB) $(SWIG_PY)
16 # Empty rule to satisfy SWIG_PY
17 $(SWIG_PY): $(SWIG_C)
20 $(SWIG_C): $(SWIG_SRC)
21 ifdef VERBOSE
22 $(SWIG) $(SWIGOPTS) -python $(INCLUDES) $<
23 else # VERBOSE
24 @echo "SWIG $(LIBNAME)"
25 @$(SWIG) $(SWIGOPTS) -python $(INCLUDES) $<
26 endif # VERBOSE
28 $(SWIG_LIB): $(SWIG_C)
29 ifdef VERBOSE
30 $(CC) $< $(CFLAGS) -D_GNU_SOURCE=1 $(LDFLAGS) -I$(PYTHON_INCLUDE) --shared -lGP $(LDLIBS) -L$(TOPDIR)/build/ -o $@
31 else # VERBOSE
32 @echo "LD $@"
33 @$(CC) $< $(CFLAGS) -D_GNU_SOURCE=1 $(LDFLAGS) -I$(PYTHON_INCLUDE) --shared -lGP $(LDLIBS) -L$(TOPDIR)/build/ -o $@
34 endif # VERBOSE
36 endif # ifneq ($(SWIG),)
38 CLEAN+=$(SWIG_C) $(SWIG_PY) $(SWIG_LIB) *.pyc