summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authormarkster <markster@5390a7c7-147a-4af0-8ec9-7488f05a26cb>2004-02-20 15:50:20 +0000
committermarkster <markster@5390a7c7-147a-4af0-8ec9-7488f05a26cb>2004-02-20 15:50:20 +0000
commitb83db498b2edaa82b3465f9c1b2d151d3a6fc5c3 (patch)
tree71293cd0857bf48c4c5f9484a96249414846bcce /Makefile
parentf928dbbced084622838fa6c8772833a96c66d960 (diff)
Makefile fixes for the 2.6 kernel
git-svn-id: http://svn.digium.com/svn/zaptel/trunk@314 5390a7c7-147a-4af0-8ec9-7488f05a26cb
Diffstat (limited to 'Makefile')
-rwxr-xr-xMakefile72
1 files changed, 39 insertions, 33 deletions
diff --git a/Makefile b/Makefile
index f52a8b1..6facc0e 100755
--- a/Makefile
+++ b/Makefile
@@ -33,29 +33,33 @@ CFLAGS+=-DSTANDALONE_ZAPATA
INSTALL_PREFIX=
-MODCONF=$(shell if [ -d $(INSTALL_PREFIX)/etc/modutils ]; then echo "$(INSTALL_PREFIX)/etc/modutils/zaptel"; elif [ -f $(INSTALL_PREFIX)/etc/modules.conf ]; then echo $(INSTALL_PREFIX)/etc/modules.conf; else echo $(INSTALL_PREFIX)/etc/conf.modules ; fi)
+MODCONF=$(shell if [ -d $(INSTALL_PREFIX)/etc/modprobe.d ]; then echo "$(INSTALL_PREFIX)/etc/modprobe.d/zaptel"; elif [ -d $(INSTALL_PREFIX)/etc/modutils ]; then echo "$(INSTALL_PREFIX)/etc/modutils/zaptel"; elif [ -f $(INSTALL_PREFIX)/etc/modules.conf ]; then echo $(INSTALL_PREFIX)/etc/modules.conf; else echo $(INSTALL_PREFIX)/etc/conf.modules ; fi)
DEVFS=$(shell ps ax | grep -v grep | grep devfsd)
TZOBJS=zonedata.lo tonezone.lo
LIBTONEZONE=libtonezone.so.1.0
-MODULES=zaptel.o tor2.o torisa.o wcusb.o wcfxo.o wcfxs.o \
- ztdynamic.o ztd-eth.o wct1xxp.o wct4xxp.o # ztdummy.o
-#MODULES+=wcfxsusb.o
+MODULES=zaptel tor2 torisa wcusb wcfxo wcfxs \
+ ztdynamic ztd-eth wct1xxp wct4xxp # ztdummy
+#MODULES+=wcfxsusb
+
+MODULESO=$(shell for x in $(MODULES); do echo "$$x.o "; done )
+MODULESKO=$(shell for x in $(MODULES); do echo "$$x.ko "; done )
+
ZTTOOL=$(shell if [ -f /usr/include/newt.h ]; then echo zttool; fi)
#PRIMARY=wcfxsusb
PRIMARY=torisa
#PRIMARY=wcfxo
PWD=$(shell pwd)
-all: $(MODULES) ztcfg torisatool makefw ztmonitor ztspeed $(ZTTOOL)
+all: $(MODULESO) ztcfg torisatool makefw ztmonitor ztspeed $(ZTTOOL)
linux26:
linux26: prereq ztcfg torisatool makefw ztmonitor ztspeed $(ZTTOOL)
@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
-obj-m := $(MODULES)
+obj-m := $(MODULESO)
#ifneq ($(TOPDIR),)
#include $(TOPDIR)/Rules.make
@@ -223,12 +227,23 @@ install: all devices
fi
if [ -f zttool ]; then install -m 755 zttool $(INSTALL_PREFIX)/sbin; fi
mkdir -p $(INSTALL_PREFIX)/lib/modules/`uname -r`/misc
- for x in $(MODULES); do \
- install -m 644 $$x $(INSTALL_PREFIX)/lib/modules/`uname -r`/misc ; \
- done
- if ! [ -f wcfxsusb.o ]; then \
- rm -f $(INSTALL_PREFIX)/lib/modules/`uname -r`/misc/wcfxsusb.o; \
+
+ if [ -f zaptel.ko ]; then \
+ for x in $(MODULESKO); do \
+ install -m 644 $$x $(INSTALL_PREFIX)/lib/modules/`uname -r`/misc ; \
+ done; \
+ if ! [ -f wcfxsusb.ko ]; then \
+ rm -f $(INSTALL_PREFIX)/lib/modules/`uname -r`/misc/wcfxsusb.o; \
+ fi; \
+ else \
+ for x in $(MODULESO); do \
+ install -m 644 $$x $(INSTALL_PREFIX)/lib/modules/`uname -r`/misc ; \
+ done; \
+ if ! [ -f wcfxsusb.o ]; then \
+ rm -f $(INSTALL_PREFIX)/lib/modules/`uname -r`/misc/wcfxsusb.ko; \
+ fi; \
fi
+
mkdir -p $(INSTALL_PREFIX)/usr/lib
install -m 755 $(LIBTONEZONE) $(INSTALL_PREFIX)/usr/lib
install -m 644 zaptel.h $(INSTALL_PREFIX)/usr/include/linux
@@ -236,7 +251,6 @@ install: all devices
install -m 644 tonezone.h $(INSTALL_PREFIX)/usr/include
( cd $(INSTALL_PREFIX)/usr/lib ; rm -f libtonezone.so ; ln -sf $(LIBTONEZONE) libtonezone.so )
/sbin/ldconfig
-
if [ -f $(MODCONF) ]; then mv -f $(MODCONF) $(MODCONF).bak ; fi
cat $(MODCONF).bak | grep -v "alias char-major-250" | \
grep -v "post-install torisa /sbin/ztcfg" | \
@@ -248,27 +262,19 @@ install: all devices
if ! grep "alias char-major-196" $(MODCONF); then \
echo "alias char-major-196 $(PRIMARY)" >> $(MODCONF); \
fi
- if ! grep "post-install wcfxs" $(MODCONF); then \
- echo "post-install wcfxs /sbin/ztcfg" >> $(MODCONF); \
- fi
- if ! grep "post-install wcfxsusb" $(MODCONF); then \
- echo "post-install wcfxsusb /sbin/ztcfg" >> $(MODCONF); \
- fi
- if ! grep "post-install torisa" $(MODCONF); then \
- echo "post-install torisa /sbin/ztcfg" >> $(MODCONF); \
- fi
- if ! grep "post-install tor2" $(MODCONF); then \
- echo "post-install tor2 /sbin/ztcfg" >> $(MODCONF); \
- fi
- if ! grep "post-install wcfxo" $(MODCONF); then \
- echo "post-install wcfxo /sbin/ztcfg" >> $(MODCONF); \
- fi
- if ! grep "post-install wct1xxp" $(MODCONF); then \
- echo "post-install wct1xxp /sbin/ztcfg" >> $(MODCONF); \
- fi
- if ! grep "post-install wct4xxp" $(MODCONF); then \
- echo "post-install wct4xxp /sbin/ztcfg" >> $(MODCONF); \
- fi
+
+ for x in $(MODULES); do \
+ if ! grep "post-install $$x" $(MODCONF); then \
+ if ! grep "install $$x " $(MODCONF); then \
+ if [ "$$x" != "zaptel" ] ; then \
+ if [ -f zaptel.ko ]; then echo "install $$x /sbin/modprobe --ignore-install $$x && /sbin/ztcfg" >> $(MODCONF); \
+ else echo "post-install $$x /sbin/ztcfg" >> $(MODCONF); \
+ fi; \
+ fi; \
+ fi; \
+ fi; \
+ done
+
if [ -d /etc/modutils ]; then \
/sbin/update-modules ; \
fi