diff options
author | kpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b> | 2005-11-05 18:58:27 +0000 |
---|---|---|
committer | kpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b> | 2005-11-05 18:58:27 +0000 |
commit | 49f65e4379624cf2655db1c60ac69d62b72aca65 (patch) | |
tree | 550e3dcde6145f0c1a0bce70c5c79f917d8a525e | |
parent | c9ad9780f5cb9363a390630b00ac55c15599760a (diff) |
stop recompiling cli.c on every 'make'
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@6963 f38db490-d61c-443f-a65b-d21fe96a405b
-rwxr-xr-x | ChangeLog | 7 | ||||
-rwxr-xr-x | Makefile | 70 | ||||
-rwxr-xr-x | asterisk.c | 1 | ||||
-rwxr-xr-x | buildinfo.c | 32 | ||||
-rwxr-xr-x | cli.c | 16 |
5 files changed, 82 insertions, 44 deletions
@@ -1,3 +1,10 @@ +2005-11-05 Kevin P. Fleming <kpfleming@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@digium.com> * apps/app_mixmonitor.c (mixmonitor_exec): correct app name in an error message @@ -101,7 +101,7 @@ BUSYDETECT+= #-DBUSYDETECT_TONEONLY # 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 @@ ifneq ($(wildcard ~/.asterisk.makeopts),) include ~/.asterisk.makeopts endif -ifeq (${OSARCH},Linux) +ifeq ($(OSARCH),Linux) ifeq ($(CROSS_COMPILE),) PROC?=$(shell uname -m) else @@ -208,7 +208,7 @@ endif 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+=-pipe -Wall -Wstrict-prototypes -Wmissing-prototypes -Wmissing-decla 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 @@ else 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 @@ ifeq ($(wildcard $(CROSS_COMPILE_TARGET)/usr/include/dlfcn.h),) 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 @@ else 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 @@ defaults.h: FORCE 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 @@ stdtime/libtime.a: FORCE 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 @@ dont-optimize: 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 @@ depend: include/asterisk/build.h include/asterisk/version.h .depend defaults.h @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 diff --git a/asterisk.c b/asterisk.c index 785b64a91..71aef7d45 100755 --- a/asterisk.c +++ b/asterisk.c @@ -105,7 +105,6 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") #include "editline/histedit.h" #include "asterisk/config.h" #include "asterisk/version.h" -#include "asterisk/build.h" #include "asterisk/linkedlists.h" #include "asterisk/devicestate.h" diff --git a/buildinfo.c b/buildinfo.c new file mode 100755 index 000000000..cd7ce8df3 --- /dev/null +++ b/buildinfo.c @@ -0,0 +1,32 @@ +/* + * Asterisk -- An open source telephony toolkit. + * + * Copyright (C) 2005, Digium, Inc. + * + * Kevin P. Fleming <kpfleming@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; @@ -47,11 +47,14 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") #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 @@ static int handle_version(int fd, int argc, char *argv[]) { 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" |