-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathMakefile
63 lines (55 loc) · 2.11 KB
/
Makefile
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
#
# Makefile for Asterisk amqp resource
# Copyright (C) 2017, Sylvain Boily
#
# This program is free software, distributed under the terms of
# the GNU General Public License Version 3. See the COPYING file
# at the top of the source tree.
#
ASTLIBDIR:=$(shell awk '/moddir/{print $$3}' /etc/asterisk/asterisk.conf 2> /dev/null)
ifeq ($(strip $(ASTLIBDIR)),)
MODULES_DIR:=$(INSTALL_PREFIX)/usr/lib/asterisk/modules
else
MODULES_DIR:=$(INSTALL_PREFIX)$(ASTLIBDIR)
endif
ifeq ($(strip $(DOCDIR)),)
DOCUMENTATION_DIR:=$(INSTALL_PREFIX)/usr/share/asterisk/documentation/thirdparty
else
DOCUMENTATION_DIR:=$(INSTALL_PREFIX)$(DOCDIR)
endif
INSTALL = install
ASTETCDIR = $(INSTALL_PREFIX)/etc/asterisk
SAMPLENAME = amqp.conf.sample
CONFNAME = $(basename $(SAMPLENAME))
TARGET = res_amqp.so
OBJECTS = res_amqp.o amqp/cli.o amqp/config.o
CFLAGS += -I.
CFLAGS += -DHAVE_STDINT_H=1
CFLAGS += -Wall -Wextra -Wno-unused-parameter -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Winit-self -Wmissing-format-attribute \
-Wformat=2 -g -fPIC -D_GNU_SOURCE -D'AST_MODULE="res_amqp"' -D'AST_MODULE_SELF_SYM=__internal_res_amqp_self'
LIBS += -lrabbitmq
LDFLAGS = -Wall -shared
.PHONY: install clean
$(TARGET): $(OBJECTS)
$(CC) $(LDFLAGS) $(OBJECTS) -o $@ $(LIBS)
%.o: %.c $(HEADERS)
$(CC) -c $(CFLAGS) -o $@ $<
install: $(TARGET)
mkdir -p $(DESTDIR)$(MODULES_DIR)
mkdir -p $(DESTDIR)$(DOCUMENTATION_DIR)
install -m 644 $(TARGET) $(DESTDIR)$(MODULES_DIR)
install -m 644 documentation/* $(DESTDIR)$(DOCUMENTATION_DIR)
@echo " +----------- res_amqp installed ------------+"
@echo " + +"
@echo " + res_amqp has successfully been installed +"
@echo " + If you would like to install the sample +"
@echo " + configuration file run: +"
@echo " + +"
@echo " + make samples +"
@echo " +-------------------------------------------+"
clean:
rm -f $(OBJECTS)
rm -f $(TARGET)
samples:
$(INSTALL) -m 644 $(SAMPLENAME) $(DESTDIR)$(ASTETCDIR)/$(CONFNAME)
@echo " ------- res_amqp config installed ---------"