all:

VPATH := $(srcdir)

ifneq "$(V)" ""
VERBOSE=1
endif
ifeq "$(VERBOSE)" ""
Q=@
E=@echo
C=-s
else
Q=
E=@\#
C=
endif

.SECONDARY:

all: modpython/modpython_biglib.cpp modpython/znc_core.py modpython/pyfunctions.cpp modpython/swigpyrun.h

modpython/swigpyrun.h:
	@mkdir -p modpython
	$(Q)$(SWIG) -python -py3 -c++ -shadow -external-runtime $@

modpython/modpython_biglib.cpp: modpython/modpython.i modpython/module.h modpython/cstring.i
	$(E) Generating ZNC API for python...
	@mkdir -p modpython .depend
	$(Q)$(SWIG) -python -py3 -c++ -shadow -outdir modpython -I$(srcdir) -I$(srcdir)/../include -I../include -MD -MF .depend/modpython.swig.dep -w362,315,401 -o $@ $<

modpython/znc_core.py: modpython/modpython_biglib.cpp

modpython/pyfunctions.cpp: modpython/codegen.pl modpython/functions.in
	@mkdir -p modpython
	$(Q)$(PERL) $^ $@

-include .depend/modpython.swig.dep
