[asterisk-addons-commits] trunk r215 - /trunk/Makefile

asterisk-addons-commits at lists.digium.com asterisk-addons-commits at lists.digium.com
Mon May 8 08:08:24 MST 2006


Author: file
Date: Mon May  8 10:08:23 2006
New Revision: 215

URL: http://svn.digium.com/view/asterisk-addons?rev=215&view=rev
Log:
addition to the Makefile of asterisk-addons (make samples, echo...) (issue #6744 reported by areski)

Modified:
    trunk/Makefile

Modified: trunk/Makefile
URL: http://svn.digium.com/view/asterisk-addons/trunk/Makefile?rev=215&r1=214&r2=215&view=diff
==============================================================================
--- trunk/Makefile (original)
+++ trunk/Makefile Mon May  8 10:08:23 2006
@@ -13,6 +13,13 @@
 
 .EXPORT_ALL_VARIABLES:
 
+
+OSARCH=$(shell uname -s)
+OSREV=$(shell uname -r)
+
+#Overwite config files on "make samples"
+OVERWRITE=y
+
 MODS=format_mp3/format_mp3.so app_saycountpl.so
 
 CFLAGS+=-fPIC
@@ -23,6 +30,20 @@
 INSTALL_PREFIX=
 ASTLIBDIR=$(INSTALL_PREFIX)/usr/lib/asterisk
 MODULES_DIR=$(ASTLIBDIR)/modules
+
+
+ifeq ($(OSARCH),FreeBSD)
+  # XXX FreeBSD paths
+  PREFIX?=/usr/local
+  ASTETCDIR=$(INSTALL_PREFIX)$(PREFIX)/etc/asterisk
+else
+  ifneq ($(OSARCH),SunOS)
+    ASTETCDIR=$(INSTALL_PREFIX)/etc/asterisk
+  else
+    ASTETCDIR=$(INSTALL_PREFIX)/etc/opt/asterisk
+  endif
+endif # FreeBSD
+
 
 #
 # MySQL stuff...  Autoconf anyone??
@@ -51,12 +72,31 @@
 endif
 
 all: depend $(MODS)
+	
+	@echo " +---- 	  Asterisk-Addons Build Complete   ----+"
+	@echo " +                                             +"
+	@echo " +    Addons has successfully been built .     +"
+	@echo " +    If you would like to install it :        +"
+	@echo " +                                             +"
+	@echo " +               $(MAKE) install                  +"
+	@echo " +---------------------------------------------+"
 
 format_mp3/format_mp3.so:
 	$(MAKE) -C format_mp3 all
 
 install: all
 	for x in $(MODS); do $(INSTALL) -m 755 $$x $(DESTDIR)$(MODULES_DIR) ; done
+
+	@echo " +---- Asterisk-Addons Installation Complete ----+"
+	@echo " +                                               +"
+	@echo " +    Addons has successfully been installed.    +"
+	@echo " +    If you would like to install the sample    +"
+	@echo " +    configuration files (overwriting any       +"
+	@echo " +    existing config files), run:               +"
+	@echo " +                                               +"
+	@echo " +               $(MAKE) samples                    +"
+	@echo " +-----------------------------------------------+"
+
 
 clean:
 	rm -f *.so *.o .depend
@@ -83,6 +123,24 @@
 .depend:
 	./mkdep $(CFLAGS) `ls *.c`
 
+samples: 
+	mkdir -p $(DESTDIR)$(ASTETCDIR)
+	for x in configs/*.sample; do \
+		if [ -f $(DESTDIR)$(ASTETCDIR)/`basename $$x .sample` ]; then \
+			if [ "$(OVERWRITE)" = "y" ]; then \
+                                if cmp -s $(DESTDIR)$(ASTETCDIR)/`basename $$x .sample` $$x ; then \
+                                        echo "Config file $$x is unchanged"; \
+                                        continue; \
+                                fi ; \
+                                mv -f $(DESTDIR)$(ASTETCDIR)/`basename $$x .sample` $(DESTDIR)$(ASTETCDIR)/`basename $$x .sample`.old ; \
+                        else \
+                                echo "Skipping config file $$x"; \
+                                continue; \
+                        fi ;\
+                fi ; \
+                $(INSTALL) -m 644 $$x $(DESTDIR)$(ASTETCDIR)/`basename $$x .sample` ;\
+        done
+
 update:
 	@if [ -d .svn ]; then \
 		echo "Updating from Subversion..." ; \



More information about the asterisk-addons-commits mailing list