Add a new API call for creating detached threads. Then, go replace all of the
[asterisk/asterisk.git] / Makefile
index 46cce10..aa7de5a 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -46,6 +46,7 @@ export AGI_DIR
 export ASTCONFPATH
 export NOISY_BUILD
 export MENUSELECT_CFLAGS
+export AST_DEVMODE
 export CC
 export CXX
 export AR
@@ -58,6 +59,13 @@ export PROC
 export SOLINK
 export STRIP
 export DOWNLOAD
+export OSARCH
+export CURSES_DIR
+export NCURSES_DIR
+export TERMCAP_DIR
+export TINFO_DIR
+export GTK2_LIB
+export GTK2_INCLUDE
 
 # even though we could use '-include makeopts' here, use a wildcard
 # lookup anyway, so that make won't try to build makeopts if it doesn't
@@ -72,7 +80,7 @@ endif
 # Create OPTIONS variable
 OPTIONS=
 
-ASTTOPDIR:=$(shell pwd)
+ASTTOPDIR:=$(CURDIR)
 
 # Overwite config files on "make samples"
 OVERWRITE=y
@@ -184,7 +192,7 @@ ASTCFLAGS+=-pipe -Wall -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declar
 ASTCFLAGS+=-include $(ASTTOPDIR)/include/asterisk/autoconfig.h
 
 ifeq ($(AST_DEVMODE),yes)
-  ASTCFLAGS+=-Werror -Wunused
+  ASTCFLAGS+=-Werror -Wunused -Wundef
 endif
 
 ifneq ($(findstring BSD,$(OSARCH)),)
@@ -222,7 +230,7 @@ endif
 ASTERISKVERSION:=$(shell build_tools/make_version .)
 
 ifneq ($(wildcard .version),)
-  ASTERISKVERSIONNUM:=$(shell awk -F. '{printf "%02d%02d%02d", $$1, $$2, $$3}' .version)
+  ASTERISKVERSIONNUM:=$(shell awk -F. '{printf "%01d%02d%02d", $$1, $$2, $$3}' .version)
   RPMVERSION:=$(shell sed 's/[-\/:]/_/g' .version)
 else
   RPMVERSION=unknown
@@ -279,7 +287,8 @@ _all: cleantest $(SUBDIRS)
 
 makeopts: configure
        @echo "****"
-       @echo "**** The configure script must be executed before running '$(MAKE)'."
+       @echo "**** The configure script must be executed before running '$(MAKE)'." 
+       @echo "****               Please run \"./configure\"."
        @echo "****"
        @exit 1
 
@@ -311,10 +320,10 @@ $(SUBDIRS): include/asterisk/version.h include/asterisk/build.h include/asterisk
 main: $(filter-out main,$(MOD_SUBDIRS))
 
 $(MOD_SUBDIRS):
-       @ASTCFLAGS="$(MOD_SUBDIR_CFLAGS) $(ASTCFLAGS)" ASTLDFLAGS="$(ASTLDFLAGS)" AST_LIBS="$(AST_LIBS)" $(MAKE) --no-print-directory -C $@ SUBDIR=$@ all
+       @ASTCFLAGS="$(MOD_SUBDIR_CFLAGS) $(ASTCFLAGS)" ASTLDFLAGS="$(ASTLDFLAGS)" AST_LIBS="$(AST_LIBS)" $(MAKE) --no-print-directory --no-builtin-rules -C $@ SUBDIR=$@ all
 
 $(OTHER_SUBDIRS):
-       @ASTCFLAGS="$(OTHER_SUBDIR_CFLAGS) $(ASTCFLAGS)" ASTLDFLAGS="$(ASTLDFLAGS)" AUDIO_LIBS="$(AUDIO_LIBS)" $(MAKE) --no-print-directory -C $@ SUBDIR=$@ all
+       @ASTCFLAGS="$(OTHER_SUBDIR_CFLAGS) $(ASTCFLAGS)" ASTLDFLAGS="$(ASTLDFLAGS)" AUDIO_LIBS="$(AUDIO_LIBS)" $(MAKE) --no-print-directory --no-builtin-rules -C $@ SUBDIR=$@ all
 
 defaults.h: makeopts
        @build_tools/make_defaults_h > $@.tmp
@@ -418,7 +427,7 @@ bininstall: _all
        $(INSTALL) -m 755 contrib/scripts/astgenkey $(DESTDIR)$(ASTSBINDIR)/
        $(INSTALL) -m 755 contrib/scripts/autosupport $(DESTDIR)$(ASTSBINDIR)/
        if [ ! -f $(DESTDIR)$(ASTSBINDIR)/safe_asterisk ]; then \
-               cat contrib/scripts/safe_asterisk | sed 's|__ASTERISK_SBIN_DIR__|$(ASTSBINDIR)|;' > $(DESTDIR)$(ASTSBINDIR)/safe_asterisk ;\
+               cat contrib/scripts/safe_asterisk | sed 's|__ASTERISK_SBIN_DIR__|$(ASTSBINDIR)|;s|__ASTERISK_VARRUN_DIR__|$(ASTVARRUNDIR)|;' > $(DESTDIR)$(ASTSBINDIR)/safe_asterisk ;\
                chmod 755 $(DESTDIR)$(ASTSBINDIR)/safe_asterisk;\
        fi
        $(INSTALL) -d $(DESTDIR)$(ASTHEADERDIR)
@@ -533,27 +542,22 @@ samples: adsi
                echo "astrundir => $(ASTVARRUNDIR)" ; \
                echo "astlogdir => $(ASTLOGDIR)" ; \
                echo "" ; \
+               echo ";[options]" ; \
+               echo ";internal_timing = yes" ; \
+               echo ";systemname = my_system_name ; prefix uniqueid with a system name for global uniqueness issues" ; \
+               echo ";autosystemname = yes ; automatically set systemname to hostname - uses 'localhost' on failure, or systemname if set" ; \
                echo "; Changing the following lines may compromise your security." ; \
                echo ";[files]" ; \
                echo ";astctlpermissions = 0660" ; \
                echo ";astctlowner = root" ; \
                echo ";astctlgroup = apache" ; \
                echo ";astctl = asterisk.ctl" ; \
-               echo ";[options]" ; \
-               echo ";internal_timing = yes" ; \
                ) > $(DESTDIR)$(ASTCONFPATH) ; \
        else \
                echo "Skipping asterisk.conf creation"; \
        fi
        mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/voicemail/default/1234/INBOX
-       :> $(DESTDIR)$(ASTSPOOLDIR)/voicemail/default/1234/unavail.gsm
-       for x in vm-theperson digits/1 digits/2 digits/3 digits/4 vm-isunavail; do \
-               cat $(DESTDIR)$(ASTDATADIR)/sounds/$$x.gsm >> $(DESTDIR)$(ASTSPOOLDIR)/voicemail/default/1234/unavail.gsm ; \
-       done
-       :> $(DESTDIR)$(ASTSPOOLDIR)/voicemail/default/1234/busy.gsm
-       for x in vm-theperson digits/1 digits/2 digits/3 digits/4 vm-isonphone; do \
-               cat $(DESTDIR)$(ASTDATADIR)/sounds/$$x.gsm >> $(DESTDIR)$(ASTSPOOLDIR)/voicemail/default/1234/busy.gsm ; \
-       done
+       build_tools/make_sample_voicemail $(DESTDIR)/$(ASTDATADIR) $(DESTDIR)/$(ASTSPOOLDIR)
 
 webvmail:
        @[ -d $(DESTDIR)$(HTTP_DOCSDIR)/ ] || ( printf "http docs directory not found.\nUpdate assignment of variable HTTP_DOCSDIR in Makefile!\n" && exit 1 )
@@ -674,14 +678,42 @@ uninstall-all: _uninstall
 
 menuconfig: menuselect
 
