diff options
Diffstat (limited to 'Makefile')
-rwxr-xr-x | Makefile | 50 |
1 files changed, 25 insertions, 25 deletions
@@ -1,5 +1,6 @@ # # Makefile for tormenta/carrier driver and utilities +# $Id$ # BASEADDR=0xd0000 @@ -31,13 +32,14 @@ KFLAGS+=$(shell if uname -m | grep -q ppc; then echo "-msoft-float -fsigned-char 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 @@ BINS=ztcfg torisatool makefw ztmonitor ztspeed $(ZTTOOL) zttest PRIMARY=torisa #PRIMARY=wcfxo PWD=$(shell pwd) +KERNEL_SOURCE?=/lib/modules/`uname -r`/build all: $(BUILDVER) @@ -72,8 +75,8 @@ linux24: $(MODULESO) $(BINS) 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.a: $(TZOBJS) $(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,41 +256,37 @@ else endif install: all devices $(LIBTONEZONE) - mkdir -p $(INSTALL_PREFIX)/sbin - install -m 755 ztcfg $(INSTALL_PREFIX)/sbin + install -D -m 755 ztcfg $(INSTALL_PREFIX)/sbin/ztcfg if [ -f sethdlc-new ]; then \ - install -m 755 sethdlc-new $(INSTALL_PREFIX)/sbin/sethdlc; \ + install -D -m 755 sethdlc-new $(INSTALL_PREFIX)/sbin/sethdlc; \ elif [ -f sethdlc ]; then \ - install -m 755 sethdlc $(INSTALL_PREFIX)/sbin ; \ + install -D -m 755 sethdlc $(INSTALL_PREFIX)/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)/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" | \ @@ -315,21 +314,22 @@ install: all devices $(LIBTONEZONE) 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: |