summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authormarkster <markster@5390a7c7-147a-4af0-8ec9-7488f05a26cb>2004-11-06 16:40:42 +0000
committermarkster <markster@5390a7c7-147a-4af0-8ec9-7488f05a26cb>2004-11-06 16:40:42 +0000
commit6679aa2f08c81d44f17f75cd463e82a22bfb7fef (patch)
tree94aa1bd3baae6f8f738a60d0d5225d05f8ae3bfb /Makefile
parent721c2d8b7dfcb7715ece631172ed0c3d915f5b91 (diff)
Makefile fixes from bug #2798 and rename wcfxs to wctdm
git-svn-id: http://svn.digium.com/svn/zaptel/trunk@491 5390a7c7-147a-4af0-8ec9-7488f05a26cb
Diffstat (limited to 'Makefile')
-rwxr-xr-xMakefile71
1 files changed, 38 insertions, 33 deletions
diff --git a/Makefile b/Makefile
index a2a58cf..95c7798 100755
--- a/Makefile
+++ b/Makefile
@@ -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
@@ -51,7 +53,7 @@ endif
TZOBJS=zonedata.lo tonezone.lo
LIBTONEZONE=libtonezone.so.1.0
-MODULES=zaptel tor2 torisa wcusb wcfxo wcfxs \
+MODULES=zaptel tor2 torisa wcusb wcfxo wctdm \
ztdynamic ztd-eth wct1xxp wct4xxp wcte11xp pciradio # ztdummy
#MODULES+=wcfxsusb
@@ -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
@@ -114,8 +117,8 @@ wcte11xp.o:wcte11xp.c zaptel.h
wct4xxp.o:wct4xxp.c zaptel.h
$(HOSTCC) $(KFLAGS) -c wct4xxp.c
-wcfxs.o:wcfxs.c zaptel.h
- $(HOSTCC) $(KFLAGS) -c wcfxs.c
+wctdm.o:wctdm.c zaptel.h wctdm.h
+ $(HOSTCC) $(KFLAGS) -c wctdm.c
pciradio.o:pciradio.c zaptel.h
$(HOSTCC) $(KFLAGS) -c pciradio.c
@@ -194,7 +197,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
@@ -256,46 +259,44 @@ 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; \
+ rm -f $(INSTALL_PREFIX)/lib/modules/`uname -r`/misc/wcfxsusb.ko; \
fi; \
+ rm -f $(INSTALL_PREFIX)/lib/modules/`uname -r`/misc/wcfxs.ko; \
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; \
+ rm -f $(INSTALL_PREFIX)/lib/modules/`uname -r`/misc/wcfxsusb.o; \
fi; \
+ rm -f $(INSTALL_PREFIX)/lib/modules/`uname -r`/misc/wcfxs.o; \
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 wctdm /sbin/ztcfg" > $(MODCONF) || true
if ! grep "options torisa" $(MODCONF); then \
echo "options torisa base=$(BASEADDR)" >> $(MODCONF); \
fi
@@ -304,8 +305,8 @@ install: all devices $(LIBTONEZONE)
fi
for x in $(MODULES); do \
- if ! grep "post-install $$x" $(MODCONF); then \
- if ! grep "install $$x " $(MODCONF); then \
+ 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 && /sbin/ztcfg" >> $(MODCONF); \
else echo "post-install $$x /sbin/ztcfg" >> $(MODCONF); \
@@ -314,25 +315,29 @@ install: all devices $(LIBTONEZONE)
fi; \
fi; \
done
+ if ! grep "alias wcfxs" $(MODCONF); then \
+ echo "alias wcfxs wctdm" >> $(MODCONF); \
+ fi \
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: