[Asterisk-cvs] asterisk buildinfo.c, NONE, 1.1 ChangeLog, 1.22, 1.23 Makefile, 1.218, 1.219 asterisk.c, 1.189, 1.190 cli.c, 1.102, 1.103

kpfleming kpfleming
Sat Nov 5 14:07:06 CST 2005


Update of /usr/cvsroot/asterisk
In directory mongoose.digium.com:/tmp/cvs-serv16815

Modified Files:
	ChangeLog Makefile asterisk.c cli.c 
Added Files:
	buildinfo.c 
Log Message:
stop recompiling cli.c on every 'make'


--- NEW FILE: buildinfo.c ---
/*
 * Asterisk -- An open source telephony toolkit.
 *
 * Copyright (C) 2005, Digium, Inc.
 *
 * Kevin P. Fleming <kpfleming at digium.com>
 *
 * See http://www.asterisk.org for more information about
 * the Asterisk project. Please do not directly contact
 * any of the maintainers of this project for assistance;
 * the project provides a web site, mailing lists and IRC
 * channels for your use.
 *
 * This program is free software, distributed under the terms of
 * the GNU General Public License Version 2. See the LICENSE file
 * at the top of the source tree.
 */

/*! \file
 *
 * \brief Build timestamp variables
 * 
 */

#include "asterisk/build.h"

const char *ast_build_hostname = BUILD_HOSTNAME;
const char *ast_build_kernel = BUILD_KERNEL;
const char *ast_build_machine = BUILD_MACHINE;
const char *ast_build_os = BUILD_OS;
const char *ast_build_date = BUILD_DATE;
const char *ast_build_user = BUILD_USER;

Index: ChangeLog
===================================================================
RCS file: /usr/cvsroot/asterisk/ChangeLog,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -d -r1.22 -r1.23
--- ChangeLog	4 Nov 2005 22:11:51 -0000	1.22
+++ ChangeLog	5 Nov 2005 18:58:27 -0000	1.23
@@ -1,3 +1,10 @@
+2005-11-05  Kevin P. Fleming  <kpfleming at digium.com>
+
+	* Makefile: don't rebuild asterisk/build.h unless the asterisk binary is going to be relinked for some other reason (stops spurious recompile/link every time 'make' is issued); clean up variable substitutions to use consistent syntax
+	* asterisk.c: don't include asterisk/build.h (it's unnecessary)
+	* cli.c: don't include asterisk/build.h, use extern references to buildinfo.c
+	* buildinfo.c: new file to hold version info strings
+
 2005-11-04  Kevin P. Fleming  <kpfleming at digium.com>
 
 	* apps/app_mixmonitor.c (mixmonitor_exec): correct app name in an error message

Index: Makefile
===================================================================
RCS file: /usr/cvsroot/asterisk/Makefile,v
retrieving revision 1.218
retrieving revision 1.219
diff -u -d -r1.218 -r1.219
--- Makefile	1 Nov 2005 21:53:29 -0000	1.218
+++ Makefile	5 Nov 2005 18:58:27 -0000	1.219
@@ -101,7 +101,7 @@
 # Don't use together with -DBUSYDETECT_TONEONLY
 BUSYDETECT+= #-DBUSYDETECT_COMPARE_TONE_AND_SILENCE
 
-ifneq (${OSARCH},SunOS)
+ifneq ($(OSARCH),SunOS)
   ASTLIBDIR=$(INSTALL_PREFIX)/usr/lib/asterisk
   ASTVARLIBDIR=$(INSTALL_PREFIX)/var/lib/asterisk
   ASTETCDIR=$(INSTALL_PREFIX)/etc/asterisk
@@ -164,7 +164,7 @@
   include ~/.asterisk.makeopts
 endif
 
-ifeq (${OSARCH},Linux)
+ifeq ($(OSARCH),Linux)
   ifeq ($(CROSS_COMPILE),)
     PROC?=$(shell uname -m)
   else
