diff --git a/Makefile b/Makefile
index a2ac5453842998abed9cc4e0f3696094d118705e..174852a599c37f1cb36762ceccc72c3b4e96de0d 100755
--- a/Makefile
+++ b/Makefile
@@ -171,7 +171,9 @@ db1-ast/libdb1.a:
 		exit 1; \
 	fi
 
+ifneq ($(wildcard .depend),)
 include .depend
+endif
 
 _version: 
 	if [ -d CVS ] && ! [ -f .version ]; then echo "CVS-`date +"%D-%T"`" > .version; fi 
diff --git a/agi/Makefile b/agi/Makefile
index c1b35de443fb0615f8647558e680db370b449ef5..1257e6a78f4b7092ba96e7794e0c093c38730714 100755
--- a/agi/Makefile
+++ b/agi/Makefile
@@ -32,7 +32,9 @@ clean:
 %.so : %.o
 	$(CC) -shared -Xlinker -x -o $@ $<
 
+ifneq ($(wildcard .depend),)
 include .depend
+endif
 
 depend: .depend
 
diff --git a/apps/Makefile b/apps/Makefile
index eee14d522de3cb5b76a156c8cb78bbd87416caf4..3f7383174c143d7b371fd28fcff1d822857f076c 100755
--- a/apps/Makefile
+++ b/apps/Makefile
@@ -75,7 +75,9 @@ app_sql_odbc.so: app_sql_odbc.o
 look:	look.c
 	gcc -pipe -O6 -g look.c -o look -lncurses
 
+ifneq ($(wildcard .depend),)
 include .depend
+endif
 
 depend: .depend
 
diff --git a/astman/Makefile b/astman/Makefile
index 7b9d20f6ff07f52650222f56e16ae09f0ca69904..18d924057244aeebf7dc5322d492e0f935be8268 100755
--- a/astman/Makefile
+++ b/astman/Makefile
@@ -21,7 +21,9 @@ clean:
 astman: astman.o ../md5.o
 	$(CC) -o astman astman.o ../md5.o -lnewt
 
+ifneq ($(wildcard .depend),)
 include .depend
+endif
 
 depend: .depend
 
diff --git a/cdr/Makefile b/cdr/Makefile
index 66c7e07a8143871bae83c4b6d87cdd5060e29257..00f7c80665b0d4215f384d1034b8c74239cd4d52 100755
--- a/cdr/Makefile
+++ b/cdr/Makefile
@@ -40,7 +40,9 @@ clean:
 %.so : %.o
 	$(CC) -shared -Xlinker -x -o $@ $<
 
+ifneq ($(wildcard .depend),)
 include .depend
+endif
 
 cdr_mysql.so: cdr_mysql.o
 	$(CC) -shared -Xlinker -x -o $@ $< -lmysqlclient -lz $(MLFLAGS)
diff --git a/channels/Makefile b/channels/Makefile
index ba5165d7ff2af3fc7cd72684c82a88102971ed75..a655df07ee32c3b156a6aa15008a9fe7ebe6bde1 100755
--- a/channels/Makefile
+++ b/channels/Makefile
@@ -73,7 +73,9 @@ clean:
 %.so : %.o
 	$(CC) -shared -Xlinker -x -o $@ $<
 
+ifneq ($(wildcard .depend),)
 include .depend
+endif
 
 gentone: gentone.c
 	$(CC) -o gentone gentone.c -lm
diff --git a/codecs/gsm/inc/config.h b/codecs/gsm/inc/config.h
index ef1bfcdaed05f3ce4fdc2b738d00bfa95f17742d..9fe31fdf145a04d2afe8784ca5895d4ddbf8f35d 100755
--- a/codecs/gsm/inc/config.h
+++ b/codecs/gsm/inc/config.h
@@ -9,29 +9,29 @@
 #ifndef	CONFIG_H
 #define	CONFIG_H
 
-/*efine	SIGHANDLER_T	int 		/* signal handlers are void	*/
-/*efine HAS_SYSV_SIGNAL	1		/* sigs not blocked/reset?	*/
+//#define	SIGHANDLER_T	int 		/* signal handlers are void	*/
+//#define HAS_SYSV_SIGNAL	1		/* sigs not blocked/reset?	*/
 
 #define	HAS_STDLIB_H	1		/* /usr/include/stdlib.h	*/
-/*efine	HAS_LIMITS_H	1		/* /usr/include/limits.h	*/
+//#define	HAS_LIMITS_H	1		/* /usr/include/limits.h	*/
 #define	HAS_FCNTL_H	1		/* /usr/include/fcntl.h		*/
-/*efine	HAS_ERRNO_DECL	1		/* errno.h declares errno	*/
+//#define	HAS_ERRNO_DECL	1		/* errno.h declares errno	*/
 
 #define	HAS_FSTAT 	1		/* fstat syscall		*/
 #define	HAS_FCHMOD 	1		/* fchmod syscall		*/
 #define	HAS_CHMOD 	1		/* chmod syscall		*/
 #define	HAS_FCHOWN 	1		/* fchown syscall		*/
 #define	HAS_CHOWN 	1		/* chown syscall		*/
