aboutsummaryrefslogtreecommitdiff
path: root/src/Makefile.in
blob: 9131fca6fd450d0da8df9a844d9814c02912adfc (plain) (blame)
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
# $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@

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

ifdef ejabberd_debug
  ERLC_FLAGS+=-Dejabberd_debug
endif

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

prefix = @prefix@

SUBDIRS = @mod_irc@ @mod_pubsub@ @mod_muc@ @mod_proxy65@ @eldap@ @web@ stringprep @tls@ @odbc@ @ejabberd_zlib@
ERLSHLIBS = expat_erl.so
SOURCES = $(wildcard *.erl)
BEAMS = $(SOURCES:.erl=.beam)

DESTDIR = 

EJABBERDDIR = $(DESTDIR)@prefix@/var/lib/ejabberd
BEAMDIR = $(EJABBERDDIR)/ebin
PRIVDIR = $(EJABBERDDIR)/priv
SODIR = $(PRIVDIR)/lib
MSGSDIR = $(PRIVDIR)/msgs
LOGDIR = $(DESTDIR)@prefix@/var/log/ejabberd
ETCDIR = $(DESTDIR)@prefix@/etc/ejabberd

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

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

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

compile-beam: XmppAddr.hrl $(BEAMS)

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


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) $<

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

install: all
	install -d $(BEAMDIR)
	install -m 644 *.beam $(BEAMDIR)
	rm -f $(BEAMDIR)/configure.beam
	install -m 644 *.app $(BEAMDIR)
	install -d $(SODIR)
	install -m 644 *.so $(SODIR)
	install -d $(MSGSDIR)
	install -m 644 msgs/*.msg $(MSGSDIR)
	install -d $(ETCDIR)
	install -b -m 644 ejabberd.cfg.example $(ETCDIR)/ejabberd.cfg
	install -d $(LOGDIR)

clean: clean-recursive clean-local

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

distclean: distclean-recursive clean-local
	rm -f config.status
	rm -f config.log
	rm -f Makefile

TAGS:
	etags *.erl

Makefile: Makefile.in