Skip to content
This repository
Fetching contributors…

Cannot retrieve contributors at this time

file 316 lines (262 sloc) 7.823 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316
# $Id$

CC = @CC@
CFLAGS = @CFLAGS@
CPPFLAGS = @CPPFLAGS@
LDFLAGS = @LDFLAGS@
LIBS = @LIBS@

EXPAT_CFLAGS = @EXPAT_CFLAGS@
ERLANG_CFLAGS= @ERLANG_CFLAGS@

EXPAT_LIBS = @EXPAT_LIBS@
ERLANG_LIBS = @ERLANG_LIBS@

ASN_FLAGS = -bber_bin +der +compact_bit_string +optimize +noobj

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

EFLAGS += @ERLANG_SSLVER@ -pa .
ERLANG_CFLAGS += @ERLANG_SSLVER@

# make debug=true to compile Erlang module with debug informations.
ifdef debug
  EFLAGS+=+debug_info +export_all
endif

DEBUGTOOLS = p1_prof.erl
ifdef debugtools
  SOURCES+=$(DEBUGTOOLS)
endif

ifeq (@hipe@, true)
  EFLAGS+=+native
endif

ifeq (@roster_gateway_workaround@, true)
  EFLAGS+=-DROSTER_GATEWAY_WORKAROUND
endif

ifeq (@full_xml@, true)
  EFLAGS+=-DFULL_XML_SUPPORT
endif

ifeq (@nif@, true)
  EFLAGS+=-DNIF
  ERLSHLIBS=xml.so
endif

ifeq (@transient_supervisors@, false)
  EFLAGS+=-DNO_TRANSIENT_SUPERVISORS
endif

ifeq (@md2@, true)
  EFLAGS+=-DHAVE_MD2
  ERLANG_CFLAGS += -DHAVE_MD2
endif

INSTALL_EPAM=
ifeq (@pam@, pam)
  INSTALL_EPAM=install -m 750 $(O_USER) epam $(PBINDIR)
endif

prefix = @prefix@
exec_prefix = @exec_prefix@

SUBDIRS = @mod_irc@ @mod_pubsub@ @mod_muc@ @mod_proxy65@ @eldap@ @pam@ @web@ stringprep stun @tls@ @odbc@ @ejabberd_zlib@
ERLSHLIBS += expat_erl.so
ERLBEHAVS = cyrsasl.erl gen_mod.erl p1_fsm.erl
SOURCES_ALL = $(wildcard *.erl)
SOURCES_MISC = $(ERLBEHAVS) $(DEBUGTOOLS)
SOURCES += $(filter-out $(SOURCES_MISC),$(SOURCES_ALL))
ERLBEHAVBEAMS = $(ERLBEHAVS:.erl=.beam)
BEAMS = $(SOURCES:.erl=.beam)

DESTDIR =

# /etc/ejabberd/
ETCDIR = $(DESTDIR)@sysconfdir@/ejabberd

# /sbin/
SBINDIR = $(DESTDIR)@sbindir@

# /lib/ejabberd/
EJABBERDDIR = $(DESTDIR)@libdir@/ejabberd

# /share/doc/ejabberd
PACKAGE_TARNAME = @PACKAGE_TARNAME@
datarootdir = @datarootdir@
DOCDIR = $(DESTDIR)@docdir@

# /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

# /var/lib/ejabberd/
SPOOLDIR = $(DESTDIR)@localstatedir@/lib/ejabberd

# /var/lock/ejabberdctl
CTLLOCKDIR = $(DESTDIR)@localstatedir@/lock/ejabberdctl

# /var/lib/ejabberd/.erlang.cookie
COOKIEFILE = $(SPOOLDIR)/.erlang.cookie

# /var/log/ejabberd/
LOGDIR = $(DESTDIR)@localstatedir@/log/ejabberd

# Assume Linux-style dynamic library flags
DYNAMIC_LIB_CFLAGS = -fpic -shared
ifeq ($(shell uname),Darwin)
    DYNAMIC_LIB_CFLAGS = -fPIC -bundle -flat_namespace -undefined suppress
