[Asterisk-Dev] Some makefile changes

Thorsten Lockert tholo at sigmasoft.com
Wed Apr 23 06:08:41 MST 2003


The attached diffs makes the following changes to the makefiles:

* Support the MySQL binary distribution from MySQL.COM
* Call the right make, in those cases where it may be
  installed as e.g. 'gmake'
* Handle dependencies for versioning better
* Make CVS prune empty directories, and be a bit more
  quiet

Index: Makefile
===================================================================
RCS file: /usr/cvsroot/asterisk/Makefile,v
retrieving revision 1.1.1.6
diff -u -r1.1.1.6 Makefile
--- Makefile	18 Mar 2003 06:00:13 -0000	1.1.1.6
+++ Makefile	23 Apr 2003 13:12:27 -0000
@@ -100,7 +100,7 @@
 	@echo " + cannot be run before being installed by   +"  
 	@echo " + running:                                  +"  
 	@echo " +                                           +"
-	@echo " +               make install                +"  
+	@echo " +               $(MAKE) install                +"  
 	@echo " +-------------------------------------------+"  
 
 all: asterisk subdirs
@@ -114,11 +114,11 @@
 	fi
 
 editline/libedit.a: editline/config.h
-	make -C editline libedit.a
+	$(MAKE) -C editline libedit.a
 
 db1-ast/libdb1.a: 
 	@if [ -d db1-ast ]; then \
-		make -C db1-ast libdb1.a ; \
+		$(MAKE) -C db1-ast libdb1.a ; \
 	else \
 		echo "You need to do a cvs update -d not just cvs update"; \
 		exit 1; \
@@ -134,8 +134,17 @@
 
 ast_expr.o: ast_expr.c
 
+cli.o: cli.c build.h
+
+ifneq ($(strip $(ASTERISKVERSION)),)
+asterisk.o: asterisk.c .version
+
+build.h: .version
+	./make_build_h
+else
 build.h:
 	./make_build_h
+endif
 
 asterisk: .version build.h editline/libedit.a db1-ast/libdb1.a $(OBJS)
 	gcc -o asterisk -rdynamic $(OBJS) $(LIBS) $(LIBEDIT) db1-ast/libdb1.a
@@ -148,8 +157,8 @@
 	rm -f *.o *.so asterisk
 	rm -f build.h 
 	rm -f ast_expr.c
-	@if [ -e editline/Makefile ]; then make -C editline clean ; fi
-	make -C db1-ast clean
+	@if [ -e editline/Makefile ]; then $(MAKE) -C editline clean ; fi
+	$(MAKE) -C db1-ast clean
 
 datafiles: all
 	mkdir -p $(ASTVARLIBDIR)/sounds/digits
@@ -179,7 +188,7 @@
 update: 
 	@if [ -d CVS ]; then \
 		echo "Updating from CVS..." ; \
-		cvs update -d; \
+		cvs -q update -Pd; \
 		rm -f .version; \
 	else \
 		echo "Not CVS";  \
@@ -216,14 +225,14 @@
 	@echo " + configuration files (overwriting any      +"
 	@echo " + existing config files), run:              +"  
 	@echo " +                                           +"
-	@echo " +               make samples                +"
+	@echo " +               $(MAKE) samples                +"
 	@echo " +                                           +"
 	@echo " +-----------------  or ---------------------+"
 	@echo " +                                           +"
 	@echo " + You can go ahead and install the asterisk +"
 	@echo " + program documentation now or later run:   +"
 	@echo " +                                           +"
-	@echo " +              make progdocs                +"
+	@echo " +              $(MAKE) progdocs                +"
 	@echo " +                                           +"
 	@echo " + **Note** This requires that you have      +"
 	@echo " + doxygen installed on your local system    +"
@@ -305,8 +314,8 @@
 __rpm: _version
 	rm -rf /tmp/asterisk ; \
 	mkdir -p /tmp/asterisk/redhat/RPMS/i386 ; \
-	make INSTALL_PREFIX=/tmp/asterisk install ; \
-	make INSTALL_PREFIX=/tmp/asterisk samples ; \
+	$(MAKE) INSTALL_PREFIX=/tmp/asterisk install ; \
+	$(MAKE) INSTALL_PREFIX=/tmp/asterisk samples ; \
 	mkdir -p /tmp/asterisk/etc/rc.d/init.d ; \
 	cp -f redhat/asterisk /tmp/asterisk/etc/rc.d/init.d/ ; \
 	cp -f redhat/rpmrc /tmp/asterisk/ ; \
@@ -329,6 +338,6 @@
 
 	
 dont-optimize:
-	make OPTIMIZE= K6OPT= install
+	$(MAKE) OPTIMIZE= K6OPT= install
 
 valgrind: dont-optimize
Index: cdr/Makefile
===================================================================
RCS file: /usr/cvsroot/asterisk/cdr/Makefile,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 Makefile
--- cdr/Makefile	12 Feb 2003 13:59:14 -0000	1.1.1.1
+++ cdr/Makefile	23 Apr 2003 13:12:27 -0000
@@ -18,12 +18,14 @@
 #
 # MySQL stuff...  Autoconf anyone??
 #