-/*efine	HAS__FSETMODE 	1		/* _fsetmode -- set file mode	*/
+//#define	HAS__FSETMODE 	1		/* _fsetmode -- set file mode	*/
 
 #define	HAS_STRING_H 	1		/* /usr/include/string.h 	*/
-/*efine	HAS_STRINGS_H	1		/* /usr/include/strings.h 	*/
+//#define	HAS_STRINGS_H	1		/* /usr/include/strings.h 	*/
 
 #define	HAS_UNISTD_H	1		/* /usr/include/unistd.h	*/
 #define	HAS_UTIME	1		/* POSIX utime(path, times)	*/
-/*efine	HAS_UTIMES	1		/* use utimes()	syscall instead	*/
+//#define	HAS_UTIMES	1		/* use utimes()	syscall instead	*/
 #define	HAS_UTIME_H	1		/* UTIME header file		*/
-/*efine	HAS_UTIMBUF	1		/* struct utimbuf		*/
-/*efine	HAS_UTIMEUSEC   1		/* microseconds in utimbuf?	*/
+//#define	HAS_UTIMBUF	1		/* struct utimbuf		*/
+//#define	HAS_UTIMEUSEC   1		/* microseconds in utimbuf?	*/
 
 #endif	/* CONFIG_H */
diff --git a/codecs/gsm/src/code.c b/codecs/gsm/src/code.c
index 73955429449457d249b86dbb40e62bb8fbdaf803..4d195dfbd09174ce59c53e0540ae2c7fef0e09c9 100755
--- a/codecs/gsm/src/code.c
+++ b/codecs/gsm/src/code.c
@@ -8,9 +8,8 @@
 
 #include	"config.h"
 
-
-#ifdef	HAS_STDLIB_H
-#include	<stdlib.h>
+#ifdef	HAS_STRING_H
+#include	<string.h>
 #else
 #	include "proto.h"
 	extern char	* memcpy P((char *, char *, int));
@@ -86,7 +85,6 @@ void Gsm_Coder P8((S,s,LARc,Nc,bc,Mc,xmaxc,xMc),
 		 */
 
 		{ register int i;
-		  register longword ltmp;
 		  for (i = 0; i <= 39; i++)
 			dp[ i ] = GSM_ADD( e[5 + i], dpp[i] );
 		}
diff --git a/db1-ast/Makefile b/db1-ast/Makefile
index 8a945c2700daeb5e2e6cd8d01b2f7f320596c223..0bb8ea5c5812de7622540ba3dd9be5bf860c2c1e 100755
--- a/db1-ast/Makefile
+++ b/db1-ast/Makefile
@@ -40,7 +40,7 @@ clean:
 	rm -f $(LIBDB) $(LIBDBSO) $(OBJS) $(SHOBJS)
 
 OORG=	-O2
-CL=	$(CC) -c -D__DBINTERFACE_PRIVATE $(OORG) -I. -Iinclude
+CL=	$(CC) -Wall -c -D__DBINTERFACE_PRIVATE $(OORG) -I. -Iinclude
 
 db_dump185.o: db_dump185.c
 	$(CL) -o $@ $<
diff --git a/formats/Makefile b/formats/Makefile
index 37242bc0de36ce9f95806cc62e6d1c7f46f02a14..4ee85f489d1c6eeac324c85639ab0ecd4fa7c78f 100755
--- a/formats/Makefile
+++ b/formats/Makefile
@@ -32,7 +32,9 @@ clean:
 %.so : %.o
 	$(CC) -shared -Xlinker -x -o $@ $<
 
+ifneq ($(wildcard .depend),)
 include .depend
+endif
 
 format_mp3.so : format_mp3.o
 	$(CC) -shared -Xlinker -x -o $@ $< -lm
diff --git a/pbx/Makefile b/pbx/Makefile
index 502fee1111776611bba015378220e8d3cdbbe144..96ae7e37210d4db35d0ed0b819d0d0d71d657d11 100755
--- a/pbx/Makefile
+++ b/pbx/Makefile
@@ -57,7 +57,9 @@ pbx_kdeconsole.so: $(KDE_CONSOLE_OBJS)
 %.so : %.o
 	$(CC) -shared -Xlinker -x -o $@ $<
 
+ifneq ($(wildcard .depend),)
 include .depend
+endif
 
 install: all
 	for x in $(PBX_LIBS); do $(INSTALL) -m 755 $$x $(MODULES_DIR) ; done
diff --git a/res/Makefile b/res/Makefile
index 136c54b88bbe4e9a0cc57bcda5d1e46e2fe962ec..314d94da85c54169c0bd3747656627c8e7b2a95d 100755
--- a/res/Makefile
+++ b/res/Makefile
@@ -36,7 +36,9 @@ clean:
 %.so : %.o
 	$(CC) -shared -Xlinker -x -o $@ $<
 
+ifneq ($(wildcard .depend),)
 include .depend
+endif
 
 depend: .depend