[Asterisk-cvs] asterisk .cleancount, 1.5, 1.6 .cvsignore, 1.12, 1.13 Makefile, 1.163, 1.164 app.c, 1.64, 1.65 asterisk.c, 1.159, 1.160 cli.c, 1.83, 1.84 config.c, 1.64, 1.65 db.c, 1.16, 1.17 file.c, 1.66, 1.67 image.c, 1.13, 1.14 loader.c, 1.41, 1.42 logger.c, 1.72, 1.73 make_build_h, 1.1, 1.2

kpfleming at lists.digium.com kpfleming at lists.digium.com
Sun Jun 5 23:02:27 CDT 2005


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

Modified Files:
	.cleancount .cvsignore Makefile app.c asterisk.c cli.c 
	config.c db.c file.c image.c loader.c logger.c make_build_h 
Log Message:
major Makefile and build process improvements, including removal of all hardcoded paths (modules must now use run-time paths as they should) (bug #4116)


Index: .cleancount
===================================================================
RCS file: /usr/cvsroot/asterisk/.cleancount,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- .cleancount	23 Mar 2005 21:52:31 -0000	1.5
+++ .cleancount	6 Jun 2005 03:04:58 -0000	1.6
@@ -1 +1 @@
-5
+6

Index: .cvsignore
===================================================================
RCS file: /usr/cvsroot/asterisk/.cvsignore,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- .cvsignore	19 May 2005 04:09:50 -0000	1.12
+++ .cvsignore	6 Jun 2005 03:04:58 -0000	1.13
@@ -20,3 +20,5 @@
 tags
 TAGS
 vercomp
+version.h
+defaults.h

Index: Makefile
===================================================================
RCS file: /usr/cvsroot/asterisk/Makefile,v
retrieving revision 1.163
retrieving revision 1.164
diff -u -d -r1.163 -r1.164
--- Makefile	26 May 2005 20:31:40 -0000	1.163
+++ Makefile	6 Jun 2005 03:04:58 -0000	1.164
@@ -211,22 +211,10 @@
 
 LIBEDIT=editline/libedit.a
 
-ASTERISKVERSION=$(shell if [ -f .version ]; then cat .version; else if [ -d CVS ]; then if [ -f CVS/Tag ] ; then echo "CVS-`sed 's/^T//g' CVS/Tag`-`date +"%D-%T"`"; else echo "CVS-HEAD-`date +"%D-%T"`"; fi; fi; fi)
+ASTERISKVERSION=$(shell if [ -f .version ]; then cat .version; else if [ -d CVS ]; then if [ -f CVS/Tag ] ; then echo "CVS-`sed 's/^T//g' CVS/Tag`-`date +"%D-%T"`"; else echo "CVS-HEAD"; fi; fi; fi)
 ASTERISKVERSIONNUM=$(shell if [ -d CVS ]; then echo 999999 ; else if [ -f .version ] ; then awk -F. '{printf "%02d%02d%02d", $$1, $$2, $$3}' .version ; else echo 000000 ; fi ; fi)
 HTTPDIR=$(shell if [ -d $(CROSS_COMPILE_TARGET)/var/www ]; then echo "/var/www"; else echo "/home/httpd"; fi)
 RPMVERSION=$(shell if [ -f .version ]; then sed 's/[-\/:]/_/g' .version; else echo "unknown" ; fi)
-CFLAGS+=-DASTERISK_VERSION=\"$(ASTERISKVERSION)\"
-CFLAGS+=-DASTERISK_VERSION_NUM=$(ASTERISKVERSIONNUM)
-CFLAGS+=-DINSTALL_PREFIX=\"$(INSTALL_PREFIX)\"
-CFLAGS+=-DASTETCDIR=\"$(ASTETCDIR)\"
-CFLAGS+=-DASTLIBDIR=\"$(ASTLIBDIR)\"
-CFLAGS+=-DASTVARLIBDIR=\"$(ASTVARLIBDIR)\"
-CFLAGS+=-DASTVARRUNDIR=\"$(ASTVARRUNDIR)\"
-CFLAGS+=-DASTSPOOLDIR=\"$(ASTSPOOLDIR)\"
-CFLAGS+=-DASTLOGDIR=\"$(ASTLOGDIR)\"
-CFLAGS+=-DASTCONFPATH=\"$(ASTCONFPATH)\"
-CFLAGS+=-DASTMODDIR=\"$(MODULES_DIR)\"
-CFLAGS+=-DASTAGIDIR=\"$(AGI_DIR)\"
 
 CFLAGS+= $(DEBUG_THREADS)
 CFLAGS+= $(TRACE_FRAMES)
@@ -327,12 +315,7 @@
 include .tags-depend
 endif
 
-.PHONY: _version ast_expr
-
-_version: 
-	if [ -d CVS ] && [ ! -f .version ]; then echo $(ASTERISKVERSION) > .version; fi 
-
-.version: _version
+.PHONY: ast_expr
 
 vercomp: vercomp.c
 	$(HOST_CC) -o $@ $<
@@ -382,10 +365,6 @@
 	ar r $@ $(FLEXOBJS)
 	ranlib $@
 
-cli.o: cli.c build.h
-
-asterisk.o: asterisk.c build.h
-
 testexpr2 :
 	flex ast_expr2.fl
 	bison -v -d --name-prefix=ast_yy -o ast_expr2.c ast_expr2.y
@@ -415,13 +394,26 @@
 asterisk.txt: asterisk.sgml
 	docbook2txt asterisk.sgml
 
-ifneq ($(strip $(ASTERISKVERSION)),)
-build.h: .version
-	./make_build_h
-else
-build.h:
-	./make_build_h
-endif
+defaults.h: FORCE
+	./make_defaults_h > $@.tmp
+	if ! cmp -s $@.tmp $@ ; then \
+		mv $@.tmp $@ ; \
+	fi
+	rm -f $@.tmp
+
+include/asterisk/build.h: FORCE
+	./make_build_h > $@.tmp
+	if ! cmp -s $@.tmp $@ ; then \
+		mv $@.tmp $@ ; \
+	fi
+	rm -f $@.tmp
+
+include/asterisk/version.h: FORCE
+	./make_version_h > $@.tmp
+	if ! cmp -s $@.tmp $@ ; then \
+		mv $@.tmp $@ ; \
+	fi
+	rm -f $@.tmp
 
 stdtime/libtime.a: FORCE
 	@if [ -d stdtime ]; then \
@@ -443,7 +435,9 @@
 clean:
 	for x in $(SUBDIRS); do $(MAKE) -C $$x clean || exit 1 ; done
 	rm -f *.o *.so asterisk .depend
-	rm -f build.h 
+	rm -f defaults.h
+	rm -f include/asterisk/build.h
+	rm -f include/asterisk/version.h
 	rm -f ast_expr.c ast_expr.h ast_expr.output
 	rm -f ast_expr2.c ast_expr2f.c ast_expr2.h ast_expr2.output
 	rm -f ast_expr.a vercomp
@@ -758,7 +752,7 @@
 
 valgrind: dont-optimize
 
-depend: .depend
+depend: .depend defaults.h include/asterisk/build.h include/asterisk/version.h
 	for x in $(SUBDIRS); do $(MAKE) -C $$x depend || exit 1 ; done
 
 .depend:

Index: app.c
===================================================================
RCS file: /usr/cvsroot/asterisk/app.c,v
retrieving revision 1.64
retrieving revision 1.65
diff -u -d -r1.64 -r1.65
--- app.c	6 Jun 2005 02:29:17 -0000	1.64
+++ app.c	6 Jun 2005 03:04:58 -0000	1.65
@@ -34,7 +34,6 @@
 #include "asterisk/lock.h"
 #include "asterisk/indications.h"
 #include "asterisk.h"
-#include "astconf.h"
 
 #define MAX_OTHER_FORMATS 10
 

Index: asterisk.c
===================================================================
RCS file: /usr/cvsroot/asterisk/asterisk.c,v
retrieving revision 1.159
retrieving revision 1.160
diff -u -d -r1.159 -r1.160
--- asterisk.c	5 Jun 2005 16:32:16 -0000	1.159
+++ asterisk.c	6 Jun 2005 03:04:58 -0000	1.160
@@ -33,6 +33,7 @@
 #include <netdb.h>
 #endif
 
+#include "asterisk.h"
 #include "asterisk/logger.h"
 #include "asterisk/options.h"
 #include "asterisk/cli.h"
@@ -56,8 +57,11 @@
 #include "asterisk/io.h"
 #include "asterisk/lock.h"
 #include "editline/histedit.h"
-#include "asterisk.h"
 #include "asterisk/config.h"
+#include "asterisk/version.h"
+#include "asterisk/build.h"
+
+#include "defaults.h"
 
 #ifndef AF_LOCAL
 #define AF_LOCAL AF_UNIX
@@ -128,6 +132,7 @@
 char ast_config_AST_CONFIG_FILE[AST_CONFIG_MAX_PATH];
 char ast_config_AST_MODULE_DIR[AST_CONFIG_MAX_PATH];
 char ast_config_AST_SPOOL_DIR[AST_CONFIG_MAX_PATH];
+char ast_config_AST_MONITOR_DIR[AST_CONFIG_MAX_PATH];
 char ast_config_AST_VAR_DIR[AST_CONFIG_MAX_PATH];
 char ast_config_AST_LOG_DIR[AST_CONFIG_MAX_PATH];
 char ast_config_AST_AGI_DIR[AST_CONFIG_MAX_PATH];
@@ -395,7 +400,7 @@
 	int x;
 
 	struct ast_config *cfg;
-	char *config = ASTCONFPATH;
+	char *config = AST_CONFIG_FILE;
 	char *owner;
 	char *group;
 	char *perms;
@@ -1547,7 +1552,7 @@
 	struct ast_config *cfg;
 	struct ast_variable *v;
 	struct ast_variable *v_ctlfile;
-	char *config = ASTCONFPATH;
+	char *config = AST_CONFIG_FILE;
 
 	if (option_overrideconfig == 1) {
 		cfg = ast_config_load((char *)ast_config_AST_CONFIG_FILE);
@@ -1561,6 +1566,7 @@
 	ast_copy_string((char *)ast_config_AST_CONFIG_DIR,AST_CONFIG_DIR,sizeof(ast_config_AST_CONFIG_DIR));
 	ast_copy_string((char *)ast_config_AST_SPOOL_DIR,AST_SPOOL_DIR,sizeof(ast_config_AST_SPOOL_DIR));
 	ast_copy_string((char *)ast_config_AST_MODULE_DIR,AST_MODULE_DIR,sizeof(ast_config_AST_VAR_DIR));
+ 	snprintf((char *)ast_config_AST_MONITOR_DIR,sizeof(ast_config_AST_MONITOR_DIR)-1,"%s/monitor",ast_config_AST_SPOOL_DIR);
 	ast_copy_string((char *)ast_config_AST_VAR_DIR,AST_VAR_DIR,sizeof(ast_config_AST_VAR_DIR));
 	ast_copy_string((char *)ast_config_AST_LOG_DIR,AST_LOG_DIR,sizeof(ast_config_AST_LOG_DIR));
 	ast_copy_string((char *)ast_config_AST_AGI_DIR,AST_AGI_DIR,sizeof(ast_config_AST_AGI_DIR));
@@ -1588,6 +1594,7 @@
 			ast_copy_string((char *)ast_config_AST_CONFIG_DIR,v->value,sizeof(ast_config_AST_CONFIG_DIR));
 		} else if (!strcasecmp(v->name, "astspooldir")) {
 			ast_copy_string((char *)ast_config_AST_SPOOL_DIR,v->value,sizeof(ast_config_AST_SPOOL_DIR));
+			snprintf((char *)ast_config_AST_MONITOR_DIR,sizeof(ast_config_AST_MONITOR_DIR)-1,"%s/monitor",v->value);
 		} else if (!strcasecmp(v->name, "astvarlibdir")) {
 			ast_copy_string((char *)ast_config_AST_VAR_DIR,v->value,sizeof(ast_config_AST_VAR_DIR));
 			snprintf((char *)ast_config_AST_DB,sizeof(ast_config_AST_DB),"%s/%s",v->value,"astdb");    

Index: cli.c
===================================================================
RCS file: /usr/cvsroot/asterisk/cli.c,v
retrieving revision 1.83
retrieving revision 1.84
diff -u -d -r1.83 -r1.84
--- cli.c	6 Jun 2005 02:29:17 -0000	1.83
+++ cli.c	6 Jun 2005 03:04:58 -0000	1.84
@@ -32,11 +32,11 @@
 #include "editline/readline/readline.h"
 /* For module directory */
 #include "asterisk.h"
-#include "build.h"
-#include "astconf.h"
+#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 a " BUILD_MACHINE " running " BUILD_OS " on " BUILD_DATE
 	
 extern unsigned long global_fin, global_fout;
 	

Index: config.c
===================================================================
RCS file: /usr/cvsroot/asterisk/config.c,v
retrieving revision 1.64
retrieving revision 1.65
diff -u -d -r1.64 -r1.65
--- config.c	25 May 2005 21:56:50 -0000	1.64
+++ config.c	6 Jun 2005 03:04:58 -0000	1.65
@@ -34,7 +34,6 @@
 #include "asterisk/channel.h"
 #include "asterisk/app.h"
 #include "asterisk.h"
-#include "astconf.h"
 
 #define MAX_NESTED_COMMENTS 128
 #define COMMENT_START ";--"
@@ -687,7 +686,7 @@
 	int blanklines = 0;
 
 	if (configfile[0] == '/') {
-		strncpy(fn, configfile, sizeof(fn)-1);
+		ast_copy_string(fn, configfile, sizeof(fn));
 	} else {
 		snprintf(fn, sizeof(fn), "%s/%s", ast_config_AST_CONFIG_DIR, configfile);
 	}

Index: db.c
===================================================================
RCS file: /usr/cvsroot/asterisk/db.c,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -d -r1.16 -r1.17
--- db.c	22 Apr 2005 13:11:34 -0000	1.16
+++ db.c	6 Jun 2005 03:04:58 -0000	1.17
@@ -37,7 +37,6 @@
 #include "asterisk/manager.h"
 #include "db1-ast/include/db.h"
 #include "asterisk.h"
-#include "astconf.h"
 
 static DB *astdb;
 AST_MUTEX_DEFINE_STATIC(dblock);

Index: file.c
===================================================================
RCS file: /usr/cvsroot/asterisk/file.c,v
retrieving revision 1.66
retrieving revision 1.67
diff -u -d -r1.66 -r1.67
--- file.c	5 Jun 2005 16:32:16 -0000	1.66
+++ file.c	6 Jun 2005 03:04:58 -0000	1.67
@@ -34,7 +34,6 @@
 #include "asterisk/lock.h"
 #include "asterisk/app.h"
 #include "asterisk.h"
-#include "astconf.h"
 
 struct ast_format {
 	/* Name of format */

Index: image.c
===================================================================
RCS file: /usr/cvsroot/asterisk/image.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- image.c	22 Apr 2005 13:11:34 -0000	1.13
+++ image.c	6 Jun 2005 03:04:58 -0000	1.14
@@ -30,7 +30,6 @@
 #include "asterisk/cli.h"
 #include "asterisk/lock.h"
 #include "asterisk.h"
-#include "astconf.h"
 
 static struct ast_imager *list;
 AST_MUTEX_DEFINE_STATIC(listlock);

Index: loader.c
===================================================================
RCS file: /usr/cvsroot/asterisk/loader.c,v
retrieving revision 1.41
retrieving revision 1.42
diff -u -d -r1.41 -r1.42
--- loader.c	3 Jun 2005 01:42:31 -0000	1.41
+++ loader.c	6 Jun 2005 03:04:58 -0000	1.42
@@ -35,7 +35,6 @@
 #endif
 #include "asterisk/md5.h"
 #include "asterisk.h"
-#include "astconf.h"
 
 #ifndef RTLD_NOW
 #define RTLD_NOW 0

Index: logger.c
===================================================================
RCS file: /usr/cvsroot/asterisk/logger.c,v
retrieving revision 1.72
retrieving revision 1.73
diff -u -d -r1.72 -r1.73
--- logger.c	20 May 2005 13:58:39 -0000	1.72
+++ logger.c	6 Jun 2005 03:04:58 -0000	1.73
@@ -34,7 +34,6 @@
 #include "asterisk/utils.h"
 #include "asterisk/manager.h"
 #include "asterisk.h"
-#include "astconf.h"
 
 static int syslog_level_map[] = {
 	LOG_DEBUG,

Index: make_build_h
===================================================================
RCS file: /usr/cvsroot/asterisk/make_build_h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- make_build_h	9 May 2001 03:08:02 -0000	1.1
+++ make_build_h	6 Jun 2005 03:04:58 -0000	1.2
@@ -4,9 +4,8 @@
 MACHINE=`uname -m`
 OS=`uname -s`
 USER=`whoami`
-VERSION=`cat .version`
-rm -f build.h
-cat > build.h << END
+DATE=`date --utc "+%Y-%m-%d %H:%M:%S"`
+cat << END
 /*
  * build.h 
  * Automatically generated
@@ -15,6 +14,7 @@
 #define BUILD_KERNEL "${KERNEL}"
 #define BUILD_MACHINE "${MACHINE}"
 #define BUILD_OS "${OS}"
-#define BUILD_VERSION "${VERSION}"
+#define BUILD_DATE "${DATE}"
 #define BUILD_USER "${USER}"
+
 END




More information about the svn-commits mailing list