aboutsummaryrefslogtreecommitdiff
path: root/Makefile.in
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile.in')
-rw-r--r--Makefile.in124
1 files changed, 67 insertions, 57 deletions
diff --git a/Makefile.in b/Makefile.in
index 87ace381a..0d9134485 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -17,6 +17,9 @@ BINDIR = $(DESTDIR)@bindir@
# /sbin/
SBINDIR = $(DESTDIR)@sbindir@
+# /lib/
+LIBDIR = $(DESTDIR)@libdir@
+
# /lib/ejabberd/
EJABBERDDIR = $(DESTDIR)@libdir@/ejabberd
@@ -101,21 +104,73 @@ xref: all
translations:
contrib/extract_translations/prepare-translation.sh -updateall
-doc:
- echo making $$target in doc; \
- (cd doc && $(MAKE) $$target) || exit 1
-
edoc:
$(ERL) -noinput +B -eval \
'case edoc:application(ejabberd, ".", []) of ok -> halt(0); error -> halt(1) end.'
spec:
$(ERL) -noinput +B -pa ebin -pa deps/*/ebin -eval \
- 'case xml_gen:compile("tools/xmpp_codec.spec") of ok -> halt(0); _ -> halt(1) end.'
+ 'case fxml_gen:compile("tools/xmpp_codec.spec") of ok -> halt(0); _ -> 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))
+
+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 XdepsX,,X$(word 1,$(1))X),$(call MAIN_TO_DEST,$(1)),$(if $(subst XlibX,,X$(word 3,$(1))X),$(call DEPS_TO_DEST,$(1)),$(call ELIXIR_TO_DEST,$(1))))
+TO_DEST=$(foreach path,$(1),$(call JOIN_PATHS,$(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 $(REBAR) list-deps|$(SED) -e '/^=/d;s/ .*//'))
+
+DEPS_FILES=$(call FILES_WILDCARD,$(foreach DEP,$(DEPS),deps/$(DEP)/ebin/*.beam deps/$(DEP)/ebin/*.app deps/$(DEP)/priv/* deps/$(DEP)/priv/lib/* deps/$(DEP)/priv/bin/* deps/$(DEP)/include/*.hrl deps/$(DEP)/lib/*/ebin/*.beam deps/$(DEP)/lib/*/ebin/*.app))
+DEPS_FILES_FILTERED=$(filter-out %/epam deps/elixir/ebin/elixir.app,$(DEPS_FILES))
+DEPS_DIRS=$(sort deps/ $(foreach DEP,$(DEPS),deps/$(DEP)/) $(dir $(DEPS_FILES)))
+
+MAIN_FILES=$(filter-out %/configure.beam,$(call FILES_WILDCARD,ebin/*.beam ebin/*.app priv/msgs/*.msg priv/lib/* include/*.hrl))
+MAIN_DIRS=$(sort $(dir $(MAIN_FILES)) priv/bin priv/sql)
+
+define DEP_VERSION_template
+DEP_$(1)_VERSION:=$(shell $(SED) -e '/vsn/!d;s/.*, *"/$(1)-/;s/".*//' $(2) 2>/dev/null)
+endef
+
+$(foreach DEP,$(DEPS),$(eval $(call DEP_VERSION_template,$(DEP),deps/$(DEP)/ebin/$(DEP).app)))
+$(eval $(call DEP_VERSION_template,ejabberd,ebin/ejabberd.app))
+
+define COPY_template
+$(call TO_DEST,$(1)): $(1) $(call TO_DEST,$(dir $(1))) ; $$(INSTALL) -m 644 $(1) $(call TO_DEST,$(1))
+endef
+
+$(foreach file,$(DEPS_FILES_FILTERED) $(MAIN_FILES),$(eval $(call COPY_template,$(file))))
-DLLs := $(wildcard deps/*/priv/*.so) $(wildcard deps/*/priv/lib/*.so)
+$(sort $(call TO_DEST,$(MAIN_DIRS) $(DEPS_DIRS))):
+ $(INSTALL) -d $@
-install: all
+$(call TO_DEST,deps/p1_pam/priv/bin/epam): $(LIBDIR)/%: deps/p1_pam/priv/bin/epam $(call TO_DEST,deps/p1_pam/priv/bin/)
+ $(INSTALL) -m 750 $(O_USER) $< $@
+
+$(call TO_DEST,priv/sql/lite.sql): sql/lite.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 750 $(O_USER) $< $@
+
+copy-files-sub2: $(call TO_DEST,$(DEPS_FILES) $(MAIN_FILES) priv/bin/captcha.sh priv/sql/lite.sql)
+
+endif
+
+copy-files:
+ $(MAKE) copy-files-sub
+
+copy-files-sub: copy-files-sub2
+
+install: all copy-files
#
# Configuration files
$(INSTALL) -d -m 750 $(G_USER) $(ETCDIR)
@@ -141,9 +196,9 @@ install: all
$(INSTALL) -m 550 $(G_USER) ejabberdctl.example $(SBINDIR)/ejabberdctl
# Elixir binaries
[ -d $(BINDIR) ] || $(INSTALL) -d -m 755 $(BINDIR)
- -[ -f deps/elixir/bin/iex ] && $(INSTALL) -m 550 $(G_USER) deps/elixir/bin/iex $(BINDIR)/iex
- -[ -f deps/elixir/bin/elixir ] && $(INSTALL) -m 550 $(G_USER) deps/elixir/bin/elixir $(BINDIR)/elixir
- -[ -f deps/elixir/bin/mix ] && $(INSTALL) -m 550 $(G_USER) deps/elixir/bin/mix $(BINDIR)/mix
+ [ -f deps/elixir/bin/iex ] && $(INSTALL) -m 550 $(G_USER) deps/elixir/bin/iex $(BINDIR)/iex || true
+ [ -f deps/elixir/bin/elixir ] && $(INSTALL) -m 550 $(G_USER) deps/elixir/bin/elixir $(BINDIR)/elixir || true
+ [ -f deps/elixir/bin/mix ] && $(INSTALL) -m 550 $(G_USER) deps/elixir/bin/mix $(BINDIR)/mix || true
#
# Init script
$(SED) -e "s*@ctlscriptpath@*$(SBINDIR)*" \
@@ -151,44 +206,6 @@ install: all
> ejabberd.init
chmod 755 ejabberd.init
#
- # Binary Erlang files
- $(INSTALL) -d $(BEAMDIR)
- $(INSTALL) -m 644 ebin/*.app $(BEAMDIR)
- $(INSTALL) -m 644 ebin/*.beam $(BEAMDIR)
- $(INSTALL) -m 644 deps/*/ebin/*.app $(BEAMDIR)
- $(INSTALL) -m 644 deps/*/ebin/*.beam $(BEAMDIR)
- # Install Elixir and Elixir dependancies
- -$(INSTALL) -m 644 deps/*/lib/*/ebin/*.app $(BEAMDIR)
- -$(INSTALL) -m 644 deps/*/lib/*/ebin/*.beam $(BEAMDIR)
- rm -f $(BEAMDIR)/configure.beam
- #
- # ejabberd header files
- $(INSTALL) -d $(INCLUDEDIR)
- $(INSTALL) -m 644 include/*.hrl $(INCLUDEDIR)
- $(INSTALL) -m 644 deps/*/include/*.hrl $(INCLUDEDIR)
- #
- # Binary C programs
- $(INSTALL) -d $(PBINDIR)
- $(INSTALL) -m 750 $(O_USER) tools/captcha.sh $(PBINDIR)
- $(INSTALL) -m 750 $(O_USER) tools/joincluster $(PBINDIR)
- $(INSTALL) -m 750 $(O_USER) tools/leavecluster $(PBINDIR)
- -[ -f deps/p1_pam/priv/bin/epam ] \
- && $(INSTALL) -m 750 $(O_USER) deps/p1_pam/priv/bin/epam $(PBINDIR)
- #
- # Binary system libraries
- $(INSTALL) -d $(SODIR)
- $(INSTALL) -m 644 $(DLLs) $(SODIR)
- -[ -f $(SODIR)/jiffy.so ] && (cd $(PRIVDIR); ln -s lib/jiffy.so; true)
- -[ -f $(SODIR)/sqlite3_drv.so ] && (cd $(PRIVDIR); ln -s lib/sqlite3_drv.so; true)
- #
- # Translated strings
- $(INSTALL) -d $(MSGSDIR)
- $(INSTALL) -m 644 priv/msgs/*.msg $(MSGSDIR)
- #
- # Copy lite.sql
- -[ -d deps/sqlite3 ] && $(INSTALL) -d $(SQLDIR)
- -[ -d deps/sqlite3 ] && $(INSTALL) -m 644 sql/lite.sql $(SQLDIR)
- #
# Spool directory
$(INSTALL) -d -m 750 $(O_USER) $(SPOOLDIR)
$(CHOWN_COMMAND) -R @INSTALLUSER@ $(SPOOLDIR) >$(CHOWN_OUTPUT)
@@ -207,16 +224,9 @@ install: all
#
# Documentation
$(INSTALL) -d $(DOCDIR)
- [ -f doc/dev.html ] \
- && $(INSTALL) -m 644 doc/dev.html $(DOCDIR) \
- || echo "No doc/dev.html was built"
[ -f doc/guide.html ] \
&& $(INSTALL) -m 644 doc/guide.html $(DOCDIR) \
- || echo "No doc/guide.html was built"
- [ -f doc/guide.pdf ] \
- && $(INSTALL) -m 644 doc/guide.pdf $(DOCDIR) \
- || echo "No doc/guide.pdf was built"
- $(INSTALL) -m 644 doc/*.png $(DOCDIR)
+ || echo "Documentation not included in sources"
$(INSTALL) -m 644 COPYING $(DOCDIR)
uninstall: uninstall-binary
@@ -326,6 +336,6 @@ test:
quicktest:
$(REBAR) skip_deps=true ct suites=elixir
-.PHONY: src doc edoc dialyzer Makefile TAGS clean clean-rel distclean rel \
+.PHONY: src edoc dialyzer Makefile TAGS clean clean-rel distclean rel \
install uninstall uninstall-binary uninstall-all translations deps test spec \
quicktest erlang_plt deps_plt ejabberd_plt