summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authormarkster <markster@5390a7c7-147a-4af0-8ec9-7488f05a26cb>2001-11-07 22:59:40 +0000
committermarkster <markster@5390a7c7-147a-4af0-8ec9-7488f05a26cb>2001-11-07 22:59:40 +0000
commita0403d948f135cc288eba6969d1df6473ba7dcbf (patch)
tree3f6db12a6d9f1afbbf75e65df1c8bd115d18cfa3 /Makefile
parent6eeafd614e36021635d37840f4bfaa5f34395e34 (diff)
Version 0.1.0 from FTP
git-svn-id: http://svn.digium.com/svn/zaptel/trunk@23 5390a7c7-147a-4af0-8ec9-7488f05a26cb
Diffstat (limited to 'Makefile')
-rwxr-xr-xMakefile156
1 files changed, 156 insertions, 0 deletions
diff --git a/Makefile b/Makefile
new file mode 100755
index 0000000..ef4e56b
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,156 @@
+#
+# Makefile for tormenta/carrier driver and utilities
+#
+BASEADDR=0xd0000
+DEFAULTZONE=0
+
+#
+# Okay, the people at RedHat have to break everything they can possibly even attempt to.
+# So, we have to look in /usr/src/linux-2.4/include for header files given their brain dead
+# crappy installation. (Mind you, I'm a RedHat user myself, so I suppose I'm just as
+# stupid as they are). Everyone else who is mildly sane of course links /usr/include/linux
+# to their working kernel source directory, the way God himself does, of course
+# (assuming He's running Linux -- which we all know He must).
+#
+KINCLUDES=$(shell if [ -d /usr/src/linux-2.4/include ]; then echo /usr/src/linux-2.4/include ; else echo /usr/src/linux/include ; fi)
+
+CFLAGS+=-I. -O4 -g -Wall -DBUILDING_TONEZONE #-DTONEZONE_DRIVER
+LCFLAGS=-fPIC $(CFLAGS) -DBUILDING_TONEZONE
+KFLAGS+=-I/usr/src/linux-2.4/include -O6
+KFLAGS+=-DMODULE -D__KERNEL__ -DEXPORT_SYMTAB -I/usr/src/linux/drivers/net \
+ -Wall -I. -Wstrict-prototypes -fomit-frame-pointer -I/usr/src/linux/drivers/net/wan -I /usr/src/linux/include -I/usr/src/linux/include/net
+KFLAGS+=$(shell [ -f $(KINCLUDES)/linux/modversions.h ] && echo "-DMODVERSIONS -include $(KINCLUDES)/linux/modversions.h")
+#
+# Features
+#
+KFLAGS+=-DCONFIG_ZAPATA_NET
+KFLAGS+=-DDEFAULT_TONE_ZONE=$(DEFAULTZONE)
+KFLAGS+=-DTORMENTA_BASE=$(BASEADDR)
+
+KFLAGS+=-DSTANDALONE_ZAPATA
+MODCONF=$(shell if [ -f /etc/modules.conf ]; then echo /etc/modules.conf; else echo /etc/conf.modules ; fi)
+
+TZOBJS=zonedata.lo tonezone.lo
+LIBTONEZONE=libtonezone.so.1.0
+MODULES=zaptel.o tor2.o torisa.o tigerjet.o wcfxo.o wct1xxp.o
+
+PRIMARY=tigerjet
+#PRIMARY=torisa
+#PRIMARY=wcfxo
+
+all: $(MODULES) ztcfg torisatool makefw
+
+devel: tor2ee
+
+tests: patgen pattest
+
+tor2.o: tor2.c tor2-hw.h tor.h tor2fw.h
+ gcc $(KFLAGS) -c tor2.c
+
+zaptel.o: zaptel.c zaptel.h digits.h
+ gcc $(KFLAGS) -c zaptel.c
+
+torisa.o: torisa.c zaptel.h torisa.h
+ gcc $(KFLAGS) -c torisa.c
+
+tigerjet.o: tigerjet.c tigerjet.h zaptel.h
+ gcc $(KFLAGS) -c tigerjet.c
+
+wcfxo.o: wcfxo.c zaptel.h
+ gcc $(KFLAGS) -c wcfxo.c
+wct1xxp.o:wct1xxp.c
+ gcc $(KFLAGS) -c wct1xxp.c
+
+tor2ee.o: tor2-hw.h
+
+tor2ee: tor2ee.o
+ gcc $(CFLAGS) -o tor2ee tor2ee.o -lpci
+
+zonedata.lo: zonedata.c
+ $(CC) -c $(LCFLAGS) -o zonedata.lo zonedata.c
+
+tonezone.lo: tonezone.c
+ $(CC) -c $(LCFLAGS) -o tonezone.lo tonezone.c
+
+torisatool: torisatool.o
+ $(CC) -o torisatool torisatool.o
+
+tones.h: gendigits
+ ./gendigits
+
+tor2fw.h: makefw tormenta2.rbt
+ ./makefw tormenta2.rbt tor2fw > tor2fw.h
+
+gendigits: gendigits.o
+ $(CC) -o gendigits gendigits.o -lm
+
+zaptel.c: tones.h
+
+$(LIBTONEZONE): $(TZOBJS)
+ $(CC) -shared -Wl,-soname,libtonezone.so.1 -lm -o $@ $(TZOBJS)
+ /sbin/ldconfig -n .
+ ln -sf libtonezone.so.1 libtonezone.so
+
+ztcfg.c: ztcfg.h
+
+ztcfg: ztcfg.o $(LIBTONEZONE)
+ $(CC) -o ztcfg ztcfg.o -L. -ltonezone
+
+devices:
+ mkdir -p /dev/zap
+ rm -f /dev/zap/ctl
+ rm -f /dev/zap/channel
+ rm -f /dev/zap/pseudo
+ mknod /dev/zap/ctl c 196 0
+ mknod /dev/zap/channel c 196 254
+ mknod /dev/zap/pseudo c 196 255
+ N=1; \
+ while [ $$N -lt 253 ]; do \
+ rm -f /dev/zap/$$N; \
+ mknod /dev/zap/$$N c 196 $$N; \
+ N=$$[$$N+1]; \
+ done
+
+install: all devices
+ install -m 755 ztcfg /sbin
+ mkdir -p /lib/modules/`uname -r`/misc
+ for x in $(MODULES); do \
+ install -m 644 $$x /lib/modules/`uname -r`/misc ; \
+ done
+ mkdir -p /usr/lib
+ install -m 755 $(LIBTONEZONE) /usr/lib
+ install -m 644 zaptel.h /usr/include/linux
+ install -m 644 torisa.h /usr/include/linux
+ install -m 644 tonezone.h /usr/include
+ ( cd /usr/lib ; rm -f libtonezone.so ; ln -sf $(LIBTONEZONE) libtonezone.so )
+ /sbin/ldconfig
+
+ mv -f $(MODCONF) $(MODCONF).bak
+ cat $(MODCONF).bak | grep -v "alias char-major-250" | \
+ grep -v "post-install torisa /sbin/ztcfg" | \
+ grep -v "post-install tigerjet /sbin/ztcfg" > $(MODCONF)
+ if ! grep "options torisa" $(MODCONF); then \
+ echo "options torisa base=$(BASEADDR)" >> $(MODCONF); \
+ fi
+ if ! grep "alias char-major-196" $(MODCONF); then \
+ echo "alias char-major-196 $(PRIMARY)" >> $(MODCONF); \
+ fi
+ if ! grep "post-install tigerjet" $(MODCONF); then \
+ echo "post-install tigerjet /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
+ /sbin/depmod -a
+ [ -f /etc/zaptel.conf ] || install -m 644 zaptel.conf.sample /etc/zaptel.conf
+
+clean:
+ rm -f *.o ztcfg tzdriver sethdlc
+ rm -f $(TZOBJS) $(LIBTONEZONE) *.lo
+ rm -f gendigits tones.h
+ rm -f libtonezone*
+ rm -f tor2ee
+ rm -f core