@@ -208,7 +208,7 @@
 PWD=$(shell pwd)
 GREP=grep
 
-ifeq (${OSARCH},SunOS)
+ifeq ($(OSARCH),SunOS)
   GREP=/usr/xpg4/bin/grep
   M4=/usr/local/bin/m4
 endif
@@ -218,7 +218,7 @@
 ASTCFLAGS+=$(OPTIMIZE)
 ASTOBJ=-o asterisk
 
-ifeq ($(findstring BSD,${OSARCH}),BSD)
+ifeq ($(findstring BSD,$(OSARCH)),BSD)
   PROC=$(shell uname -m)
   ASTCFLAGS+=-I$(CROSS_COMPILE_TARGET)/usr/local/include -L$(CROSS_COMPILE_TARGET)/usr/local/lib
 endif
@@ -239,38 +239,38 @@
   endif
 endif
 
-ifeq (${OSARCH},FreeBSD)
+ifeq ($(OSARCH),FreeBSD)
   BSDVERSION=$(shell make -V OSVERSION -f $(CROSS_COMPILE_TARGET)/usr/share/mk/bsd.port.subdir.mk)
-  ASTCFLAGS+=$(shell if test ${BSDVERSION} -lt 500016 ; then echo "-D_THREAD_SAFE"; fi)
-  LIBS+=$(shell if test  ${BSDVERSION} -lt 502102 ; then echo "-lc_r"; else echo "-pthread"; fi)
+  ASTCFLAGS+=$(shell if test $(BSDVERSION) -lt 500016 ; then echo "-D_THREAD_SAFE"; fi)
+  LIBS+=$(shell if test  $(BSDVERSION) -lt 502102 ; then echo "-lc_r"; else echo "-pthread"; fi)
   ifneq ($(wildcard $(CROSS_COMPILE_TARGET)/usr/local/include/spandsp),)
     ASTCFLAGS+=-I$(CROSS_COMPILE_TARGET)/usr/local/include/spandsp
   endif
   MPG123TARG=freebsd
 endif # FreeBSD
 
-ifeq (${OSARCH},NetBSD)
+ifeq ($(OSARCH),NetBSD)
   ASTCFLAGS+=-pthread
   INCLUDE+=-I$(CROSS_COMPILE_TARGET)/usr/pkg/include
   MPG123TARG=netbsd
 endif
 
-ifeq (${OSARCH},OpenBSD)
+ifeq ($(OSARCH),OpenBSD)
   ASTCFLAGS+=-pthread
 endif
 
-ifeq (${OSARCH},SunOS)
+ifeq ($(OSARCH),SunOS)
   ASTCFLAGS+=-Wcast-align -DSOLARIS
   INCLUDE+=-Iinclude/solaris-compat -I$(CROSS_COMPILE_TARGET)/usr/local/ssl/include
 endif
 
-ifeq ($(findstring CYGWIN,${OSARCH}),CYGWIN)
+ifeq ($(findstring CYGWIN,$(OSARCH)),CYGWIN)
 CYGLOADER=cygwin_a
 OSARCH=CYGWIN
 ASTOBJ=-shared -o asterisk.dll -Wl,--out-implib=libasterisk.dll.a -Wl,--export-all-symbols
 ASTLINK=
 LIBS+=-lpthread -lncurses -lm -lresolv
-ASTSBINDIR=${MODULES_DIR}
+ASTSBINDIR=$(MODULES_DIR)
 endif
 
 ifneq ($(wildcard $(CROSS_COMPILE_TARGET)/usr/include/linux/zaptel.h)$(wildcard $(CROSS_COMPILE_TARGET)/usr/local/include/zaptel.h)$(wildcard $(CROSS_COMPILE_TARGET)/usr/pkg/include/zaptel.h),)
@@ -326,13 +326,13 @@
   ASTCFLAGS+=-DDLFCNCOMPAT
 endif
 
-ifeq (${OSARCH},Linux)
+ifeq ($(OSARCH),Linux)
   LIBS+=-ldl -lpthread -lncurses -lm -lresolv  #-lnjamd
 else
   LIBS+=-lncurses -lm
 endif
 
-ifeq (${OSARCH},Darwin)
+ifeq ($(OSARCH),Darwin)
   LIBS+=-lresolv
   ASTCFLAGS+=-D__Darwin__
   AUDIO_LIBS=-framework CoreAudio
@@ -344,19 +344,19 @@
   SOLINK=-shared -Xlinker -x
 endif
 
-ifeq (${OSARCH},FreeBSD)
+ifeq ($(OSARCH),FreeBSD)
   LIBS+=-lcrypto
 endif
 
-ifeq (${OSARCH},NetBSD)
+ifeq ($(OSARCH),NetBSD)
   LIBS+=-lpthread -lcrypto -lm -L$(CROSS_COMPILE_TARGET)/usr/pkg/lib -lncurses
 endif
 
-ifeq (${OSARCH},OpenBSD)
+ifeq ($(OSARCH),OpenBSD)
   LIBS+=-lcrypto -lpthread -lm -lncurses
 endif
 
-ifeq (${OSARCH},SunOS)
+ifeq ($(OSARCH),SunOS)
   LIBS+=-lpthread -ldl -lnsl -lsocket -lresolv -L$(CROSS_COMPILE_TARGET)/usr/local/ssl/lib
   OBJS+=strcompat.o
   ASTLINK=
@@ -454,18 +454,6 @@
 	fi
 	rm -f $@.tmp
 
-include/asterisk/build.h:
-	build_tools/make_build_h > $@.tmp
-	if cmp -s $@.tmp $@ ; then echo ; else \
-		mv $@.tmp $@ ; \
-	fi
-	rm -f $@.tmp
-
-# only force 'build.h' to be made for a non-'install' run
-ifeq ($(findstring install,$(MAKECMDGOALS)),)
-include/asterisk/build.h: FORCE
-endif
-
 include/asterisk/version.h: FORCE
 	build_tools/make_version_h > $@.tmp
 	if cmp -s $@.tmp $@ ; then echo; else \
@@ -484,8 +472,14 @@
 cygwin_a:
 	$(MAKE) -C cygwin all
 
-asterisk: ${CYGLOADER} editline/libedit.a db1-ast/libdb1.a stdtime/libtime.a $(OBJS)
-	$(CC) $(DEBUG) ${ASTOBJ} $(ASTLINK) $(OBJS) $(LIBEDIT) db1-ast/libdb1.a stdtime/libtime.a $(LIBS)
+asterisk: $(CYGLOADER) editline/libedit.a db1-ast/libdb1.a stdtime/libtime.a $(OBJS)
+	build_tools/make_build_h > include/asterisk/build.h.tmp
+	if cmp -s include/asterisk/build.h.tmp include/asterisk/build.h ; then echo ; else \
+		mv include/asterisk/build.h.tmp include/asterisk/build.h ; \
+	fi
+	rm -f include/asterisk/build.h.tmp
+	$(CC) -c -o buildinfo.o $(CFLAGS) buildinfo.c
+	$(CC) $(DEBUG) $(ASTOBJ) $(ASTLINK) $(OBJS) buildinfo.o $(LIBEDIT) db1-ast/libdb1.a stdtime/libtime.a $(LIBS)
 
 muted: muted.o
 	$(CC) $(AUDIO_LIBS) -o muted muted.o
@@ -826,18 +820,18 @@
 
 valgrind: dont-optimize
 
-depend: include/asterisk/build.h include/asterisk/version.h .depend defaults.h 
+depend: include/asterisk/version.h .depend defaults.h 
 	for x in $(SUBDIRS); do $(MAKE) -C $$x depend || exit 1 ; done
 
 .depend: include/asterisk/version.h