endif
ifeq ($(shell uname),SunOs)
    DYNAMIC_LIB_CFLAGS = -KPIC -G -z text
endif

all: $(ERLSHLIBS) compile-beam all-recursive

compile-beam: XmppAddr.hrl $(ERLBEHAVBEAMS) $(BEAMS)

$(BEAMS): $(ERLBEHAVBEAMS)

all-recursive: $(ERLBEHAVBEAMS)

%.beam: %.erl
@ERLC@ -W $(EFLAGS) $<


all-recursive install-recursive uninstall-recursive \
clean-recursive distclean-recursive \
mostlyclean-recursive maintainer-clean-recursive:
@subdirs="$(SUBDIRS)"; for subdir in $$subdirs; do \
target=`echo $@|sed 's,-recursive,,'`; \
echo making $$target in $$subdir; \
(cd $$subdir && $(MAKE) $$target) || exit 1; \
done


%.hrl: %.asn1
@ERLC@ $(ASN_FLAGS) $<
@ERLC@ -W $(EFLAGS) $*.erl

$(ERLSHLIBS): %.so: %.c
$(CC) $(CFLAGS) $(LDFLAGS) $(LIBS) \
$(subst ../,,$(subst .so,.c,$@)) \
$(EXPAT_LIBS) \
$(EXPAT_CFLAGS) \
$(ERLANG_LIBS) \
$(ERLANG_CFLAGS) \
-o $@ \
$(DYNAMIC_LIB_CFLAGS)

translations:
../contrib/extract_translations/prepare-translation.sh -updateall

