summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorkpfleming <kpfleming@5390a7c7-147a-4af0-8ec9-7488f05a26cb>2006-05-17 18:50:38 +0000
committerkpfleming <kpfleming@5390a7c7-147a-4af0-8ec9-7488f05a26cb>2006-05-17 18:50:38 +0000
commitab2555f5438340ba23ec748cdd8c23d1a302702b (patch)
tree485cb7f8f1a3f2b32bb667a5db753c747c745ac7 /Makefile
parent837ddf6f037fd1381b8dc343e0f6626700c5f4bf (diff)
move module-rules building into a script, and remove some old unnecessary steps
git-svn-id: http://svn.digium.com/svn/zaptel/branches/1.2@1065 5390a7c7-147a-4af0-8ec9-7488f05a26cb
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile122
1 files changed, 21 insertions, 101 deletions
diff --git a/Makefile b/Makefile
index 173508e..8f3daf1 100644
--- a/Makefile
+++ b/Makefile
@@ -4,7 +4,7 @@
# Copyright (C) 2001-2006 Digium, Inc.
#
#
-BASEADDR=0xd0000
+
PWD:=$(shell pwd)
HOSTCC=gcc
@@ -59,48 +59,12 @@ else
BUILDVER:=linux24
endif
-ifeq ($(BUILDVER),linux26)
- ifneq (,$(wildcard $(ROOT_PREFIX)/etc/modprobe.d))
- MODCONF:=$(ROOT_PREFIX)/etc/modprobe.d/zaptel
- else
- ifneq (,$(wildcard $(ROOT_PREFIX)/etc/modules.d))
- MODCONF:=$(ROOT_PREFIX)/etc/modules.d/zaptel
- else
- ifneq (,$(wildcard $(ROOT_PREFIX)/etc/modprobe.conf))
- MODCONF:=$(ROOT_PREFIX)/etc/modprobe.conf
- MODCONFBACKUP:=1
- else
- ifneq (,$(wildcard $(ROOT_PREFIX)/etc/conf.modules))
- MODCONF:=$(ROOT_PREFIX)/etc/conf.modules
- MODCONFBACKUP:=1
- endif
- endif
- endif
- endif
- # get the minor version of module-init-tools, since only 3.2.x and above support
- # $CMDLINE_OPTS replacement
- MODTOOLSVERSION:=$(shell modprobe --version | awk '{print $$3;}' | cut -d . -f2)
- ifneq ($(MODTOOLSVERSION),1)
- MODCMDLINE:=\$$CMDLINE_OPTS
- endif
-else # BUILDVER == linux24
- ifneq (,$(wildcard $(ROOT_PREFIX)/etc/modutils))
- MODCONF:=$(ROOT_PREFIX)/etc/modutils/zaptel
- MODCONFBACKUP:=1
- else
- ifneq (,$(wildcard $(ROOT_PREFIX)/etc/modules.conf))
- MODCONF:=$(ROOT_PREFIX)/etc/modules.conf
- MODCONFBACKUP:=1
- endif
- endif
-endif
-
-ifeq (${BUILDVER},linux24)
+ifeq ($(BUILDVER),linux24)
#We only support DEVFS in linux 2.4 kernels, since its considered obsolete post 2.4
DYNFS:=$(shell ps ax | grep -q -v grep | grep -q devfsd && echo "yes")
endif
-ifeq (${BUILDVER},linux26)
+ifeq ($(BUILDVER),linux26)
ifneq (,$(wildcard $(ROOT_PREFIX)/etc/udev/rules.d))
DYNFS=yes
UDEVRULES=yes
@@ -137,7 +101,7 @@ MODULES:=zaptel tor2 torisa wcusb wcfxo wctdm wctdm24xxp \
ztd-loc # ztdummy
#MODULES+=wcfxsusb
# build ztdummy by default for 2.6 kernels
-ifeq (${BUILDVER},linux26)
+ifeq ($(BUILDVER),linux26)
MODULES+=ztdummy
endif
@@ -162,10 +126,6 @@ ZTTOOL:=zttool
endif
BINS=ztcfg torisatool makefw ztmonitor ztspeed $(ZTTOOL) zttest fxotune
-#PRIMARY=wcfxsusb
-PRIMARY=torisa
-#PRIMARY=wcfxo
-
all: $(BUILDVER) $(LIBTONEZONE_SO)
linux24: prereq $(MODULESO) $(BINS)
@@ -348,24 +308,20 @@ install: all devices
install -D -m 755 sethdlc $(INSTALL_PREFIX)/sbin/sethdlc ; \
fi
if [ -f zttool ]; then install -D -m 755 zttool $(INSTALL_PREFIX)/sbin/zttool; fi
- if [ -f zaptel.ko ]; then \
- for x in $(MODULESKO); do \
- rm -f $(INSTALL_PREFIX)/lib/modules/$(KVERS)/extra/$$x ; \
- done; \
- $(KMAKE_INST); \
- if ! [ -f wcfxsusb.ko ]; then \
- rm -f $(INSTALL_PREFIX)/lib/modules/$(KVERS)/misc/wcfxsusb.ko; \
- fi; \
- rm -f $(INSTALL_PREFIX)/lib/modules/$(KVERS)/misc/wcfxs.ko; \
- else \
- for x in $(MODULESO); do \
- install -D -m 644 $$x $(INSTALL_PREFIX)/lib/modules/$(KVERS)/misc/$$x ; \
- done; \
- if ! [ -f wcfxsusb.o ]; then \
- rm -f $(INSTALL_PREFIX)/lib/modules/$(KVERS)/misc/wcfxsusb.o; \
- fi; \
- rm -f $(INSTALL_PREFIX)/lib/modules/$(KVERS)/misc/wcfxs.o; \
- fi
+ifeq ($(BUILDVER),linux26)
+ for x in $(MODULESKO); do \
+ rm -f $(INSTALL_PREFIX)/lib/modules/$(KVERS)/extra/$$x ; \
+ done; \
+ $(KMAKE_INST); \
+else
+ for x in $(MODULESO); do \
+ install -D -m 644 $$x $(INSTALL_PREFIX)/lib/modules/$(KVERS)/misc/$$x ; \
+ done; \
+endif
+ if ! [ -f wcfxsusb.o ]; then \
+ rm -f $(INSTALL_PREFIX)/lib/modules/$(KVERS)/misc/wcfxsusb.o; \
+ fi; \
+ rm -f $(INSTALL_PREFIX)/lib/modules/$(KVERS)/misc/wcfxs.o
install -D -m 755 $(LIBTONEZONE_SO) $(INSTALL_PREFIX)/usr/lib/$(LIBTONEZONE_SO).$(LIBTONEZONE_SO_MAJOR_VER).$(LIBTONEZONE_SO_MINOR_VER)
[ `id -u` = 0 ] && /sbin/ldconfig || :
rm -f $(INSTALL_PREFIX)/usr/lib/$(LIBTONEZONE_SO)
@@ -379,43 +335,7 @@ install: all devices
install -D -m 644 tonezone.h $(INSTALL_PREFIX)/usr/include/tonezone.h
install -m 644 doc/ztcfg.8 $(INSTALL_PREFIX)/usr/share/man/man8
install -m 644 doc/zttool.8 $(INSTALL_PREFIX)/usr/share/man/man8
- if [ -n "$(MODCONF)" ]; then \
- if [ -n "$(MODCONFBACKUP)" ]; then \
- if [ -f $(MODCONF) ]; then mv -f $(MODCONF) $(MODCONF).bak ; fi; \
- cat $(MODCONF).bak | grep -q -v "alias char-major-250" | \
- grep -q -v "post-install torisa /sbin/ztcfg" | \
- grep -q -v "post-install wcfxsusb /sbin/ztcfg" | \
- grep -q -v "alias wctdm" | \
- grep -q -v "post-install wctdm /sbin/ztcfg" > $(MODCONF); \
- if ! grep -q "options torisa" $(MODCONF); then \
- echo "options torisa base=$(BASEADDR)" >> $(MODCONF); \
- fi; \
- if ! grep -q "alias char-major-196" $(MODCONF); then \
- echo "alias char-major-196 $(PRIMARY)" >> $(MODCONF); \
- fi; \
- else \
- grep "^options" $(MODCONF) > $(MODCONF).new; \
- rm -f $(MODCONF) $(MODCONF).bak; \
- mv $(MODCONF).new $(MODCONF); \
- fi; \
- for x in $(MODULES); do \
- if ! grep -q "post-install $$x" $(MODCONF); then \
- if ! grep -q "install $$x " $(MODCONF); then \
- if [ "$$x" != "zaptel" ] ; then \
- if [ -f zaptel.ko ]; then echo "install $$x /sbin/modprobe --ignore-install $$x $(MODCMDLINE) && /sbin/ztcfg" >> $(MODCONF); \
- else echo "post-install $$x /sbin/ztcfg" >> $(MODCONF); \
- fi; \
- fi; \
- fi; \
- fi; \
- done; \
- if ! grep -q "alias wcfxs" $(MODCONF); then \
- echo "alias wcfxs wctdm" >> $(MODCONF); \
- fi; \
- if ! grep -q "alias wct2xxp" $(MODCONF); then \
- echo "alias wct2xxp wct4xxp" >> $(MODCONF); \
- fi; \
- fi
+ build_tools/genmodconf $(BUILDVER) "$(ROOT_PREFIX)" "$(filter-out zaptel,$(MODULES))"
if [ -d /etc/modutils ]; then \
/sbin/update-modules ; \
fi
@@ -467,10 +387,10 @@ update:
clean:
rm -f torisatool makefw tor2fw.h radfw.h
- rm -f ${BINS}
+ rm -f $(BINS)
rm -f *.o ztcfg tzdriver sethdlc sethdlc-new
rm -f $(TZOBJS) $(LIBTONEZONE_SO) *.lo
-ifeq (${BUILDVER},linux26)
+ifeq ($(BUILDVER),linux26)
$(KMAKE) clean
endif
rm -rf .tmp_versions