mirror of
https://github.com/znc/znc.git
synced 2026-03-28 17:42:41 +01:00
Normally, when the Makefile calls swig, the resulting files end up in the build directory. However, when the files are pre-generated (e.g. as in the znc 1.0 tarball) and an out of tree build is used, they are in the source directory and installation fails. Thanks to Kinji for reporting this. Signed-off-by: Uli Schlachter <psychon@znc.in>
69 lines
2.3 KiB
Makefile
69 lines
2.3 KiB
Makefile
# vim: filetype=make
|
|
|
|
ifeq "$(PERL_ON)" "yes"
|
|
# We execute this now so that we see the 'beauty' of these flags in make's output
|
|
PERL_CXX := $(shell $(PERL) -MExtUtils::Embed -e perl_inc)
|
|
PERL_LD := $(shell $(PERL) -MExtUtils::Embed -e ldopts)
|
|
# Perl API is ugly, casting string literals to char* and redeclaring functions :(
|
|
PERL_CXX += -Wno-write-strings -Wno-redundant-decls -Wno-missing-declarations
|
|
PERL_CXX += -Wno-type-limits -Wno-sign-compare -Wno-strict-overflow -Wno-unused-value
|
|
# This is for SWIG
|
|
PERL_CXX += -DSWIG_TYPE_TABLE=znc
|
|
modperlCXXFLAGS := $(PERL_CXX) -Wno-unused-function
|
|
modperlLDFLAGS := $(PERL_LD)
|
|
# Find additional headers for out-of-tree build
|
|
modperlCXXFLAGS += -I.
|
|
|
|
ifeq "$(ISCYGWIN)" "1"
|
|
PERLCEXT_EXT := dll
|
|
PERLDEPONMOD := modperl.so
|
|
else
|
|
PERLCEXT_EXT := so
|
|
PERLDEPONMOD :=
|
|
endif
|
|
|
|
PERLHOOK := modperl_install
|
|
CLEAN += modperl/ZNC.$(PERLCEXT_EXT) modperl/ZNC.pm modperl/ZNC.o
|
|
CLEAN += modperl/swigperlrun.h modperl/ZNC.cpp modperl/functions.cpp
|
|
CLEAN += modperl/gen
|
|
all: modperl_all
|
|
|
|
else
|
|
FILES := $(shell echo $(FILES) | sed -e "s/modperl//")
|
|
endif
|
|
|
|
.PHONY: modperl_install modperl_all
|
|
|
|
install: $(PERLHOOK)
|
|
|
|
modperl_all: modperl/ZNC.$(PERLCEXT_EXT) modperl/swigperlrun.h modperl/functions.cpp
|
|
|
|
modperl/ZNC.$(PERLCEXT_EXT): modperl/ZNC.o Makefile modperl.so
|
|
$(E) Linking ZNC Perl bindings library...
|
|
$(Q)$(CXX) $(MODFLAGS) $(LDFLAGS) $(MODLINK) -o $@ $< $(PERL_LD) $(PERLDEPONMOD)
|
|
|
|
modperl/ZNC.o: modperl/ZNC.cpp Makefile
|
|
@mkdir -p modperl
|
|
@mkdir -p .depend
|
|
$(E) Building ZNC Perl bindings library...
|
|
$(Q)$(CXX) $(MODFLAGS) -I$(srcdir) -MD -MF .depend/modperl.library.dep $(PERL_CXX) -Wno-unused-variable -Wno-shadow -o $@ $< -c
|
|
|
|
ifneq "$(SWIG)" ""
|
|
include $(srcdir)/modperl/Makefile.gen
|
|
endif
|
|
|
|
modperl.o: modperl/functions.cpp modperl/swigperlrun.h
|
|
|
|
modperl_install: install_datadir modperl_all
|
|
for i in $(wildcard $(srcdir)/*.pm); do \
|
|
$(INSTALL_DATA) $$i $(DESTDIR)$(MODDIR); \
|
|
done
|
|
mkdir -p $(DESTDIR)$(MODDIR)/modperl
|
|
$(INSTALL_PROGRAM) modperl/ZNC.$(PERLCEXT_EXT) $(DESTDIR)$(MODDIR)/modperl
|
|
if test -e modperl/ZNC.pm ; then \
|
|
$(INSTALL_DATA) modperl/ZNC.pm $(DESTDIR)$(MODDIR)/modperl || exit 1 ; \
|
|
else \
|
|
$(INSTALL_DATA) $(srcdir)/modperl/ZNC.pm $(DESTDIR)$(MODDIR)/modperl || exit 1 ; \
|
|
fi
|
|
$(INSTALL_DATA) $(srcdir)/modperl/startup.pl $(DESTDIR)$(MODDIR)/modperl
|