stop recompiling cli.c on every 'make'

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@6963 65c4cc65-6c06-0410-ace0-fbb531ad65f3
1.2-netsec
Kevin P. Fleming 20 years ago
parent c103bc7806
commit da0d0f975a

@ -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

@ -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"

@ -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;

16
cli.c

@ -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"

Loading…
Cancel
Save