-	build_tools/mkdep ${CFLAGS} $(wildcard *.c)
+	build_tools/mkdep $(CFLAGS) $(wildcard *.c)
 
 .tags-depend:
 	@echo -n ".tags-depend: " > $@
 	@find . -maxdepth 1 -name \*.c -printf "\t%p \\\\\n" >> $@
 	@find . -maxdepth 1 -name \*.h -printf "\t%p \\\\\n" >> $@
-	@find ${SUBDIRS} -name \*.c -printf "\t%p \\\\\n" >> $@
-	@find ${SUBDIRS} -name \*.h -printf "\t%p \\\\\n" >> $@
+	@find $(SUBDIRS) -name \*.c -printf "\t%p \\\\\n" >> $@
+	@find $(SUBDIRS) -name \*.h -printf "\t%p \\\\\n" >> $@
 	@find include -name \*.h -printf "\t%p \\\\\n" >> $@
 	@echo >> $@
 
@@ -845,8 +839,8 @@
 	@rm -f $@
 	@find . -maxdepth 1 -name \*.c -print >> $@
 	@find . -maxdepth 1 -name \*.h -print >> $@
-	@find ${SUBDIRS} -name \*.c -print >> $@
-	@find ${SUBDIRS} -name \*.h -print >> $@
+	@find $(SUBDIRS) -name \*.c -print >> $@
+	@find $(SUBDIRS) -name \*.h -print >> $@
 	@find include -name \*.h -print >> $@
 
 tags: .tags-depend .tags-sources

Index: asterisk.c
===================================================================
RCS file: /usr/cvsroot/asterisk/asterisk.c,v
retrieving revision 1.189
retrieving revision 1.190
diff -u -d -r1.189 -r1.190
--- asterisk.c	1 Nov 2005 21:53:29 -0000	1.189
+++ asterisk.c	5 Nov 2005 18:58:27 -0000	1.190
@@ -105,7 +105,6 @@
 #include "editline/histedit.h"
 #include "asterisk/config.h"
 #include "asterisk/version.h"
-#include "asterisk/build.h"
 #include "asterisk/linkedlists.h"
 #include "asterisk/devicestate.h"
 

Index: cli.c
===================================================================
RCS file: /usr/cvsroot/asterisk/cli.c,v
retrieving revision 1.102
retrieving revision 1.103
diff -u -d -r1.102 -r1.103
--- cli.c	24 Oct 2005 20:12:04 -0000	1.102
+++ cli.c	5 Nov 2005 18:58:27 -0000	1.103
@@ -47,11 +47,14 @@
 #include "editline/readline/readline.h"
 /* For module directory */
 #include "asterisk/version.h"
-#include "asterisk/build.h"
 
-#define VERSION_INFO "Asterisk " ASTERISK_VERSION " built by " BUILD_USER "@" BUILD_HOSTNAME \
-	" on a " BUILD_MACHINE " running " BUILD_OS " on " BUILD_DATE
-	
+extern const char *ast_build_hostname;
+extern const char *ast_build_kernel;
+extern const char *ast_build_machine;
+extern const char *ast_build_os;
+extern const char *ast_build_date;
+extern const char *ast_build_user;
+
 extern unsigned long global_fin, global_fout;
 	
 void ast_cli(int fd, char *fmt, ...)
@@ -407,9 +410,12 @@
 {
 	if (argc != 2)
 		return RESULT_SHOWUSAGE;
-	ast_cli(fd, "%s\n", VERSION_INFO);
+	ast_cli(fd, "Asterisk %s built by %s @ %s on a %s running %s on %s\n",
+		ASTERISK_VERSION, ast_build_user, ast_build_hostname,
+		ast_build_machine, ast_build_os, ast_build_date);
 	return RESULT_SUCCESS;
 }
+
 static int handle_chanlist(int fd, int argc, char *argv[])
 {
 #define FORMAT_STRING  "%-20.20s %-20.20s %-7.7s %-30.30s\n"




More information about the svn-commits mailing list