[Asterisk-Dev] zaptel Makefile cleanup

Steven Pritchard steve at silug.org
Thu Apr 17 12:13:04 MST 2003


Below is a little patch that should help the zaptel Makefile do a
better job finding the kernel source tree on any modern Linux box.  It
will also make it easier to compile zaptel against another kernel (by
just redefining KVERSION).

Steve
-- 
steve at silug.org           | Southern Illinois Linux Users Group
(618)398-7360             | See web site for meeting details.
Steven Pritchard          | http://www.silug.org/

cvs server: Diffing .
Index: Makefile
===================================================================
RCS file: /usr/cvsroot/zaptel/Makefile,v
retrieving revision 1.3
diff -u -r1.3 Makefile
--- Makefile	21 Mar 2003 17:07:58 -0000	1.3
+++ Makefile	17 Apr 2003 19:22:26 -0000
@@ -4,22 +4,16 @@
 BASEADDR=0xd0000
 DEFAULTZONE=0
 
-#
-# 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)
+KVERSION=$(shell uname -r)
+KSRCDIR=$(shell if [ -d /lib/modules/$(KVERSION)/build ]; then echo /lib/modules/$(KVERSION)/build ; else echo /usr/src/linux ; fi)
+KINCLUDES=$(KSRCDIR)/include
 
 CFLAGS+=-I. -O4 -g -Wall -DBUILDING_TONEZONE #-DTONEZONE_DRIVER
 CFLAGS+=$(shell if uname -m | grep -q ppc; then echo "-fsigned-char"; fi)
 LCFLAGS=-fPIC $(CFLAGS) -DBUILDING_TONEZONE
-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
+KFLAGS+=-I$(KINCLUDES) -O6
+KFLAGS+=-DMODULE -D__KERNEL__ -DEXPORT_SYMTAB -I$(KSRCDIR)/drivers/net \
+	-Wall -I. -Wstrict-prototypes -fomit-frame-pointer -I$(KSRCDIR)/drivers/net/wan -I$(KINCLUDES) -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)
 #



More information about the asterisk-dev mailing list