mirror of
https://github.com/znc/znc.git
synced 2026-03-28 17:42:41 +01:00
lahwran just showed up on irc and told us that he installed znc, but znc failed to find any modules. The reason for this was his umask 077 which means that "make install" installed stuff so that only root can access it. The solution is do use "install -d" since that makes sure to ignore the currently set umask. However, google finds results which say that "install -d" might mess with stuff of pre-existing directories when it shouldn't, so we must first test if the directory already exists before calling install. Obviously, this makes our Makefile a lot more readable. :-( I didn't have time to test this properly, so stuff might break. Signed-off-by: Uli Schlachter <psychon@znc.in>
134 lines
3.3 KiB
Makefile
134 lines
3.3 KiB
Makefile
all:
|
|
|
|
SHELL := @SHELL@
|
|
|
|
# Support out-of-tree builds
|
|
srcdir := @srcdir@
|
|
VPATH := @srcdir@
|
|
|
|
prefix := @prefix@
|
|
exec_prefix := @exec_prefix@
|
|
datarootdir := @datarootdir@
|
|
bindir := @bindir@
|
|
datadir := @datadir@
|
|
sysconfdir := @sysconfdir@
|
|
libdir := @libdir@
|
|
sbindir := @sbindir@
|
|
localstatedir := @localstatedir@
|
|
CXX := @CXX@
|
|
# CXXFLAGS are for the main binary, so don't use them here, use MODFLAGS instead
|
|
MODFLAGS := @CPPFLAGS@ @MODFLAGS@ -I$(srcdir)/../include -I../include
|
|
MODLINK := @MODLINK@
|
|
LDFLAGS := @LDFLAGS@
|
|
# LIBS are not and should not be used in here.
|
|
# The znc binary links already against those.
|
|
# LIBS := @LIBS@
|
|
PERL_ON := @PERL@
|
|
PERL := @PERL_BINARY@
|
|
PYTHON_ON:= @PYTHON@
|
|
PY_CFLAGS:= @python_CFLAGS@
|
|
PY_LDFLAGS:=@python_LIBS@
|
|
SWIG := @SWIG@
|
|
SWIG_ON := @USESWIG@
|
|
MODDIR := @MODDIR@
|
|
DATADIR := @DATADIR@
|
|
LIBZNC := @LIBZNC@
|
|
LIBZNCDIR:= @LIBZNCDIR@
|
|
INSTALL := @INSTALL@
|
|
INSTALL_PROGRAM := @INSTALL_PROGRAM@
|
|
INSTALL_SCRIPT := @INSTALL_SCRIPT@
|
|
INSTALL_DATA := @INSTALL_DATA@
|
|
|
|
TCL_FLAGS:= @TCL_FLAGS@
|
|
|
|
ifneq "$(V)" ""
|
|
VERBOSE=1
|
|
endif
|
|
ifeq "$(VERBOSE)" ""
|
|
Q=@
|
|
E=@echo
|
|
else
|
|
Q=
|
|
E=@\#
|
|
endif
|
|
|
|
ifneq "$(LIBZNC)" ""
|
|
LDFLAGS += -L.. -lznc -Wl,-rpath,$(LIBZNCDIR)
|
|
endif
|
|
|
|
CLEAN :=
|
|
|
|
FILES := $(notdir $(wildcard $(srcdir)/*.cpp))
|
|
# If extra is enabled
|
|
ifeq "@EXTRA@" "yes"
|
|
FILES += $(addprefix extra/, $(notdir $(wildcard $(srcdir)/extra/*.cpp)))
|
|
endif
|
|
|
|
include $(srcdir)/modperl/Makefile.inc
|
|
include $(srcdir)/modpython/Makefile.inc
|
|
include $(srcdir)/modtcl/Makefile.inc
|
|
|
|
FILES := $(basename $(FILES))
|
|
|
|
ifeq "@NOSSL@" "1"
|
|
FILES := $(foreach file, $(FILES), \
|
|
$(if $(shell grep REQUIRESSL $(srcdir)/$(file).cpp), \
|
|
, \
|
|
$(basename $(file)) \
|
|
))
|
|
endif
|
|
|
|
ifeq "@SASL@" ""
|
|
FILES := $(shell echo $(FILES) | sed -e "s:extra/saslauth::")
|
|
endif
|
|
saslauthLDFLAGS := -lsasl2
|
|
|
|
ifeq "@CHARSET@" ""
|
|
FILES := $(shell echo $(FILES) | sed -e "s:extra/charset::")
|
|
endif
|
|
charsetLDFLAGS := @LIBICONV@
|
|
|
|
TARGETS := $(addsuffix .so, $(FILES))
|
|
|
|
CLEAN += *.so extra/*.so *.o extra/*.o
|
|
|
|
.PHONY: all clean install install_datadir uninstall
|
|
|
|
all: $(TARGETS)
|
|
|
|
install: all install_datadir
|
|
$(INSTALL_PROGRAM) $(TARGETS) $(DESTDIR)$(MODDIR)
|
|
|
|
install_datadir:
|
|
rm -rf $(DESTDIR)$(DATADIR)/modules
|
|
test -d $(DESTDIR)$(MODDIR) || $(INSTALL) -d $(DESTDIR)$(MODDIR)
|
|
test -d $(DESTDIR)$(DATADIR)/modules || $(INSTALL) -d $(DESTDIR)$(DATADIR)/modules
|
|
rm -rf $(DESTDIR)$(MODDIR)/*.so
|
|
cp -R $(srcdir)/data/* $(DESTDIR)$(DATADIR)/modules
|
|
if test "@EXTRA@" = "yes" ; then \
|
|
cp -R $(srcdir)/extra/data/* $(DESTDIR)$(DATADIR)/modules ; \
|
|
fi
|
|
find $(DESTDIR)$(DATADIR)/modules -type d -exec chmod 0755 '{}' \;
|
|
find $(DESTDIR)$(DATADIR)/modules -type f -exec chmod 0644 '{}' \;
|
|
|
|
clean:
|
|
rm -rf $(CLEAN)
|
|
|
|
%.o: %.cpp Makefile
|
|
@mkdir -p .depend extra
|
|
$(E) Building $(if $(filter %extra/,$(dir $<)),extra )module $(notdir $(basename $@))...
|
|
$(Q)$(CXX) $(MODFLAGS) -c -o $@ $< $($(notdir $(basename $@))CXXFLAGS) -MMD -MF .depend/$(notdir $@).dep
|
|
|
|
%.so: %.o Makefile
|
|
$(E) Linking $(if $(filter %extra/,$(dir $<)),extra )module $(notdir $(basename $@))...
|
|
$(Q)$(CXX) $(MODFLAGS) $(LDFLAGS) $(MODLINK) -o $@ $< $($(notdir $(basename $@))LDFLAGS)
|
|
|
|
uninstall:
|
|
# Yes, we are lazy, just remove everything in there
|
|
rm -rf $(DESTDIR)$(MODDIR)/*
|
|
rm -rf $(DESTDIR)$(DATADIR)/*
|
|
rmdir $(DESTDIR)$(MODDIR)
|
|
rmdir $(DESTDIR)$(DATADIR)
|
|
|
|
-include $(wildcard .depend/*.dep)
|