[zaptel-commits] branch group/kernelmove r1093 - in
/team/group/kernelmove: ./ kernel/ kernel/...
zaptel-commits at lists.digium.com
zaptel-commits at lists.digium.com
Sat May 27 05:58:39 MST 2006
Author: tzafrir
Date: Sat May 27 07:58:38 2006
New Revision: 1093
URL: http://svn.digium.com/view/zaptel?rev=1093&view=rev
Log:
Branch builds once again. Will have to check installability later
* removed Kbuild. Maybe Makefile will one day be renamed Kbuild
* kernel/Makefile: does not attempt to support direct run for 2.6
* kernel/Makefile: gendigits needs -lm
* kernel/makefile (2.4): everybody depends on zaptel.h's includes
* kernel/makefile (2.4): get modules list from main makefile
* kernel/makefile (2.4): -lm for gendigits here as well
* main Makefile: kernel version/source is ack here
* main Makefile: list of modules: only for 2.4
* main Makefile: reimplemented the install target
* main Makefile: original "install" renamed "install-messy"
* main Makefile: using stamps to after some stages
* main Makefile: libtonezone built without name hacks
Removed:
team/group/kernelmove/kernel/Kbuild
Modified:
team/group/kernelmove/ (props changed)
team/group/kernelmove/Makefile
team/group/kernelmove/kernel/ (props changed)
team/group/kernelmove/kernel/Makefile
team/group/kernelmove/kernel/datamods/ (props changed)
team/group/kernelmove/kernel/makefile
Propchange: team/group/kernelmove/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Sat May 27 07:58:38 2006
@@ -22,3 +22,4 @@
*.a
version.h
.*.swp
+modules-stamp
Modified: team/group/kernelmove/Makefile
URL: http://svn.digium.com/view/zaptel/team/group/kernelmove/Makefile?rev=1093&r1=1092&r2=1093&view=diff
==============================================================================
--- team/group/kernelmove/Makefile (original)
+++ team/group/kernelmove/Makefile Sat May 27 07:58:38 2006
@@ -15,6 +15,24 @@
UNAME_M:=$(DEB_HOST_GNU_TYPE)
endif
# If you want to build for a kernel other than the current kernel, set KVERS
+ifndef KVERS
+KVERS:=$(shell uname -r)
+endif
+ifndef KSRC
+ ifneq (,$(wildcard /lib/modules/$(KVERS)/build))
+ KSRC:=/lib/modules/$(KVERS)/build
+ else
+ KSRC_SEARCH_PATH:=/usr/src/linux-2.4 /usr/src/linux
+ KSRC:=$(shell for dir in $(KSRC_SEARCH_PATH); do if [ -d $$dir ]; then echo $$dir; break; fi; done)
+ endif
+endif
+KVERS_MAJ:=$(shell echo $(KVERS) | cut -d. -f1-2)
+
+MODULES:=zaptel tor2 torisa wcusb wcfxo wctdm wctdm24xxp \
+ ztdynamic ztd-eth wct1xxp wct4xxp wcte11xp pciradio \
+ ztd-loc
+
+MODULESO:=$(MODULES:%=%.o)
CFLAGS+=-I. -Ikernel -O4 -g -Wall -DBUILDING_TONEZONE #-DTONEZONE_DRIVER
ifneq (,$(findstring ppc,$(UNAME_M)))
@@ -40,6 +58,12 @@
CONFIG_FILE=$(INSTALL_PREFIX)/etc/zaptel.conf
CFLAGS+=-DZAPTEL_CONFIG=\"$(CONFIG_FILE)\"
+
+ifeq ($(KVERS_MAJ),2.4)
+ BUILDVER:=linux24
+else
+ BUILDVER:=linux26
+endif
ifeq ($(BUILDVER),linux26)
ifneq (,$(wildcard $(ROOT_PREFIX)/etc/modprobe.d))
@@ -102,23 +126,35 @@
endif
TZOBJS:=zonedata.lo tonezone.lo
-LIBTONEZONE_SO:=libtonezone.so
+LIBTONEZONE_SO_NAME:=libtonezone.so
LIBTONEZONE_SO_MAJOR_VER:=1
LIBTONEZONE_SO_MINOR_VER:=0
-
-
-
+LIBTONEZONE_SO:=$(LIBTONEZONE_SO_NAME).$(LIBTONEZONE_SO_MAJOR_VER).$(LIBTONEZONE_SO_MINOR_VER)
+
+LIBS:=$(LIBTONEZONE_SO) libtonezone.a
+
+# default installation directories.
+# Someone mixed INSTALL_PREFIX and DESTDIR
BIN_DIR:=$(INSTALL_PREFIX)/sbin
LIB_DIR:=$(INSTALL_PREFIX)/usr/lib
INC_DIR:=$(INSTALL_PREFIX)/usr/include
-MOD_DIR:=$(INSTALL_PREFIX)/lib/modules/$(KVERS)/misc
+INC_DIR_KERNEL:=$(INC_DIR)/linux
+MAN_DIR:=$(INSTALL_PREFIX)/usr/share/man/man8
MOD_DESTDIR:=zaptel
KERNDIR=kernel
ZAPTEL_H=$(KERNDIR)/zaptel.h
-
-obj-m:=$(MODULESO)
+TORISA_H=$(KERNDIR)/torisa.h
+TONEZONE_H=tonezone.h
+INC_KERNEL:=$(ZAPTEL_H) $(TORISA_H)
+INC_LIBS:=$(TONEZONE_H)
+
+# yuck. ny better suggestions?
+LDCONFIG_BIN=/sbin/ldconfig
+LDCONFIG=$(LDCONFIG_BIN) -n $(LIB_DIR) ; $(LDCONFIG_BIN) 2>/dev/null || true
+
+#obj-m:=$(MODULESO)
ifneq (,$(wildcard /usr/include/newt.h))
@@ -128,26 +164,20 @@
UTILS:=tor2ee ztspeed zttool ztmonitor sethdlc-new \
usbfxstest fxstest fxotune fxsdump ztdiag torisatool
UTILSO:=$(UTILS:%=%.o)
+MAN_PAGES:=$(shell for file in $(BINS:%=doc/%.8); do if [ -r $$file ]; then echo $$file; fi; done)
#PRIMARY=wcfxsusb
PRIMARY=torisa
#PRIMARY=wcfxo
PWD:=$(shell pwd)
-all: modules $(LIBTONEZONE_SO)
-
-programs: $(BINS)
-
-modules: $(BUILDVER)
-
-#linux24: prereq $(MODULESO) $(BINS)
-linux24: prereq $(BINS)
- make -C $(KERNDIR) MODULESO="$(MODULESO)" $(MODULESO)
-
-linux26: prereq $(BINS)
- @echo $(KSRC)
- @if [ -z "$(KSRC)" -o ! -d "$(KSRC)" ]; then echo "You do not appear to have the sources for the $(KVERS) kernel installed."; exit 1 ; fi
- $(KMAKE) modules
+all: modules programs
+
+install: modules-install programs-install
+
+programs: programs-stamp
+programs-stamp: $(BINS) $(LIBS) $(MAN_PAGES) $(INC_LIBS) $(INC_KERNEL)
+ touch "$@"
#ifneq ($(TOPDIR),)
#include $(TOPDIR)/Rules.make
@@ -192,7 +222,7 @@
ar rcs libtonezone.a $^
$(LIBTONEZONE_SO): $(TZOBJS)
- $(CC) -shared -Wl,-soname,$(LIBTONEZONE_SO).$(LIBTONEZONE_SO_MAJOR_VER).$(LIBTONEZONE_SO_MINOR_VER) -lm -o $@ $^
+ $(CC) -shared -Wl,-soname,$(LIBTONEZONE_SO) -lm -o $@ $^
ztcfg.c: ztcfg.h
@@ -261,7 +291,12 @@
endif
endif
-install: all devices
+SELINUX_LIB_FIX := if [ -x /usr/sbin/sestatus ] \
+ && /usr/sbin/sestatus | grep -q "SELinux status:.*enabled" ; then \
+ restorecon -v $(LIB_DIR)/$(LIBTONEZONE_SO); \
+ fi
+
+install-messy: all devices
install -D -m 755 ztcfg $(INSTALL_PREFIX)/sbin/ztcfg
if [ -f sethdlc-new ]; then \
install -D -m 755 sethdlc-new $(INSTALL_PREFIX)/sbin/sethdlc; \
@@ -393,35 +428,58 @@
echo "Not under version control"; \
fi
-# make should *fail* and not silently succeed if a program did not build
-install-programs: $(BINS) $(LIBTONEZONE) libtonezone.a
- install -d $(BIN_DIR)
- install $(BINS) $(BIN_DIR)
+programs-install: programs
+ install -d -m 755 $(BIN_DIR)
+ install -m 755 $(BINS) $(BIN_DIR)/
install -d $(LIB_DIR)
- install -m 755 $(LIBTONEZONE) libtonezone.a $(LIB_DIR)
- install -d $(INC_DIR)/linux
- install -m 644 tonezone.h $(INC_DIR)
- install -m 644 $(ZAPTEL_H) torisa.h $(INC_DIR)/linux
+ install $(LIBS) $(LIB_DIR)/
+ $(LDCONFIG)
+ $(SELINUX_LIB_FIX)
+ install -d $(INC_DIR)
+ install -m 644 $(INC_LIBS) $(INC_DIR)/
+ install -d $(INC_DIR_KERNEL)
+ install -m 644 $(INC_KERNEL) $(INC_DIR_KERNEL)/
+ install -d $(MAN_DIR)
+ install -m 644 $(MAN_PAGES) $(MAN_DIR)/
+
+modules: modules-stamp
+modules-stamp: $(BUILDVER)
+ touch "$@"
+
+install-modules: install-$(BUILDVER)
+
+#linux24: prereq $(MODULESO) $(BINS)
+linux24:
+ make -C $(KERNDIR) KSRC="$(KSRC)" MODULESO="$(MODULESO)" $(MODULESO)
+
+linux24-install:
+ make -C $(KERNDIR) MODULESO="$(MODULESO)" $(MODULESO) install INSTALL_PREFIX=$(INSTALL_PREFIX)
+
+linux26:
+ @if [ -z "$(KSRC)" -o ! -d "$(KSRC)" ]; then echo "You do not appear to have the sources for the $(KVERS) kernel installed."; exit 1 ; fi
+ $(KMAKE)
+
+linux26-install:
+ @if [ -z "$(KSRC)" -o ! -d "$(KSRC)" ]; then echo "You do not appear to have the sources for the $(KVERS) kernel installed."; exit 1 ; fi
+ $(KMAKE_INST)
install-modules: install-$(BUILDVER)
install-linux24: $(MODULES_BUILD)
install -d $(MOD_DIR)
install -m 644 $(MODULES_BUILD) $(MOD_DIR)
-install-linux26: $(MODULESKO)
+install-linux26:
$(KMAKE_INST)
clean:
- rm -f torisatool tor2fw.h radfw.h
- rm -f ${BINS}
- rm -f *.o ztcfg tzdriver sethdlc sethdlc-new
+ rm -f $(BINS)
+ rm -f *.o ztcfg tzdriver sethdlc sethdlc-24
rm -f $(TZOBJS) $(LIBTONEZONE_SO) *.lo
-ifeq (${BUILDVER},linux26)
+ifeq ($(BUILDVER),linux26)
$(KMAKE) clean
- $(MAKE) -C datamods clean
-endif
- rm -f xpp/*.ko xpp/*.mod.c xpp/.*o.cmd
- rm -f xpp/*.o xpp/*.mod.o
+else
+ make -C kernel clean
+endif
rm -rf .tmp_versions
rm -f gendigits tones.h
rm -f libtonezone*
@@ -429,5 +487,5 @@
rm -f fxotune
rm -f core
rm -f ztcfg-shared fxstest
-
+ rm -f *-stamp
FORCE:
Propchange: team/group/kernelmove/kernel/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Sat May 27 07:58:38 2006
@@ -9,3 +9,4 @@
tones.h
.*.swp
gendigits
+version.h
Modified: team/group/kernelmove/kernel/Makefile
URL: http://svn.digium.com/view/zaptel/team/group/kernelmove/kernel/Makefile?rev=1093&r1=1092&r2=1093&view=diff
==============================================================================
--- team/group/kernelmove/kernel/Makefile (original)
+++ team/group/kernelmove/kernel/Makefile Sat May 27 07:58:38 2006
@@ -1,18 +1,45 @@
+EXTRA_CFLAGS =-I$(src)/.. -I$(obj) -DSTANDALONE_ZAPATA
-ifneq ($(KERNELRELEASE),)
-# support older 2.5/2.6 kernel builds that don't know about 'Kbuild' files
-include Kbuild
-else
-# Normal Makefile
+# TODO: Should the list ofmodules be set here or in the upper Makefile?
+# (to allow mnual override)
+obj-m := zaptel.o tor2.o torisa.o wcusb.o wcfxo.o wctdm.o wctdm24xxp.o \
+ ztdynamic.o ztd-eth.o wct1xxp.o wct4xxp.o wcte11xp.o \
+ pciradio.o ztd-loc.o ztdummy.o
-KERNELDIR?=/lib/modules/`uname -r`/build
+host-progs := gendigits
+# FIXME: can something more specific that the non-remmed-out line be used?
+#HOST_LOADLIBES_gendigits += -lm
+#gendigts: HOST_LOADLIBES += -lm
+HOST_LOADLIBES += -lm
-all: modules
+$(obj)/zaptel.o: $(obj)/tones.h $(src)/../version.h
-modules:
- $(MAKE) -C $(KERNELDIR) M=`pwd` modules
+$(obj)/tor2.o: $(obj)/tor2fw.h
-clean:
- $(MAKE) -C $(KERNELDIR) M=`pwd` clean
+$(obj)/tor2fw.h: $(src)/tormenta2.rbt
+ $(src)/makefw $^ tor2fw > $@
+$(obj)/pciradio.o: $(obj)/radfw.h
+
+$(obj)/radfw.h: $(src)/pciradio.rbt
+ $(src)/makefw $^ radfw > $@
+
+$(obj)/tones.h: $(obj)/gendigits
+ $(obj)/gendigits > $@
+
+$(src)/../version.h:
+ make -C $(src)/.. version.h
+
+clean-files = $(obj)/tor2fw.h $(obj)/radfw.h $(obj)/tones.h $(obj)/gendigits
+
+# Also build xpp in the subdirectory xpp/ . But only for >=2.6.10 and only
+# for i386. On other archs the module will probably build but panic.
+# This line is only meaningful when this Makefile is used as kconfig for
+# 2.6 build
+
+ifneq (,$(shell [ 0$(SUBLEVEL) -ge 10 ] && [ "$(ARCH)" = 'i386' ] && echo 1))
+obj-m += xpp/
endif
+
+# probably need to make this conditional
+obj-m += datamods/
Propchange: team/group/kernelmove/kernel/datamods/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Sat May 27 07:58:38 2006
@@ -3,3 +3,4 @@
.*.o.cmd
.*.ko.cmd
*.mod.c
+.*.swp
Modified: team/group/kernelmove/kernel/makefile
URL: http://svn.digium.com/view/zaptel/team/group/kernelmove/kernel/makefile?rev=1093&r1=1092&r2=1093&view=diff
==============================================================================
--- team/group/kernelmove/kernel/makefile (original)
+++ team/group/kernelmove/kernel/makefile Sat May 27 07:58:38 2006
@@ -1,5 +1,10 @@
# Kernel 2.4 makefile
+# Caller needs to set:
+# MODULESO
+# KSRC
+
+KINCLUDES := $(KSRC)/include
KFLAGS=-I$(KINCLUDES) -O6
KFLAGS+=-DMODULE -D__KERNEL__ -DEXPORT_SYMTAB -I$(KSRC)/drivers/net \
-Wall -I. -Wstrict-prototypes -fomit-frame-pointer -I$(KSRC)/drivers/net/wan -I$(KINCLUDES)/net
@@ -10,10 +15,8 @@
KFLAGS_PPC:=-msoft-float -fsigned-char
endif
KFLAGS+=$(KFLAGS_PPC)
-ifeq ($(KVERS_MAJ),2.4)
- ifneq (,$(findstring x86_64,$(UNAME_M)))
- KFLAGS+=-mcmodel=kernel
- endif
+ifneq (,$(findstring x86_64,$(UNAME_M)))
+ KFLAGS+=-mcmodel=kernel
endif
#
@@ -22,18 +25,12 @@
KFLAGS+=-DSTANDALONE_ZAPATA
-#MODULES:=zaptel tor2 torisa wcusb wcfxo wctdm wctdm24xxp \
-# ztdynamic ztd-eth wct1xxp wct4xxp wcte11xp pciradio \
-# ztd-loc # ztdummy
-#MODULES+=wcfxsusb
-#
-#MODULESO:=$(MODULES:%=%.o)
-
all: $(MODULESO)
tor2.o: tor2-hw.h tor2fw.h
-zaptel.o: digits.h arith.h sec.h mec.h sec-2.h mec2.h mec3.h zconfig.h
+# All of those files included in zaptel.h .
+zaptel.h: digits.h arith.h sec.h mec.h sec-2.h mec2.h mec3.h zconfig.h
digits.h: tones.h
@@ -54,14 +51,16 @@
$(MODULESO): %.o: %.c zaptel.h ../version.h
$(HOSTCC) $(KFLAGS) -o $@ -c $<
+gendigits: LDFLAGS+=-lm
+
tones.h: gendigits
./gendigits > tones.h
-tor2fw.h: tormenta.rbt
- ./makefw tormenta.rbt tor2fw > tor2fw.h
+tor2fw.h: tormenta2.rbt
+ ./makefw $< tor2fw > tor2fw.h
radfw.h: pciradio.rbt
- ./makefw pciradio.rbt radfw > radfw.h
+ ./makefw $< radfw > radfw.h
zaptel.c: tones.h ../version.h
@@ -78,4 +77,4 @@
rm -rf .tmp_versions
rm -f gendigits tones.h
-FORCE:
+.PHONY: all clean
More information about the zaptel-commits
mailing list