[zaptel-commits] trunk - r897 /trunk/Makefile

zaptel-commits at lists.digium.com zaptel-commits at lists.digium.com
Thu Jan 12 15:24:21 CST 2006


Author: mattf
Date: Thu Jan 12 15:24:21 2006
New Revision: 897

URL: http://svn.digium.com/view/zaptel?rev=897&view=rev
Log:
More makefile cleanups, organizations from tzafrir (#4962)

Modified:
    trunk/Makefile

Modified: trunk/Makefile
URL: http://svn.digium.com/view/zaptel/trunk/Makefile?rev=897&r1=896&r2=897&view=diff
==============================================================================
--- trunk/Makefile (original)
+++ trunk/Makefile Thu Jan 12 15:24:21 2006
@@ -7,6 +7,11 @@
 BASEADDR=0xd0000
 
 HOSTCC=gcc
+ifeq ($(DEB_HOST_GNU_TYPE),)
+UNAME_M:=$(shell uname -m)
+else
+UNAME_M:=$(DEB_HOST_GNU_TYPE)
+endif
 # If you want to build for a kernel other than the current kernel, set KVERS
 ifndef KVERS
 KVERS:=$(shell uname -r)
@@ -19,11 +24,16 @@
     KSRC:=$(shell for dir in $(KSRC_SEARCH_PATH); do if [ -d $$dir ]; then echo $$dir; break; fi; done)
   endif
 endif
+KVERS_MAJ:=$(shell echo $(KVERS) | cut -d. -f1-2)
 KINCLUDES:=$(KSRC)/include
 
 CFLAGS+=-I. -O4 -g -Wall -DBUILDING_TONEZONE #-DTONEZONE_DRIVER
-CFLAGS_PPC:=$(shell if uname -m | grep -q ppc; then echo "-fsigned-char"; fi)
-CFLAGS_X86-64:=$(shell if uname -m | grep -q x86_64; then echo "-m64"; fi)
+ifneq (,$(findstring ppc,$(UNAME_M)))
+CFLAGS_PPC:=-fsigned-char
+endif
+ifneq (,$(findstring x86_64,$(UNAME_M)))
+CFLAGS_X86-64:=-m64
+endif
 CFLAGS+=$(CFLAGS_PPC) $(CFLAGS_X86-64)
 LCFLAGS=-fPIC $(CFLAGS) -DBUILDING_TONEZONE
 KFLAGS=-I$(KINCLUDES) -O6
@@ -32,9 +42,15 @@
 ifneq (,$(wildcard $(KINCLUDES)/linux/modversions.h))
   KFLAGS+=-DMODVERSIONS -include $(KINCLUDES)/linux/modversions.h
 endif
-KFLAGS_PPC:=$(shell if uname -m | grep -q ppc; then echo "-msoft-float -fsigned-char"; fi)
+ifneq (,$(findstring ppc,$(UNAME_M)))
+KFLAGS_PPC:=-msoft-float -fsigned-char
+endif
 KFLAGS+=$(KFLAGS_PPC)
-KFLAGS+=$(shell if uname -r | grep -q 2.4; then if uname -m | grep -q x86_64; then echo "-mcmodel=kernel"; fi; fi)
+ifeq ($(KVERS_MAJ),2.4)
+  ifneq (,$(findstring x86_64,$(UNAME_M)))
+    KFLAGS+=-mcmodel=kernel
+  endif
+endif
 
 #
 # Features are now configured in zconfig.h
@@ -49,10 +65,10 @@
 CONFIG_FILE=$(INSTALL_PREFIX)/etc/zaptel.conf
 CFLAGS+=-DZAPTEL_CONFIG=\"$(CONFIG_FILE)\"
 
-ifeq (2.6,$(shell echo $(KVERS) | cut -d. -f1-2))
+ifeq ($(KVERS_MAJ),2.4)
+  BUILDVER:=linux24
+else
   BUILDVER:=linux26
-else
-  BUILDVER:=linux24
 endif
 
 ifeq ($(BUILDVER),linux26)



More information about the zaptel-commits mailing list