+gmenuconfig: gmenuselect
+
 menuselect: menuselect/menuselect menuselect-tree
        -@menuselect/menuselect $(GLOBAL_MAKEOPTS) $(USER_MAKEOPTS) menuselect.makeopts && (echo "menuselect changes saved!"; rm -f channels/h323/Makefile.ast main/asterisk) || echo "menuselect changes NOT saved!"
 
+gmenuselect: menuselect/gmenuselect menuselect-tree
+       -@menuselect/gmenuselect $(GLOBAL_MAKEOPTS) $(USER_MAKEOPTS) menuselect.makeopts && (echo "menuselect changes saved!"; rm -f channels/h323/Makefile.ast main/asterisk) || echo "menuselect changes NOT saved!"
+
 menuselect/menuselect: makeopts menuselect/menuselect.c menuselect/menuselect_curses.c menuselect/menuselect_stub.c menuselect/menuselect.h menuselect/linkedlists.h makeopts
-       @env -i && $(MAKE) -C menuselect CONFIGURE_SILENT="--silent"
+       @CC="$(HOST_CC)" LD="" AR="" RANLIB="" $(MAKE) -C menuselect CONFIGURE_SILENT="--silent"
+
+menuselect/gmenuselect: makeopts menuselect/menuselect.c menuselect/menuselect_gtk.c menuselect/menuselect_stub.c menuselect/menuselect.h menuselect/linkedlists.h makeopts
+       @CC="$(HOST_CC)" CXX="$(CXX)" LD="" AR="" RANLIB="" $(MAKE) -C menuselect _gmenuselect CONFIGURE_SILENT="--silent"
 
 menuselect-tree: $(foreach dir,$(filter-out main,$(MOD_SUBDIRS)),$(wildcard $(dir)/*.c) $(wildcard $(dir)/*.cc)) build_tools/cflags.xml sounds/sounds.xml build_tools/embed_modules.xml
        @echo "Generating input for menuselect ..."
        @build_tools/prep_moduledeps > $@
 
-.PHONY: menuselect main sounds clean dist-clean distclean all prereqs cleantest uninstall _uninstall uninstall-all dont-optimize $(SUBDIRS_INSTALL) $(SUBDIRS_CLEAN) $(SUBDIRS_UNINSTALL) $(SUBDIRS) $(MOD_SUBDIRS_EMBED_LDSCRIPT) $(MOD_SUBDIRS_EMBED_LDFLAGS) $(MOD_SUBDIRS_EMBED_LIBS)
+asterisk.pdf: doc/asterisk.pdf
+
+doc/asterisk.pdf: $(wildcard doc/*.tex)
+ifeq ($(findstring rubber,$(RUBBER)),)
+       @echo "**********************************************"
+       @echo "** You must install the \"rubber\" tool      ***"
+       @echo "** to generate the Asterisk reference PDF. ***"
+       @echo "**********************************************"
+else
+       @echo "**********************************************"
+       @echo "** The Asterisk reference PDF will now be  ***"
+       @echo "** generated.  When complete, it will be   ***"
+       @echo "** located at doc/asterisk.pdf.            ***"  
+       @echo "**********************************************"
+       @cp doc/asterisk.tex doc/asterisk.tex.orig
+       @sed -i -e 's/ASTERISKVERSION/$(ASTERISKVERSION)/' doc/asterisk.tex
+       @cd doc && $(RUBBER) --pdf asterisk.tex
+       @mv doc/asterisk.tex.orig doc/asterisk.tex
+endif
+
+.PHONY: menuselect main sounds clean dist-clean distclean all prereqs cleantest uninstall _uninstall uninstall-all dont-optimize $(SUBDIRS_INSTALL) $(SUBDIRS_CLEAN) $(SUBDIRS_UNINSTALL) $(SUBDIRS) $(MOD_SUBDIRS_EMBED_LDSCRIPT) $(MOD_SUBDIRS_EMBED_LDFLAGS) $(MOD_SUBDIRS_EMBED_LIBS) menuselect.makeopts