From 0cc8bebd2bdbc2a3e0b7057a1417355e739612d8 Mon Sep 17 00:00:00 2001 From: psychon Date: Thu, 23 Dec 2010 14:15:49 +0000 Subject: [PATCH] Various fixes for our Makefiles - Make sure webskins are installed with the correct permissions even though we don't use install for installing them. - Make "make uninstall" use the correct path for webskins. - Properly clean up the stuff generated by modperl and modpython on "make clean" - Don't first install modperl/ and modpython/ only to remove them again later - Use $(wildcard) to expand *.foo to the empty string if nothing matches. git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@2201 726aef4b-f618-498e-8847-2d620e286838 --- Makefile.in | 4 +++- modules/Makefile.in | 26 +++++++++++++++----------- 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/Makefile.in b/Makefile.in index 81b31ca8..32c6030f 100644 --- a/Makefile.in +++ b/Makefile.in @@ -106,6 +106,8 @@ install: znc $(LIBZNC) mkdir -p $(DESTDIR)$(MODDIR) mkdir -p $(DESTDIR)$(DATADIR) cp -Rp $(srcdir)/webskins $(DESTDIR)$(DATADIR) + find $(DESTDIR)$(DATADIR)/webskins -type d -exec chmod 0755 '{}' \; + find $(DESTDIR)$(DATADIR)/webskins -type f -exec chmod 0644 '{}' \; $(INSTALL_PROGRAM) znc $(DESTDIR)$(bindir) $(INSTALL_SCRIPT) znc-config $(DESTDIR)$(bindir) $(INSTALL_SCRIPT) znc-buildmod $(DESTDIR)$(bindir) @@ -124,7 +126,7 @@ uninstall: rm $(DESTDIR)$(bindir)/znc-buildmod rm $(DESTDIR)$(includedir)/znc/*.h rm $(DESTDIR)$(PKGCONFIGDIR)/znc.pc - rm -rf $(DESTDIR)$(MODDIR)/webskins + rm -rf $(DESTDIR)$(DATADIR)/webskins if test -n "$(LIBZNC)"; then \ rm $(DESTDIR)$(LIBZNCDIR)/$(LIBZNC) || exit 1 ; \ rmdir $(DESTDIR)$(LIBZNCDIR) || exit 1 ; \ diff --git a/modules/Makefile.in b/modules/Makefile.in index 55b0abd6..c3e067bf 100644 --- a/modules/Makefile.in +++ b/modules/Makefile.in @@ -116,6 +116,12 @@ TARGETS := $(addsuffix .so, $(FILES)) CLEAN := *.so extra/*.so CLEAN += modperl/ZNC.so modperl/ZNC.pm modpython/functions.cpp modpython/compiler CLEAN += modpython/_znc_core.so modpython/_znc_core.cpp modpython/znc_core.py modpython/znc_core.pyc +CLEAN += modperl/swigperlrun.h modperl/ZNC.cpp +CLEAN += modpython/swigpyrun.h modpython/znc.pyc +ifneq "$(srcdir)" "." +# Copied from source for out-of-tree builds +CLEAN += modpython/znc.py +endif .PHONY: all clean install install_metadirs create_install_dir uninstall .PHONY: modperl_install modtcl_install modpython_install modpython_compilepyc @@ -132,7 +138,7 @@ create_install_dir: install_metadirs: create_install_dir for a in $(srcdir)/*; do \ - d=$$(echo $$a | sed -e "s:$(srcdir)/::g"); \ + d=$$(echo $$a | sed -e "s:$(srcdir)/::g;s:modperl::;s:modpython::"); \ if [ -d $$a ] && [ -f $${d}.so ]; then \ cp -Rp $$a $(DESTDIR)$(DATADIR); \ fi \ @@ -181,16 +187,14 @@ modpython/functions.cpp: modpython/functions.in $(Q)$(PERL) $(srcdir)/modpython/codegen.pl $< $@ modperl_install: create_install_dir install_metadirs - -for i in $(srcdir)/*.pm; do \ - test -r $$i && $(INSTALL_DATA) $$i $(DESTDIR)$(MODDIR); \ + for i in $(wildcard $(srcdir)/*.pm); do \ + $(INSTALL_DATA) $$i $(DESTDIR)$(MODDIR); \ done for a in $(srcdir)/*; do \ if [ -d $$a ] && [ -f $${a}.pm ]; then \ cp -Rp $$a $(DESTDIR)$(DATADIR); \ fi \ done - -test -r $(srcdir)/modperl/ZNC.pm && cp -p $(srcdir)/modperl/ZNC.pm modperl/ - rm -rf $(DESTDIR)$(DATADIR)/modperl mkdir -p $(DESTDIR)$(MODDIR)/modperl $(INSTALL_PROGRAM) modperl/ZNC.so $(DESTDIR)$(MODDIR)/modperl $(INSTALL_DATA) modperl/ZNC.pm $(DESTDIR)$(MODDIR)/modperl @@ -200,14 +204,15 @@ modpython/compiler: modpython/compiler.cpp $(CXX) $(PYTHONCOMMON) -o $@ $< modpython_compilepyc: modpython/compiler - -cp -p $(srcdir)/*.py ./ - -cp -p $(srcdir)/*.pyc ./ - -cp -p $(srcdir)/modpython/znc*.py modpython/ + # This is allowed to fail only if $(srcdir) == pwd. + -cp $(srcdir)/*.py ./ + -cp $(srcdir)/*.pyc ./ + -cp $(srcdir)/modpython/znc*.py modpython/ $< modpython_install: create_install_dir install_metadirs modpython_compilepyc - -for i in *.pyc; do \ - test -r $$i && $(INSTALL_DATA) $$i $(DESTDIR)$(MODDIR); \ + for i in $(wildcard *.pyc); do \ + $(INSTALL_DATA) $$i $(DESTDIR)$(MODDIR); \ done for a in $(srcdir)/*; do \ if [ -d $$a ]; then \ @@ -216,7 +221,6 @@ modpython_install: create_install_dir install_metadirs modpython_compilepyc fi \ fi \ done - rm -rf $(DESTDIR)$(DATADIR)/modpython mkdir -p $(DESTDIR)$(MODDIR)/modpython $(INSTALL_PROGRAM) modpython/_znc_core.so $(DESTDIR)$(MODDIR)/modpython $(INSTALL_DATA) modpython/znc_core.pyc $(DESTDIR)$(MODDIR)/modpython