--- ./Makefile 2004-02-18 16:28:32.000000000 -0500 +++ ./Makefile.26new 2004-02-18 16:28:04.000000000 -0500 @@ -33,29 +33,33 @@ 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 @@ 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 -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 @@ 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