all:

VPATH := $(srcdir)

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

.SECONDARY:

all: modperl/modperl_biglib.cpp modperl/ZNC.pm modperl/perlfunctions.cpp modperl/swigperlrun.h

modperl/swigperlrun.h:
	@mkdir -p modperl
	$(Q)$(SWIG) -perl5 -c++ -shadow -external-runtime $@

modperl/modperl_biglib.cpp: modperl/modperl.i modperl/module.h modperl/CString.i
	$(E) Generating ZNC API for Perl...
	@mkdir -p modperl .depend
	$(Q)$(SWIG) -perl5 -c++ -shadow -outdir modperl -I$(srcdir) -I$(srcdir)/../include -I../include -I$(srcdir)/modperl/include -MD -MF .depend/modperl.swig.dep -w362,315,401,402 -o $@ $<

modperl/ZNC.pm: modperl/modperl_biglib.cpp

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

-include .depend/modperl.swig.dep
