summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authormattf <mattf@5390a7c7-147a-4af0-8ec9-7488f05a26cb>2006-01-12 21:24:21 +0000
committermattf <mattf@5390a7c7-147a-4af0-8ec9-7488f05a26cb>2006-01-12 21:24:21 +0000
commit254ac835731f0332304432d08585e70cfeb55f58 (patch)
tree59ff260b5f3d93baf52df8d7811d462f7af4f2cc /Makefile
parent2664c956bae2ad40c226c44f546769607832ba99 (diff)
More makefile cleanups, organizations from tzafrir (#4962)
git-svn-id: http://svn.digium.com/svn/zaptel/trunk@897 5390a7c7-147a-4af0-8ec9-7488f05a26cb
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile30
1 files changed, 23 insertions, 7 deletions
diff --git a/Makefile b/Makefile
index 7a61668..484bbea 100644
--- a/Makefile
+++ b/Makefile
@@ -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 @@ ifndef KSRC
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 @@ KFLAGS+=-DMODULE -D__KERNEL__ -DEXPORT_SYMTAB -I$(KSRC)/drivers/net \
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 @@ INSTALL_PREFIX=$(DESTDIR)
CONFIG_FILE=$(INSTALL_PREFIX)/etc/zaptel.conf
CFLAGS+=-DZAPTEL_CONFIG=\"$(CONFIG_FILE)\"
-ifeq (2.6,$(shell echo $(KVERS) | cut -d. -f1-2))
- BUILDVER:=linux26
-else
+ifeq ($(KVERS_MAJ),2.4)
BUILDVER:=linux24
+else
+ BUILDVER:=linux26
endif
ifeq ($(BUILDVER),linux26)