install: all
#
# Configuration files
install -d -m 750 $(G_USER) $(ETCDIR)
[ -f $(ETCDIR)/ejabberd.cfg ] \
&& install -b -m 640 $(G_USER) ejabberd.cfg.example $(ETCDIR)/ejabberd.cfg-new \
|| install -b -m 640 $(G_USER) ejabberd.cfg.example $(ETCDIR)/ejabberd.cfg
sed -e "s*@rootdir@*@prefix@*" \
-e "s*@installuser@*@INSTALLUSER@*" \
-e "s*@LIBDIR@*@libdir@*" \
-e "s*@SYSCONFDIR@*@sysconfdir@*" \
-e "s*@LOCALSTATEDIR@*@localstatedir@*" \
-e "s*@DOCDIR@*@docdir@*" \
-e "s*@erl@*@ERL@*" ejabberdctl.template \
> ejabberdctl.example
[ -f $(ETCDIR)/ejabberdctl.cfg ] \
&& install -b -m 640 $(G_USER) ejabberdctl.cfg.example $(ETCDIR)/ejabberdctl.cfg-new \
|| install -b -m 640 $(G_USER) ejabberdctl.cfg.example $(ETCDIR)/ejabberdctl.cfg
install -b -m 644 $(G_USER) inetrc $(ETCDIR)/inetrc
#
# Administration script
[ -d $(SBINDIR) ] || install -d -m 755 $(SBINDIR)
install -m 550 $(G_USER) ejabberdctl.example $(SBINDIR)/ejabberdctl
#
# Init script
sed -e "s*@ctlscriptpath@*$(SBINDIR)*" \
-e "s*@installuser@*$(INIT_USER)*" ejabberd.init.template \
> ejabberd.init
chmod 755 ejabberd.init
#
# Binary Erlang files
install -d $(BEAMDIR)
install -m 644 *.app $(BEAMDIR)
install -m 644 *.beam $(BEAMDIR)
rm -f $(BEAMDIR)/configure.beam
#
# ejabberd header files
install -d $(INCLUDEDIR)
install -m 644 *.hrl $(INCLUDEDIR)
install -d $(INCLUDEDIR)/eldap/
install -m 644 eldap/*.hrl $(INCLUDEDIR)/eldap/
install -d $(INCLUDEDIR)/mod_muc/
install -m 644 mod_muc/*.hrl $(INCLUDEDIR)/mod_muc/
install -d $(INCLUDEDIR)/mod_proxy65/
install -m 644 mod_proxy65/*.hrl $(INCLUDEDIR)/mod_proxy65/
install -d $(INCLUDEDIR)/mod_pubsub/
install -m 644 mod_pubsub/*.hrl $(INCLUDEDIR)/mod_pubsub/
install -d $(INCLUDEDIR)/web/
install -m 644 web/*.hrl $(INCLUDEDIR)/web/
#
# Binary C programs
install -d $(PBINDIR)
install -m 750 $(O_USER) ../tools/captcha.sh $(PBINDIR)
$(INSTALL_EPAM)
#
# Binary system libraries
install -d $(SODIR)
install -m 644 *.so $(SODIR)
#
# Translated strings
install -d $(MSGSDIR)
install -m 644 msgs/*.msg $(MSGSDIR)
#
# Spool directory
install -d -m 750 $(O_USER) $(SPOOLDIR)
$(CHOWN_COMMAND) -R @INSTALLUSER@ $(SPOOLDIR) >$(CHOWN_OUTPUT)
chmod -R 750 $(SPOOLDIR)
[ ! -f $(COOKIEFILE) ] || { $(CHOWN_COMMAND) @INSTALLUSER@ $(COOKIEFILE) >$(CHOWN_OUTPUT) ; chmod 400 $(COOKIEFILE) ; }
#
# ejabberdctl lock directory
install -d -m 750 $(O_USER) $(CTLLOCKDIR)
$(CHOWN_COMMAND) -R @INSTALLUSER@ $(CTLLOCKDIR) >$(CHOWN_OUTPUT)
chmod -R 750 $(CTLLOCKDIR)
#
# Log directory
install -d -m 750 $(O_USER) $(LOGDIR)
$(CHOWN_COMMAND) -R @INSTALLUSER@ $(LOGDIR) >$(CHOWN_OUTPUT)
chmod -R 750 $(LOGDIR)
#
# Documentation
install -d $(DOCDIR)
install -m 644 ../doc/dev.html $(DOCDIR)
install -m 644 ../doc/guide.html $(DOCDIR)
install -m 644 ../doc/*.png $(DOCDIR)
install -m 644 ../doc/*.txt $(DOCDIR)
[ -f ../doc/guide.pdf ] \
&& install -m 644 ../doc/guide.pdf $(DOCDIR) \
|| echo "No ../doc/guide.pdf was built"
install -m 644 ../COPYING $(DOCDIR)

uninstall: uninstall-binary

uninstall-binary:
rm -f $(SBINDIR)/ejabberdctl
rm -fr $(DOCDIR)
rm -f $(BEAMDIR)/*.beam
rm -f $(BEAMDIR)/*.app
rm -fr $(BEAMDIR)
rm -f $(INCLUDEDIR)/*.hrl
rm -fr $(INCLUDEDIR)
rm -fr $(PBINDIR)
rm -f $(SODIR)/*.so
rm -fr $(SODIR)
rm -f $(MSGSDIR)/*.msgs
rm -fr $(MSGSDIR)
rm -fr $(PRIVDIR)
rm -fr $(EJABBERDDIR)

uninstall-all: uninstall-binary
rm -rf $(ETCDIR)
rm -rf $(EJABBERDDIR)
rm -rf $(SPOOLDIR)
rm -rf $(CTLLOCKDIR)
rm -rf $(LOGDIR)

clean: clean-recursive clean-local

clean-local:
rm -f *.beam $(ERLSHLIBS) epam ejabberdctl.example
rm -f XmppAddr.asn1db XmppAddr.erl XmppAddr.hrl

distclean: distclean-recursive clean-local
rm -f config.status
rm -f config.log
rm -f Makefile
[ ! -f ../ChangeLog ] || rm -f ../ChangeLog

TAGS:
etags *.erl

Makefile: Makefile.in

dialyzer: $(BEAMS)
@dialyzer -c .
Something went wrong with that request. Please try again.