Makefile: Add a rule 'basic-pbx' that installs the Basic PBX configs

This patch adds a rule for installing the Super Awesome Company based 'Basic
PBX' configuration files. As part of adding this rule, a bit of the content
that makes up installing the configuration files under the 'samples' target
was refactored into a make subroutine for usage by additional later config
make targets.

Change-Id: I6c2e27906f73e2919a2b691da0be20ae70302404
This commit is contained in:
Matt Jordan
2015-10-30 13:22:23 -05:00
parent 9a021a42ad
commit 118d628e08

View File

@@ -124,7 +124,7 @@ empty:=
space:=$(empty) $(empty) space:=$(empty) $(empty)
ASTTOPDIR:=$(subst $(space),\$(space),$(CURDIR)) ASTTOPDIR:=$(subst $(space),\$(space),$(CURDIR))
# Overwite config files on "make samples" # Overwite config files on "make samples" or other config installation targets
OVERWRITE=y OVERWRITE=y
# Include debug and macro symbols in the executables (-g) and profiling info (-pg) # Include debug and macro symbols in the executables (-g) and profiling info (-pg)
@@ -652,7 +652,12 @@ install: badshell bininstall datafiles
@echo " + configuration files (overwriting any +" @echo " + configuration files (overwriting any +"
@echo " + existing config files), run: +" @echo " + existing config files), run: +"
@echo " + +" @echo " + +"
@echo " + $(mK) samples +" @echo " + For generic reference documentation: +"
@echo " + $(mK) samples +"
@echo " + +"
@echo " + For a sample basic PBX: +"
@echo " + $(mK) basic-pbx +"
@echo " + +"
@echo " + +" @echo " + +"
@echo " +----------------- or ---------------------+" @echo " +----------------- or ---------------------+"
@echo " + +" @echo " + +"
@@ -670,24 +675,14 @@ isntall: install
upgrade: bininstall upgrade: bininstall
# XXX why *.adsi is installed first ?
adsi:
@echo Installing adsi config files...
$(INSTALL) -d "$(DESTDIR)$(ASTETCDIR)"
@for x in configs/samples/*.adsi; do \
dst="$(DESTDIR)$(ASTETCDIR)/`$(BASENAME) $$x`" ; \
if [ -f "$${dst}" ] ; then \
echo "Overwriting $$x" ; \
else \
echo "Installing $$x" ; \
fi ; \
$(INSTALL) -m 644 "$$x" "$(DESTDIR)$(ASTETCDIR)/`$(BASENAME) $$x`" ; \
done
samples: adsi # Install configuration files from the specified directory
@echo Installing other config files... # Parameters:
@for x in configs/samples/*.sample; do \ # (1) the configuration directory to install from
dst="$(DESTDIR)$(ASTETCDIR)/`$(BASENAME) $$x .sample`" ; \ # (2) the extension to strip off
define INSTALL_CONFIGS
@for x in configs/$(1)/*$(2); do \
dst="$(DESTDIR)$(ASTETCDIR)/`$(BASENAME) $$x $(2)`"; \
if [ -f "$${dst}" ]; then \ if [ -f "$${dst}" ]; then \
if [ "$(OVERWRITE)" = "y" ]; then \ if [ "$(OVERWRITE)" = "y" ]; then \
if cmp -s "$${dst}" "$$x" ; then \ if cmp -s "$${dst}" "$$x" ; then \
@@ -702,7 +697,7 @@ samples: adsi
fi ; \ fi ; \
echo "Installing file $$x"; \ echo "Installing file $$x"; \
$(INSTALL) -m 644 "$$x" "$${dst}" ;\ $(INSTALL) -m 644 "$$x" "$${dst}" ;\
done done ; \
if [ "$(OVERWRITE)" = "y" ]; then \ if [ "$(OVERWRITE)" = "y" ]; then \
echo "Updating asterisk.conf" ; \ echo "Updating asterisk.conf" ; \
sed -e 's|^astetcdir.*$$|astetcdir => $(ASTETCDIR)|' \ sed -e 's|^astetcdir.*$$|astetcdir => $(ASTETCDIR)|' \
@@ -719,10 +714,28 @@ samples: adsi
"$(DESTDIR)$(ASTCONFPATH)" > "$(DESTDIR)$(ASTCONFPATH).tmp" ; \ "$(DESTDIR)$(ASTCONFPATH)" > "$(DESTDIR)$(ASTCONFPATH).tmp" ; \
$(INSTALL) -m 644 "$(DESTDIR)$(ASTCONFPATH).tmp" "$(DESTDIR)$(ASTCONFPATH)" ; \ $(INSTALL) -m 644 "$(DESTDIR)$(ASTCONFPATH).tmp" "$(DESTDIR)$(ASTCONFPATH)" ; \
rm -f "$(DESTDIR)$(ASTCONFPATH).tmp" ; \ rm -f "$(DESTDIR)$(ASTCONFPATH).tmp" ; \
fi ; \ fi
endef
# XXX why *.adsi is installed first ?
adsi:
@echo Installing adsi config files...
$(INSTALL) -d "$(DESTDIR)$(ASTETCDIR)"
@for x in configs/samples/*.adsi; do \
dst="$(DESTDIR)$(ASTETCDIR)/`$(BASENAME) $$x`" ; \
if [ -f "$${dst}" ] ; then \
echo "Overwriting $$x" ; \
else \
echo "Installing $$x" ; \
fi ; \
$(INSTALL) -m 644 "$$x" "$(DESTDIR)$(ASTETCDIR)/`$(BASENAME) $$x`" ; \
done
samples: adsi
@echo Installing other config files...
$(call INSTALL_CONFIGS,samples,.sample)
$(INSTALL) -d "$(DESTDIR)$(ASTSPOOLDIR)/voicemail/default/1234/INBOX" $(INSTALL) -d "$(DESTDIR)$(ASTSPOOLDIR)/voicemail/default/1234/INBOX"
build_tools/make_sample_voicemail "$(DESTDIR)/$(ASTDATADIR)" "$(DESTDIR)/$(ASTSPOOLDIR)" build_tools/make_sample_voicemail "$(DESTDIR)/$(ASTDATADIR)" "$(DESTDIR)/$(ASTSPOOLDIR)"
@for x in phoneprov/*; do \ @for x in phoneprov/*; do \
dst="$(DESTDIR)$(ASTDATADIR)/$$x" ; \ dst="$(DESTDIR)$(ASTDATADIR)/$$x" ; \
if [ -f "$${dst}" ]; then \ if [ -f "$${dst}" ]; then \
@@ -741,6 +754,10 @@ samples: adsi
$(INSTALL) -m 644 "$$x" "$${dst}" ;\ $(INSTALL) -m 644 "$$x" "$${dst}" ;\
done done
basic-pbx:
@echo Installing basic-pbx config files...
$(call INSTALL_CONFIGS,basic-pbx)
webvmail: webvmail:
@[ -d "$(DESTDIR)$(HTTP_DOCSDIR)/" ] || ( printf "http docs directory not found.\nUpdate assignment of variable HTTP_DOCSDIR in Makefile!\n" && exit 1 ) @[ -d "$(DESTDIR)$(HTTP_DOCSDIR)/" ] || ( printf "http docs directory not found.\nUpdate assignment of variable HTTP_DOCSDIR in Makefile!\n" && exit 1 )
@[ -d "$(DESTDIR)$(HTTP_CGIDIR)" ] || ( printf "cgi-bin directory not found.\nUpdate assignment of variable HTTP_CGIDIR in Makefile!\n" && exit 1 ) @[ -d "$(DESTDIR)$(HTTP_CGIDIR)" ] || ( printf "cgi-bin directory not found.\nUpdate assignment of variable HTTP_CGIDIR in Makefile!\n" && exit 1 )
@@ -1013,6 +1030,7 @@ endif
.PHONY: validate-docs .PHONY: validate-docs
.PHONY: _clean .PHONY: _clean
.PHONY: ari-stubs .PHONY: ari-stubs
.PHONY: basic-pbx
.PHONY: $(SUBDIRS_INSTALL) .PHONY: $(SUBDIRS_INSTALL)
.PHONY: $(SUBDIRS_DIST_CLEAN) .PHONY: $(SUBDIRS_DIST_CLEAN)
.PHONY: $(SUBDIRS_CLEAN) .PHONY: $(SUBDIRS_CLEAN)