all:

VPATH := $(srcdir)

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

.SECONDARY:

all: modpython/_znc_core.cpp modpython/znc_core.py modpython/functions.cpp modpython/swigpyrun.h

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

modpython/_znc_core.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) -MD -MF .depend/modpython.swig.dep -w362,315,401 -o $@ $<

modpython/znc_core.py: modpython/_znc_core.cpp

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

-include .depend/modpython.swig.dep
