[Asterisk-Dev] [patch] zaptel Makefile is archaic

Angus Lees angus.lees at urnet.com.au
Sun Jul 25 18:59:22 MST 2004

Apologies if this is the wrong place for patches, but its a very small
patch and I couldn't find another place to submit it without having to
create accounts on web pages first.

This patch updates the zaptel Makefile to "recent" kernel build
innovations - in particular the "linux26" build method has also been
available for 2.4 kernels for some time now.  I removed a small amount
of the superseded cruft, but there is plenty more that could be

I consider this too small to need disclaiming, but if someone feels I
should then I am happy to do so.

 - Gus

-------------- next part --------------
Index: Makefile
RCS file: /usr/cvsroot/zaptel/Makefile,v
retrieving revision 1.51
diff -u -r1.51 Makefile
--- Makefile	24 Jul 2004 16:03:27 -0000	1.51
+++ Makefile	25 Jul 2004 23:39:12 -0000
@@ -3,24 +3,18 @@
-# Okay, the people at RedHat have to break everything they can possibly even attempt to.
-# So, we have to look in /usr/src/linux-2.4/include for header files given their brain dead
-# crappy installation.  (Mind you, I'm a RedHat user myself, so I suppose I'm just as
-# stupid as they are).  Everyone else who is mildly sane of course links /usr/include/linux
-# to their working kernel source directory, the way God himself does, of course
-# (assuming He's running Linux -- which we all know He must).
-KINCLUDES=$(shell if [ -d /usr/src/linux-2.4/include ]; then echo /usr/src/linux-2.4/include ; else echo /usr/src/linux/include ; fi)
+KSRC=/lib/modules/`uname -r`/build
 CFLAGS+=$(shell if uname -m | grep -q ppc; then echo "-fsigned-char"; fi)
 CFLAGS+=$(shell if uname -m | grep -q x86_64; then echo "-m64"; fi)
-KFLAGS+=-I/usr/src/linux-2.4/include -O6
-KFLAGS+=-DMODULE -D__KERNEL__ -DEXPORT_SYMTAB -I/usr/src/linux/drivers/net \
-	-Wall -I. -Wstrict-prototypes -fomit-frame-pointer -I/usr/src/linux/drivers/net/wan -I /usr/src/linux/include -I/usr/src/linux/include/net
+	-Wall -I. -Wstrict-prototypes -fomit-frame-pointer -I$(KSRC)/drivers/net/wan -I$(KINCLUDES)/net
 KFLAGS+=$(shell [ -f $(KINCLUDES)/linux/modversions.h ] && echo "-DMODVERSIONS -include $(KINCLUDES)/linux/modversions.h")
 KFLAGS+=$(shell if uname -m | grep -q ppc; then echo "-msoft-float -fsigned-char"; fi)
@@ -52,8 +46,8 @@
 	ztdynamic ztd-eth wct1xxp wct4xxp # ztdummy
-MODULESO=$(shell for x in $(MODULES); do echo "$$x.o "; done )
-MODULESKO=$(shell for x in $(MODULES); do echo "$$x.ko "; done )
+MODULESO=$(addsuffix .o, $(MODULES))
+MODULESKO=$(addsuffix .ko, $(MODULES))
 ZTTOOL=$(shell if [ -f /usr/include/newt.h ]; then echo zttool; fi)
 BINS=ztcfg torisatool makefw ztmonitor ztspeed $(ZTTOOL) zttest
@@ -61,16 +55,9 @@
-PWD=$(shell pwd)
-all: $(BUILDVER)
-linux24: $(MODULESO) $(BINS)
-linux26: prereq $(BINS)
-	@if ! [ -d /usr/src/linux-2.6 ]; then echo "Link /usr/src/linux-2.6 to your kernel sources first!"; exit 1 ; fi
-	make -C /usr/src/linux-2.6 SUBDIRS=$(PWD) modules
+all: prereq $(BINS)
+	make -C $(KSRC) SUBDIRS=$(CURDIR) modules
 obj-m := $(MODULESO) ztdummy.o

More information about the asterisk-dev mailing list