-MODS+=$(shell if [ -d /usr/include/mysql ] || [ -d /usr/local/include/mysql ] || [ -d /opt/mysql/include ]; then echo "cdr_mysql.so"; fi)
+MODS+=$(shell if [ -d /usr/local/mysql/include ] || [ --d /usr/include/mysql ] || [ -d /usr/local/include/mysql ] || [ -d /opt/mysql/include ]; then echo "cdr_mysql.so"; fi)
+CFLAGS+=$(shell if [ -d /usr/local/mysql/include ]; then echo "-I/usr/local/mysql/include"; fi)
 CFLAGS+=$(shell if [ -d /usr/include/mysql ]; then echo "-I/usr/include/mysql"; fi)
 CFLAGS+=$(shell if [ -d /usr/local/include/mysql ]; then echo "-I/usr/local/include/mysql"; fi)
 CFLAGS+=$(shell if [ -d /opt/mysql/include/mysql ]; then echo "-I/opt/mysql/include/mysql"; fi)
 MLFLAGS=
 MLFLAGS+=$(shell if [ -d /usr/lib/mysql ]; then echo "-L/usr/lib/mysql"; fi)
+MLFLAGS+=$(shell if [ -d /usr/local/mysql/lib ]; then echo "-L/usr/local/mysql/lib"; fi)
 MLFLAGS+=$(shell if [ -d /usr/local/lib/mysql ]; then echo "-L/usr/local/lib/mysql"; fi)
 MLFLAGS+=$(shell if [ -d /opt/mysql/lib/mysql ]; then echo "-L/opt/mysql/lib/mysql"; fi)
 
Index: channels/h323/Makefile
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/h323/Makefile,v
retrieving revision 1.2
diff -u -r1.2 Makefile
--- channels/h323/Makefile	2 Apr 2003 18:58:47 -0000	1.2
+++ channels/h323/Makefile	23 Apr 2003 13:12:27 -0000
@@ -43,7 +43,7 @@
 	@echo " + configuration file (overwriting existing   +"
 	@echo " + config file), run:                         +"
 	@echo " +                                            +"
-	@echo " +               make samples                 +"
+	@echo " +               $(MAKE) samples                 +"
 	@echo " +                                            +"
 	@echo " +                                            +"
  
Index: codecs/Makefile
===================================================================
RCS file: /usr/cvsroot/asterisk/codecs/Makefile,v
retrieving revision 1.2
diff -u -r1.2 Makefile
--- codecs/Makefile	15 Apr 2003 04:36:52 -0000	1.2
+++ codecs/Makefile	23 Apr 2003 13:12:27 -0000
@@ -40,30 +40,30 @@
 
 clean:
 	rm -f *.so *.o
-	! [ -d g723.1 ] || make -C g723.1 clean
-	! [ -d g723.1b ] || make -C g723.1b clean
-	make -C gsm clean
-	make -C mp3 clean
-	make -C lpc10 clean
-	make -C ilbc clean
+	! [ -d g723.1 ] || $(MAKE) -C g723.1 clean
+	! [ -d g723.1b ] || $(MAKE) -C g723.1b clean
+	$(MAKE) -C gsm clean
+	$(MAKE) -C mp3 clean
+	$(MAKE) -C lpc10 clean
+	$(MAKE) -C ilbc clean
 
 $(LIBG723):
-	make -C g723.1 all
+	$(MAKE) -C g723.1 all
 
 gsm/lib/libgsm.a:
-	make -C gsm lib/libgsm.a
+	$(MAKE) -C gsm lib/libgsm.a
 
 $(LIBG723B):
-	make -C g723.1b all
+	$(MAKE) -C g723.1b all
 
 $(LIBMP3):
-	make -C mp3 all
+	$(MAKE) -C mp3 all
 
 $(LIBLPC10):
-	make -C lpc10 all
+	$(MAKE) -C lpc10 all
 
 $(LIBILBC):
-	make -C ilbc all
+	$(MAKE) -C ilbc all
 
 codec_ilbc.so: codec_ilbc.o $(LIBILBC)
 	$(CC) -shared -Xlinker -x -o $@ $< $(LIBILBC)
Index: codecs/gsm/Makefile
===================================================================
RCS file: /usr/cvsroot/asterisk/codecs/gsm/Makefile,v
retrieving revision 1.1.1.2
diff -u -r1.1.1.2 Makefile
--- codecs/gsm/Makefile	18 Mar 2003 06:00:16 -0000	1.1.1.2
+++ codecs/gsm/Makefile	23 Apr 2003 13:12:27 -0000
@@ -351,12 +351,12 @@
 
 gsminstall:
 		-if [ x"$(GSM_INSTALL_ROOT)" != x ] ; then	\
-			make $(GSM_INSTALL_TARGETS) ;	\
+			$(MAKE) $(GSM_INSTALL_TARGETS) ;	\
 		fi
 
 toastinstall:
 		-if [ x"$(TOAST_INSTALL_ROOT)" != x ]; then	\
-			make $(TOAST_INSTALL_TARGETS);	\
+			$(MAKE) $(TOAST_INSTALL_TARGETS);	\
 		fi
 
 gsmuninstall:
--
Thorsten Lockert      | tholo at sigmasoft.com | Universe, n.:
2121 N. Lakeshore Dr. | tholo at openbsd.org   |         The problem.
Chapel Hill, NC 27514 |                     |



More information about the asterisk-dev mailing list