Index: Makefile =================================================================== RCS file: /usr/cvsroot/zaptel/Makefile,v retrieving revision 1.52.2.3 diff -u -r1.52.2.3 Makefile --- Makefile 18 Oct 2004 02:50:49 -0000 1.52.2.3 +++ Makefile 6 Nov 2004 12:23:09 -0000 @@ -1,5 +1,6 @@ # # Makefile for tormenta/carrier driver and utilities +# $Id: Makefile,v 1.6 2004/11/05 21:58:58 peternixon Exp $ # BASEADDR=0xd0000 @@ -31,13 +32,14 @@ KFLAGS+=-DSTANDALONE_ZAPATA CFLAGS+=-DSTANDALONE_ZAPATA +ROOT_PREFIX= INSTALL_PREFIX= CONFIG_FILE=$(INSTALL_PREFIX)/etc/zaptel.conf CFLAGS+=-DZAPTEL_CONFIG=\"$(CONFIG_FILE)\" BUILDVER=$(shell if uname -r | grep -q ^2.6; then echo "linux26"; else echo "linux24"; 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/modprobe.conf ]; then echo "$(INSTALL_PREFIX)/etc/modprobe.conf"; 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 $(ROOT_PREFIX)/etc/modprobe.d ]; then echo "$(ROOT_PREFIX)/etc/modprobe.d/zaptel"; elif [ -d $(ROOT_PREFIX)/etc/modutils ]; then echo "$(ROOT_PREFIX)/etc/modutils/zaptel"; elif [ -f $(ROOT_PREFIX)/etc/modprobe.conf ]; then echo "$(ROOT_PREFIX)/etc/modprobe.conf"; elif [ -f $(ROOT_PREFIX)/etc/modules.conf ]; then echo "$(ROOT_PREFIX)/etc/modules.conf"; else echo $(ROOT_PREFIX)/etc/conf.modules ; fi) ifeq (${BUILDVER},linux24) #We only support DEVFS in linux 2.4 kernels, since its considered obsolete post 2.4 @@ -65,6 +67,7 @@ PRIMARY=torisa #PRIMARY=wcfxo PWD=$(shell pwd) +KERNEL_SOURCE?=/lib/modules/`uname -r`/build all: $(BUILDVER) @@ -72,8 +75,8 @@ linux26: linux26: prereq $(BINS) - @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 + @if ! [ -d $(KERNEL_SOURCE) ]; then echo "You do not appear to have the kernel sources for your current kernel installed."; exit 1 ; fi + make -C $(KERNEL_SOURCE) SUBDIRS=$(PWD) modules obj-m := $(MODULESO) ztdummy.o @@ -191,7 +194,7 @@ $(LIBTONEZONE): $(TZOBJS) $(CC) -shared -Wl,-soname,libtonezone.so.1 -lm -o $@ $(TZOBJS) - /sbin/ldconfig -n . + [ `id -u` = 0 ] && /sbin/ldconfig || : ln -sf libtonezone.so.1 libtonezone.so ztcfg.c: ztcfg.h @@ -253,46 +256,42 @@ endif install: all devices $(LIBTONEZONE) - mkdir -p $(INSTALL_PREFIX)/sbin - install -m 755 ztcfg $(INSTALL_PREFIX)/sbin + install -D -m 755 ztcfg $(INSTALL_PREFIX)/usr/sbin/ztcfg if [ -f sethdlc-new ]; then \ - install -m 755 sethdlc-new $(INSTALL_PREFIX)/sbin/sethdlc; \ + install -D -m 755 sethdlc-new $(INSTALL_PREFIX)/usr/sbin/sethdlc; \ elif [ -f sethdlc ]; then \ - install -m 755 sethdlc $(INSTALL_PREFIX)/sbin ; \ + install -D -m 755 sethdlc $(INSTALL_PREFIX)/usr/sbin/sethdlc ; \ fi - if [ -f zttool ]; then install -m 755 zttool $(INSTALL_PREFIX)/sbin; fi - mkdir -p $(INSTALL_PREFIX)/lib/modules/`uname -r`/misc + if [ -f zttool ]; then install -D -m 755 zttool $(INSTALL_PREFIX)/usr/sbin/zttool; fi if [ -f zaptel.ko ]; then \ for x in $(MODULESKO) ztdummy.ko; do \ - install -m 644 $$x $(INSTALL_PREFIX)/lib/modules/`uname -r`/misc ; \ + install -D -m 644 $$x $(INSTALL_PREFIX)/lib/modules/`uname -r`/misc/$$x ; \ 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 ; \ + install -D -m 644 $$x $(INSTALL_PREFIX)/lib/modules/`uname -r`/misc/$$x ; \ 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 -D -m 755 $(LIBTONEZONE) $(INSTALL_PREFIX)/usr/lib/$(LIBTONEZONE) - mkdir -p $(INSTALL_PREFIX)/usr/include/linux - install -m 644 zaptel.h $(INSTALL_PREFIX)/usr/include/linux - install -m 644 torisa.h $(INSTALL_PREFIX)/usr/include/linux - install -m 644 tonezone.h $(INSTALL_PREFIX)/usr/include + install -D -m 644 zaptel.h $(INSTALL_PREFIX)/usr/include/linux/zaptel.h + install -D -m 644 torisa.h $(INSTALL_PREFIX)/usr/include/linux/torisa.h + install -D -m 644 tonezone.h $(INSTALL_PREFIX)/usr/include/tonezone.h ( cd $(INSTALL_PREFIX)/usr/lib ; rm -f libtonezone.so ; ln -sf $(LIBTONEZONE) libtonezone.so ) - /sbin/ldconfig + [ `id -u` = 0 ] && /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" | \ - grep -v "post-install wcfxsusb /sbin/ztcfg" | \ - grep -v "post-install wcfxs /sbin/ztcfg" > $(MODCONF) || true + grep -v "post-install torisa /usr/sbin/ztcfg" | \ + grep -v "post-install wcfxsusb /usr/sbin/ztcfg" | \ + grep -v "post-install wcfxs /usr/sbin/ztcfg" > $(MODCONF) || true if ! grep "options torisa" $(MODCONF); then \ echo "options torisa base=$(BASEADDR)" >> $(MODCONF); \ fi @@ -304,8 +303,8 @@ 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); \ + if [ -f zaptel.ko ]; then echo "install $$x /sbin/modprobe --ignore-install $$x && /usr/sbin/ztcfg" >> $(MODCONF); \ + else echo "post-install $$x /usr/sbin/ztcfg" >> $(MODCONF); \ fi; \ fi; \ fi; \ @@ -315,21 +314,22 @@ if [ -d /etc/modutils ]; then \ /sbin/update-modules ; \ fi - -/sbin/depmod -a - [ -f $(CONFIG_FILE) ] || install -m 644 zaptel.conf.sample $(CONFIG_FILE) + [ `id -u` = 0 ] && /sbin/depmod -a || : + [ -f $(CONFIG_FILE) ] || install -D -m 644 zaptel.conf.sample $(CONFIG_FILE) config: if [ -d $(INSTALL_PREFIX)/etc/rc.d/init.d ]; then \ - install -m 755 zaptel.init $(INSTALL_PREFIX)/etc/rc.d/init.d/zaptel; \ + install -D -m 755 zaptel.init $(INSTALL_PREFIX)/etc/rc.d/init.d/zaptel; \ chkconfig --add zaptel; \ elif [ -d $(INSTALL_PREFIX)/etc/init.d ]; then \ - install -m 755 zaptel.init $(INSTALL_PREFIX)/etc/init.d/zaptel; \ + install -D -m 755 zaptel.init $(INSTALL_PREFIX)/etc/init.d/zaptel; \ + chkconfig --add zaptel; \ fi if [ ! -f /etc/sysconfig/zaptel ]; then \ - install -m 644 zaptel.sysconfig $(INSTALL_PREFIX)/etc/sysconfig/zaptel; \ + install -D -m 644 zaptel.sysconfig $(INSTALL_PREFIX)/etc/sysconfig/zaptel; \ fi if [ -d /etc/sysconfig/network-scripts ]; then \ - install -m 755 ifup-hdlc $(INSTALL_PREFIX)/etc/sysconfig/network-scripts/ifup-hdlc; \ + install -D -m 755 ifup-hdlc $(INSTALL_PREFIX)/etc/sysconfig/network-scripts/ifup-hdlc; \ fi clean: