mirror of
https://github.com/processone/ejabberd.git
synced 2024-11-24 16:23:40 +01:00
0bbc255814
Since Erlang/OTP 26, Dialyzer by default reports unknown types. ejabberd's type specs refer to the re:mp() type, but that isn't exported in the OTP source code, and cannot be used in any other modules. This commit provides very dirty workarounds, and any cleaner alternative is very welcomed.
528 lines
16 KiB
Makefile
528 lines
16 KiB
Makefile
REBAR = @ESCRIPT@ @rebar@
|
|
MIX = @rebar@
|
|
INSTALL = @INSTALL@
|
|
SED = @SED@
|
|
ERL = @ERL@
|
|
|
|
prefix = @prefix@
|
|
exec_prefix = @exec_prefix@
|
|
|
|
DESTDIR =
|
|
|
|
# /etc/ejabberd/
|
|
ETCDIR = @sysconfdir@/ejabberd
|
|
|
|
# /bin/
|
|
BINDIR = @bindir@
|
|
|
|
# /sbin/
|
|
SBINDIR = @sbindir@
|
|
|
|
# /lib/
|
|
LIBDIR = @libdir@
|
|
|
|
# /lib/ejabberd/
|
|
EJABBERDDIR = @libdir@/ejabberd
|
|
|
|
# /share/doc/ejabberd
|
|
PACKAGE_TARNAME = @PACKAGE_TARNAME@
|
|
datarootdir = @datarootdir@
|
|
DOCDIR = @docdir@
|
|
|
|
# /share/doc/man/man5
|
|
MANDIR = @mandir@/man5
|
|
|
|
# /usr/lib/ejabberd/ebin/
|
|
BEAMDIR = $(EJABBERDDIR)/ebin
|
|
|
|
# /usr/lib/ejabberd/include/
|
|
INCLUDEDIR = $(EJABBERDDIR)/include
|
|
|
|
# /usr/lib/ejabberd/priv/
|
|
PRIVDIR = $(EJABBERDDIR)/priv
|
|
|
|
# /usr/lib/ejabberd/priv/bin
|
|
PBINDIR = $(PRIVDIR)/bin
|
|
|
|
# /usr/lib/ejabberd/priv/lib
|
|
SODIR = $(PRIVDIR)/lib
|
|
|
|
# /usr/lib/ejabberd/priv/msgs
|
|
MSGSDIR = $(PRIVDIR)/msgs
|
|
|
|
# /usr/lib/ejabberd/priv/css
|
|
CSSDIR = $(PRIVDIR)/css
|
|
|
|
# /usr/lib/ejabberd/priv/img
|
|
IMGDIR = $(PRIVDIR)/img
|
|
|
|
# /usr/lib/ejabberd/priv/js
|
|
JSDIR = $(PRIVDIR)/js
|
|
|
|
# /usr/lib/ejabberd/priv/sql
|
|
SQLDIR = $(PRIVDIR)/sql
|
|
|
|
# /usr/lib/ejabberd/priv/lua
|
|
LUADIR = $(PRIVDIR)/lua
|
|
|
|
# /var/lib/ejabberd/
|
|
SPOOLDIR = @localstatedir@/lib/ejabberd
|
|
|
|
# /var/log/ejabberd/
|
|
LOGDIR = @localstatedir@/log/ejabberd
|
|
|
|
INSTALLUSER=@INSTALLUSER@
|
|
# if no user was enabled, don't set privileges or ownership
|
|
ifeq ($(INSTALLUSER),)
|
|
O_USER=
|
|
G_USER=
|
|
CHOWN_COMMAND=echo
|
|
CHOWN_OUTPUT=/dev/null
|
|
INIT_USER=root
|
|
else
|
|
O_USER=-o $(INSTALLUSER)
|
|
G_USER=-g $(INSTALLUSER)
|
|
CHOWN_COMMAND=chown
|
|
CHOWN_OUTPUT=&1
|
|
INIT_USER=$(INSTALLUSER)
|
|
endif
|
|
# if no group was enabled, don't set privileges or ownership
|
|
INSTALLGROUP=@INSTALLGROUP@
|
|
ifneq ($(INSTALLGROUP),)
|
|
G_USER=-g $(INSTALLGROUP)
|
|
endif
|
|
|
|
ifeq "$(MIX)" "mix"
|
|
REBAR_VER:=6
|
|
REBAR_VER_318:=0
|
|
else
|
|
REBAR_VER:=$(shell $(REBAR) --version | awk -F '[ .]' '/rebar / {print $$2}')
|
|
REBAR_VER_318:=$(shell $(REBAR) --version | awk -F '[ .]' '/rebar / {print ($$2 == 3 && $$3 >= 18 ? 1 : 0)}')
|
|
endif
|
|
|
|
ifeq "$(REBAR_VER)" "6"
|
|
REBAR=$(MIX)
|
|
SKIPDEPS=
|
|
LISTDEPS=deps.tree
|
|
UPDATEDEPS=deps.update
|
|
DEPSPATTERN="s/.*─ \([a-z0-9_]*\) .*/\1/p;"
|
|
DEPSBASE=_build
|
|
DEPSDIR=$(DEPSBASE)/dev/lib
|
|
GET_DEPS= deps.get
|
|
CONFIGURE_DEPS=(cd deps/eimp; ./configure)
|
|
EBINDIR=$(DEPSDIR)/ejabberd/ebin
|
|
XREFOPTIONS=graph
|
|
CLEANARG=--deps
|
|
REBARREL=MIX_ENV=prod $(REBAR) release --overwrite
|
|
REBARDEV=MIX_ENV=dev $(REBAR) release --overwrite
|
|
RELIVECMD=escript rel/relive.escript && MIX_ENV=dev RELIVE=true iex --name ejabberd@localhost -S mix run
|
|
else
|
|
ifeq "$(REBAR_VER)" "3"
|
|
SKIPDEPS=
|
|
LISTDEPS=tree
|
|
ifeq "$(REBAR_VER_318)" "1"
|
|
UPDATEDEPS=upgrade --all
|
|
else
|
|
UPDATEDEPS=upgrade
|
|
endif
|
|
DEPSPATTERN="s/ (.*//; /^ / s/.* \([a-z0-9_]*\).*/\1/p;"
|
|
DEPSBASE=_build
|
|
DEPSDIR=$(DEPSBASE)/default/lib
|
|
GET_DEPS= get-deps
|
|
CONFIGURE_DEPS=$(REBAR) configure-deps
|
|
EBINDIR=$(DEPSDIR)/ejabberd/ebin
|
|
XREFOPTIONS=
|
|
CLEANARG=--all
|
|
REBARREL=$(REBAR) as prod tar
|
|
REBARDEV=REBAR_PROFILE=dev $(REBAR) release
|
|
RELIVECMD=$(REBAR) relive
|
|
else
|
|
SKIPDEPS=skip_deps=true
|
|
LISTDEPS=-q list-deps
|
|
UPDATEDEPS=update-deps
|
|
DEPSPATTERN="/ TAG / s/ .*// p; / REV / s/ .*// p; / BRANCH / s/ .*// p;"
|
|
DEPSBASE=deps
|
|
DEPSDIR=$(DEPSBASE)
|
|
GET_DEPS= get-deps
|
|
CONFIGURE_DEPS=$(REBAR) configure-deps
|
|
EBINDIR=ebin
|
|
XREFOPTIONS=
|
|
CLEANARG=
|
|
REBARREL=$(REBAR) generate
|
|
REBARDEV=
|
|
RELIVECMD=@echo "Rebar2 detected... relive not supported.\
|
|
\nTry: ./configure --with-rebar=./rebar3 ; make relive"
|
|
endif
|
|
endif
|
|
|
|
all: scripts deps src
|
|
|
|
deps: $(DEPSDIR)/.got
|
|
|
|
$(DEPSDIR)/.got:
|
|
rm -rf $(DEPSDIR)/.got
|
|
rm -rf $(DEPSDIR)/.built
|
|
mkdir -p $(DEPSDIR)
|
|
$(REBAR) $(GET_DEPS) && :> $(DEPSDIR)/.got
|
|
$(CONFIGURE_DEPS)
|
|
|
|
$(DEPSDIR)/.built: $(DEPSDIR)/.got
|
|
$(REBAR) compile && :> $(DEPSDIR)/.built
|
|
|
|
src: $(DEPSDIR)/.built
|
|
$(REBAR) $(SKIPDEPS) compile
|
|
|
|
update:
|
|
rm -rf $(DEPSDIR)/.got
|
|
rm -rf $(DEPSDIR)/.built
|
|
$(REBAR) $(UPDATEDEPS) && :> $(DEPSDIR)/.got
|
|
$(CONFIGURE_DEPS)
|
|
|
|
xref: all
|
|
$(REBAR) $(SKIPDEPS) xref $(XREFOPTIONS)
|
|
|
|
hooks: all
|
|
tools/hook_deps.sh $(EBINDIR)
|
|
|
|
options: all
|
|
tools/opt_types.sh ejabberd_option $(EBINDIR)
|
|
|
|
translations:
|
|
tools/prepare-tr.sh $(DEPSDIR)
|
|
|
|
doap:
|
|
tools/generate-doap.sh
|
|
|
|
edoc:
|
|
$(ERL) -noinput +B -eval \
|
|
'case edoc:application(ejabberd, ".", []) of ok -> halt(0); error -> halt(1) end.'
|
|
|
|
JOIN_PATHS=$(if $(wordlist 2,1000,$(1)),$(firstword $(1))/$(call JOIN_PATHS,$(wordlist 2,1000,$(1))),$(1))
|
|
|
|
VERSIONED_DEP=$(if $(DEP_$(1)_VERSION),$(DEP_$(1)_VERSION),$(1))
|
|
|
|
DEPIX:=$(words $(subst /, ,$(DEPSDIR)))
|
|
LIBIX:=$(shell expr "$(DEPIX)" + 2)
|
|
|
|
ELIXIR_TO_DEST=$(LIBDIR) $(call VERSIONED_DEP,$(word 2,$(1))) $(wordlist 5,1000,$(1))
|
|
DEPS_TO_DEST=$(LIBDIR) $(call VERSIONED_DEP,$(word 2,$(1))) $(wordlist 3,1000,$(1))
|
|
MAIN_TO_DEST=$(LIBDIR) $(call VERSIONED_DEP,ejabberd) $(1)
|
|
TO_DEST_SINGLE=$(if $(subst X$(DEPSBASE)X,,X$(word 1,$(1))X),$(call MAIN_TO_DEST,$(1)),$(if $(subst XlibX,,X$(word $(LIBIX),$(1))X),$(call DEPS_TO_DEST,$(wordlist $(DEPIX),1000,$(1))),$(call ELIXIR_TO_DEST,$(wordlist $(DEPIX),1000,$(1)))))
|
|
TO_DEST=$(foreach path,$(1),$(call JOIN_PATHS,$(DESTDIR)$(call TO_DEST_SINGLE,$(subst /, ,$(path)))))
|
|
|
|
FILTER_DIRS=$(foreach path,$(1),$(if $(wildcard $(path)/*),,$(path)))
|
|
FILES_WILDCARD=$(call FILTER_DIRS,$(foreach w,$(1),$(wildcard $(w))))
|
|
|
|
ifeq ($(MAKECMDGOALS),copy-files-sub)
|
|
|
|
DEPS:=$(sort $(shell QUIET=1 $(REBAR) $(LISTDEPS) | $(SED) -ne $(DEPSPATTERN) ))
|
|
|
|
DEPS_FILES=$(call FILES_WILDCARD,$(foreach DEP,$(DEPS),$(DEPSDIR)/$(DEP)/ebin/*.beam $(DEPSDIR)/$(DEP)/ebin/*.app $(DEPSDIR)/$(DEP)/priv/* $(DEPSDIR)/$(DEP)/priv/lib/* $(DEPSDIR)/$(DEP)/priv/bin/* $(DEPSDIR)/$(DEP)/include/*.hrl $(DEPSDIR)/$(DEP)/COPY* $(DEPSDIR)/$(DEP)/LICENSE* $(DEPSDIR)/$(DEP)/lib/*/ebin/*.beam $(DEPSDIR)/$(DEP)/lib/*/ebin/*.app))
|
|
|
|
BINARIES=$(DEPSDIR)/epam/priv/bin/epam $(DEPSDIR)/eimp/priv/bin/eimp $(DEPSDIR)/fs/priv/mac_listener
|
|
|
|
DEPS_FILES_FILTERED=$(filter-out $(BINARIES) $(DEPSDIR)/elixir/ebin/elixir.app,$(DEPS_FILES))
|
|
DEPS_DIRS=$(sort $(DEPSDIR)/ $(foreach DEP,$(DEPS),$(DEPSDIR)/$(DEP)/) $(dir $(DEPS_FILES)))
|
|
|
|
MAIN_FILES=$(filter-out %/configure.beam,$(call FILES_WILDCARD,$(EBINDIR)/*.beam $(EBINDIR)/*.app priv/msgs/*.msg priv/css/*.css priv/img/*.png priv/js/*.js priv/lib/* include/*.hrl COPYING))
|
|
MAIN_DIRS=$(sort $(dir $(MAIN_FILES)) priv/bin priv/sql priv/lua)
|
|
|
|
define DEP_VERSION_template
|
|
DEP_$(1)_VERSION:=$(shell $(SED) -e '/vsn/!d;s/.*, *"/$(1)-/;s/".*//' $(2) 2>/dev/null)
|
|
endef
|
|
|
|
DELETE_TARGET_SO=$(if $(subst X.soX,,X$(suffix $(1))X),,rm -f $(call TO_DEST,$(1));)
|
|
|
|
$(foreach DEP,$(DEPS),$(eval $(call DEP_VERSION_template,$(DEP),$(DEPSDIR)/$(DEP)/ebin/$(DEP).app)))
|
|
$(eval $(call DEP_VERSION_template,ejabberd,$(EBINDIR)/ejabberd.app))
|
|
|
|
define COPY_template
|
|
$(call TO_DEST,$(1)): $(1) $(call TO_DEST,$(dir $(1))) ; $(call DELETE_TARGET_SO, $(1)) $$(INSTALL) -m 644 $(1) $(call TO_DEST,$(1))
|
|
endef
|
|
|
|
define COPY_BINARY_template
|
|
$(call TO_DEST,$(1)): $(1) $(call TO_DEST,$(dir $(1))) ; rm -f $(call TO_DEST,$(1)); $$(INSTALL) -m 755 $$(O_USER) $(1) $(call TO_DEST,$(1))
|
|
endef
|
|
|
|
$(foreach file,$(DEPS_FILES_FILTERED) $(MAIN_FILES),$(eval $(call COPY_template,$(file))))
|
|
|
|
$(foreach file,$(BINARIES),$(eval $(call COPY_BINARY_template,$(file))))
|
|
|
|
$(sort $(call TO_DEST,$(MAIN_DIRS) $(DEPS_DIRS))):
|
|
$(INSTALL) -d $@
|
|
|
|
$(call TO_DEST,priv/sql/lite.sql): sql/lite.sql $(call TO_DEST,priv/sql)
|
|
$(INSTALL) -m 644 $< $@
|
|
|
|
$(call TO_DEST,priv/sql/lite.new.sql): sql/lite.new.sql $(call TO_DEST,priv/sql)
|
|
$(INSTALL) -m 644 $< $@
|
|
|
|
$(call TO_DEST,priv/bin/captcha.sh): tools/captcha.sh $(call TO_DEST,priv/bin)
|
|
$(INSTALL) -m 755 $(O_USER) $< $@
|
|
|
|
$(call TO_DEST,priv/lua/redis_sm.lua): priv/lua/redis_sm.lua $(call TO_DEST,priv/lua)
|
|
$(INSTALL) -m 644 $< $@
|
|
|
|
ifeq (@sqlite@,true)
|
|
SQLITE_FILES = priv/sql/lite.sql priv/sql/lite.new.sql
|
|
endif
|
|
|
|
ifeq (@redis@,true)
|
|
REDIS_FILES = priv/lua/redis_sm.lua
|
|
endif
|
|
|
|
copy-files-sub2: $(call TO_DEST,$(DEPS_FILES) $(MAIN_FILES) priv/bin/captcha.sh $(SQLITE_FILES) $(REDIS_FILES))
|
|
|
|
.PHONY: $(call TO_DEST,$(DEPS_FILES) $(MAIN_DIRS) $(DEPS_DIRS))
|
|
|
|
endif
|
|
|
|
copy-files:
|
|
$(MAKE) copy-files-sub
|
|
|
|
copy-files-sub: copy-files-sub2
|
|
|
|
relive:
|
|
$(RELIVECMD)
|
|
|
|
relivelibdir=$(shell pwd)/$(DEPSDIR)
|
|
relivedir=$(shell pwd)/_build/relive
|
|
iexpath=$(shell which iex)
|
|
CONFIG_DIR = ${relivedir}/conf
|
|
SPOOL_DIR = ${relivedir}/database
|
|
LOGS_DIR = ${relivedir}/logs
|
|
|
|
ejabberdctl.relive:
|
|
$(SED) -e "s*{{installuser}}*@INSTALLUSER@*g" \
|
|
-e "s*{{config_dir}}*${CONFIG_DIR}*g" \
|
|
-e "s*{{logs_dir}}*${LOGS_DIR}*g" \
|
|
-e "s*{{spool_dir}}*${SPOOL_DIR}*g" \
|
|
-e "s*{{bindir}}/iex*$(iexpath)*g" \
|
|
-e "s*{{bindir}}*@bindir@*g" \
|
|
-e "s*{{libdir}}*${relivelibdir}*g" \
|
|
-e "s*{{erl}}*@ERL@*g" \
|
|
-e "s*{{epmd}}*@EPMD@*g" ejabberdctl.template \
|
|
> ejabberdctl.relive
|
|
|
|
ejabberd.init:
|
|
$(SED) -e "s*@ctlscriptpath@*$(SBINDIR)*g" \
|
|
-e "s*@installuser@*$(INIT_USER)*g" ejabberd.init.template \
|
|
> ejabberd.init
|
|
chmod 755 ejabberd.init
|
|
|
|
ejabberd.service:
|
|
$(SED) -e "s*@ctlscriptpath@*$(SBINDIR)*g" \
|
|
-e "s*@installuser@*$(INIT_USER)*g" ejabberd.service.template \
|
|
> ejabberd.service
|
|
chmod 644 ejabberd.service
|
|
|
|
ejabberdctl.example: vars.config
|
|
$(SED) -e "s*{{installuser}}*@INSTALLUSER@*g" \
|
|
-e "s*{{config_dir}}*${ETCDIR}*g" \
|
|
-e "s*{{logs_dir}}*${LOGDIR}*g" \
|
|
-e "s*{{spool_dir}}*${SPOOLDIR}*g" \
|
|
-e "s*{{bindir}}*@bindir@*g" \
|
|
-e "s*{{libdir}}*@libdir@*g" \
|
|
-e "s*{{erl}}*@ERL@*g" \
|
|
-e "s*{{epmd}}*@EPMD@*g" ejabberdctl.template \
|
|
> ejabberdctl.example
|
|
|
|
scripts: ejabberd.init ejabberd.service ejabberdctl.example
|
|
|
|
install: copy-files
|
|
#
|
|
# Configuration files
|
|
$(INSTALL) -d -m 750 $(G_USER) $(DESTDIR)$(ETCDIR)
|
|
[ -f $(DESTDIR)$(ETCDIR)/ejabberd.yml ] \
|
|
&& $(INSTALL) -b -m 640 $(G_USER) ejabberd.yml.example $(DESTDIR)$(ETCDIR)/ejabberd.yml-new \
|
|
|| $(INSTALL) -b -m 640 $(G_USER) ejabberd.yml.example $(DESTDIR)$(ETCDIR)/ejabberd.yml
|
|
[ -f $(DESTDIR)$(ETCDIR)/ejabberdctl.cfg ] \
|
|
&& $(INSTALL) -b -m 640 $(G_USER) ejabberdctl.cfg.example $(DESTDIR)$(ETCDIR)/ejabberdctl.cfg-new \
|
|
|| $(INSTALL) -b -m 640 $(G_USER) ejabberdctl.cfg.example $(DESTDIR)$(ETCDIR)/ejabberdctl.cfg
|
|
$(INSTALL) -b -m 644 $(G_USER) inetrc $(DESTDIR)$(ETCDIR)/inetrc
|
|
#
|
|
# Administration script
|
|
[ -d $(DESTDIR)$(SBINDIR) ] || $(INSTALL) -d -m 755 $(DESTDIR)$(SBINDIR)
|
|
$(INSTALL) -m 550 $(G_USER) ejabberdctl.example $(DESTDIR)$(SBINDIR)/ejabberdctl
|
|
# Elixir binaries
|
|
[ -d $(DESTDIR)$(BINDIR) ] || $(INSTALL) -d -m 755 $(DESTDIR)$(BINDIR)
|
|
[ -f $(DEPSDIR)/elixir/bin/iex ] && $(INSTALL) -m 550 $(G_USER) $(DEPSDIR)/elixir/bin/iex $(DESTDIR)$(BINDIR)/iex || true
|
|
[ -f $(DEPSDIR)/elixir/bin/elixir ] && $(INSTALL) -m 550 $(G_USER) $(DEPSDIR)/elixir/bin/elixir $(DESTDIR)$(BINDIR)/elixir || true
|
|
[ -f $(DEPSDIR)/elixir/bin/mix ] && $(INSTALL) -m 550 $(G_USER) $(DEPSDIR)/elixir/bin/mix $(DESTDIR)$(BINDIR)/mix || true
|
|
#
|
|
# Spool directory
|
|
$(INSTALL) -d -m 750 $(O_USER) $(DESTDIR)$(SPOOLDIR)
|
|
$(CHOWN_COMMAND) -R @INSTALLUSER@ $(DESTDIR)$(SPOOLDIR) >$(CHOWN_OUTPUT)
|
|
chmod -R 750 $(DESTDIR)$(SPOOLDIR)
|
|
#
|
|
# Log directory
|
|
$(INSTALL) -d -m 750 $(O_USER) $(DESTDIR)$(LOGDIR)
|
|
$(CHOWN_COMMAND) -R @INSTALLUSER@ $(DESTDIR)$(LOGDIR) >$(CHOWN_OUTPUT)
|
|
chmod -R 750 $(DESTDIR)$(LOGDIR)
|
|
#
|
|
# Documentation
|
|
$(INSTALL) -d $(DESTDIR)$(MANDIR)
|
|
$(INSTALL) -d $(DESTDIR)$(DOCDIR)
|
|
[ -f man/ejabberd.yml.5 ] \
|
|
&& $(INSTALL) -m 644 man/ejabberd.yml.5 $(DESTDIR)$(MANDIR) \
|
|
|| echo "Man page not included in sources"
|
|
$(INSTALL) -m 644 COPYING $(DESTDIR)$(DOCDIR)
|
|
|
|
uninstall: uninstall-binary
|
|
|
|
uninstall-binary:
|
|
rm -f $(DESTDIR)$(SBINDIR)/ejabberdctl
|
|
rm -f $(DESTDIR)$(BINDIR)/iex
|
|
rm -f $(DESTDIR)$(BINDIR)/elixir
|
|
rm -f $(DESTDIR)$(BINDIR)/mix
|
|
rm -fr $(DESTDIR)$(DOCDIR)
|
|
rm -f $(DESTDIR)$(BEAMDIR)/*.beam
|
|
rm -f $(DESTDIR)$(BEAMDIR)/*.app
|
|
rm -fr $(DESTDIR)$(BEAMDIR)
|
|
rm -f $(DESTDIR)$(INCLUDEDIR)/*.hrl
|
|
rm -fr $(DESTDIR)$(INCLUDEDIR)
|
|
rm -fr $(DESTDIR)$(PBINDIR)
|
|
rm -f $(DESTDIR)$(SODIR)/*.so
|
|
rm -fr $(DESTDIR)$(SODIR)
|
|
rm -f $(DESTDIR)$(MSGSDIR)/*.msg
|
|
rm -fr $(DESTDIR)$(MSGSDIR)
|
|
rm -f $(DESTDIR)$(CSSDIR)/*.css
|
|
rm -fr $(DESTDIR)$(CSSDIR)
|
|
rm -f $(DESTDIR)$(IMGDIR)/*.png
|
|
rm -fr $(DESTDIR)$(IMGDIR)
|
|
rm -f $(DESTDIR)$(JSDIR)/*.js
|
|
rm -fr $(DESTDIR)$(JSDIR)
|
|
rm -f $(DESTDIR)$(SQLDIR)/*.sql
|
|
rm -fr $(DESTDIR)$(SQLDIR)
|
|
rm -fr $(DESTDIR)$(LUADIR)/*.lua
|
|
rm -fr $(DESTDIR)$(LUADIR)
|
|
rm -fr $(DESTDIR)$(PRIVDIR)
|
|
rm -fr $(DESTDIR)$(EJABBERDDIR)
|
|
|
|
uninstall-all: uninstall-binary
|
|
rm -rf $(DESTDIR)$(ETCDIR)
|
|
rm -rf $(DESTDIR)$(EJABBERDDIR)
|
|
rm -rf $(DESTDIR)$(SPOOLDIR)
|
|
rm -rf $(DESTDIR)$(LOGDIR)
|
|
|
|
clean:
|
|
rm -rf $(DEPSDIR)/.got
|
|
rm -rf $(DEPSDIR)/.built
|
|
rm -rf test/*.beam
|
|
rm -f rebar.lock
|
|
rm -f ejabberdctl.example ejabberd.init ejabberd.service
|
|
$(REBAR) clean $(CLEANARG)
|
|
|
|
clean-rel:
|
|
rm -rf rel/ejabberd
|
|
|
|
distclean: clean clean-rel
|
|
rm -f aclocal.m4
|
|
rm -f config.status
|
|
rm -f config.log
|
|
rm -rf autom4te.cache
|
|
rm -rf $(EBINDIR)
|
|
rm -rf $(DEPSBASE)
|
|
rm -rf deps
|
|
rm -f Makefile
|
|
rm -f vars.config
|
|
|
|
rel:
|
|
$(REBARREL)
|
|
|
|
DEV_CONFIG = _build/dev/rel/ejabberd/conf/ejabberd.yml
|
|
|
|
dev $(DEV_CONFIG):
|
|
$(REBARDEV)
|
|
|
|
TAGS:
|
|
etags *.erl
|
|
|
|
Makefile: Makefile.in
|
|
|
|
ifeq "$(REBAR_VER)" "3"
|
|
dialyzer:
|
|
find src/*_opt.erl -type f \! -regex ".*git.*" -exec sed -i 's/re:mp/ tuple/g' {} \;
|
|
$(REBAR) dialyzer
|
|
find src/*_opt.erl -type f \! -regex ".*git.*" -exec sed -i 's/ tuple/re:mp/g' {} \;
|
|
else
|
|
deps := $(wildcard $(DEPSDIR)/*/ebin)
|
|
|
|
dialyzer/erlang.plt:
|
|
@mkdir -p dialyzer
|
|
@dialyzer --build_plt --output_plt dialyzer/erlang.plt \
|
|
-o dialyzer/erlang.log --apps kernel stdlib sasl crypto \
|
|
public_key ssl mnesia inets odbc compiler erts \
|
|
os_mon asn1 syntax_tools; \
|
|
status=$$? ; if [ $$status -ne 2 ]; then exit $$status; else exit 0; fi
|
|
|
|
dialyzer/deps.plt:
|
|
@mkdir -p dialyzer
|
|
@dialyzer --build_plt --output_plt dialyzer/deps.plt \
|
|
-o dialyzer/deps.log $(deps); \
|
|
status=$$? ; if [ $$status -ne 2 ]; then exit $$status; else exit 0; fi
|
|
|
|
dialyzer/ejabberd.plt:
|
|
@mkdir -p dialyzer
|
|
@dialyzer --build_plt --output_plt dialyzer/ejabberd.plt \
|
|
-o dialyzer/ejabberd.log ebin; \
|
|
status=$$? ; if [ $$status -ne 2 ]; then exit $$status; else exit 0; fi
|
|
|
|
erlang_plt: dialyzer/erlang.plt
|
|
@dialyzer --plt dialyzer/erlang.plt --check_plt -o dialyzer/erlang.log; \
|
|
status=$$? ; if [ $$status -ne 2 ]; then exit $$status; else exit 0; fi
|
|
|
|
deps_plt: dialyzer/deps.plt
|
|
@dialyzer --plt dialyzer/deps.plt --check_plt -o dialyzer/deps.log; \
|
|
status=$$? ; if [ $$status -ne 2 ]; then exit $$status; else exit 0; fi
|
|
|
|
ejabberd_plt: dialyzer/ejabberd.plt
|
|
@dialyzer --plt dialyzer/ejabberd.plt --check_plt -o dialyzer/ejabberd.log; \
|
|
status=$$? ; if [ $$status -ne 2 ]; then exit $$status; else exit 0; fi
|
|
|
|
dialyzer: erlang_plt deps_plt ejabberd_plt
|
|
@dialyzer --plts dialyzer/*.plt --no_check_plt \
|
|
--get_warnings -o dialyzer/error.log ebin; \
|
|
status=$$? ; if [ $$status -ne 2 ]; then exit $$status; else exit 0; fi
|
|
endif
|
|
|
|
test:
|
|
@echo "************************** NOTICE ***************************************"
|
|
@cat test/README
|
|
@echo "*************************************************************************"
|
|
@cd priv && ln -sf ../sql
|
|
$(REBAR) $(SKIPDEPS) ct
|
|
|
|
.PHONY: src edoc dialyzer Makefile TAGS clean clean-rel distclean rel \
|
|
install uninstall uninstall-binary uninstall-all translations deps test \
|
|
quicktest erlang_plt deps_plt ejabberd_plt xref hooks options
|
|
|
|
help:
|
|
@echo ""
|
|
@echo " [all] "
|
|
@echo " scripts Prepare ejabberd start scripts"
|
|
@echo " deps Get and configure dependencies"
|
|
@echo " src Compile dependencies and ejabberd"
|
|
@echo " update Update dependencies' source code"
|
|
@echo " clean Clean binary files"
|
|
@echo " distclean Clean completely the development files"
|
|
@echo ""
|
|
@echo " install Install ejabberd to /usr/local"
|
|
@echo " uninstall Uninstall ejabberd (buggy)"
|
|
@echo " uninstall-all Uninstall also configuration, logs, mnesia... (buggy)"
|
|
@echo ""
|
|
@echo " rel Build a production release"
|
|
@echo " dev Build a development release"
|
|
@echo " relive Start a live ejabberd in _build/relive/"
|
|
@echo ""
|
|
@echo " doap Generate DOAP file"
|
|
@echo " edoc Generate edoc documentation (unused)"
|
|
@echo " options Generate ejabberd_option.erl"
|
|
@echo " translations Extract translation files (requires --enable-tools)"
|
|
@echo " tags Generate tags file for text editors"
|
|
@echo ""
|
|
@echo " dialyzer Run Dialyzer static analyzer"
|
|
@echo " hooks Run hooks validator"
|
|
@echo " test Run Common Tests suite"
|
|
@echo " xref Run cross reference analysis"
|