[svn-commits] tzafrir: branch tzafrir/kernelmove_14 r2651 - in
/team/tzafrir/kernelmove_14:...
svn-commits at lists.digium.com
svn-commits at lists.digium.com
Wed Jun 13 12:32:06 MST 2007
Author: tzafrir
Date: Wed Jun 13 14:32:06 2007
New Revision: 2651
URL: http://svn.digium.com/view/zaptel?view=rev&rev=2651
Log:
Consolidating all configuration logic into autoconf:
* Added selections of modules and utilities through autoconf --with
switches.
* Autoconf knows where the kernel resides, and hence can source the
.config.
* Hence we only build USB stuff if kernel supports it.
* So main Makefile is now much simpler (and there iss still some
trimming to do). For example:
* Removed all 'filter'/'filter-out' except one left-over.
* Some faint attempts to make kernel/wct4xxp/ build properly. It
basically builds, but the dependencies are still bad.
Modified:
team/tzafrir/kernelmove_14/Makefile
team/tzafrir/kernelmove_14/TODO
team/tzafrir/kernelmove_14/configure
team/tzafrir/kernelmove_14/configure.ac
team/tzafrir/kernelmove_14/kernel/wct4xxp/ (props changed)
team/tzafrir/kernelmove_14/kernel/wct4xxp/Makefile.kernel26
team/tzafrir/kernelmove_14/kernel/xpp/utils/Makefile
team/tzafrir/kernelmove_14/makeopts.in
Modified: team/tzafrir/kernelmove_14/Makefile
URL: http://svn.digium.com/view/zaptel/team/tzafrir/kernelmove_14/Makefile?view=diff&rev=2651&r1=2650&r2=2651
==============================================================================
--- team/tzafrir/kernelmove_14/Makefile (original)
+++ team/tzafrir/kernelmove_14/Makefile Wed Jun 13 14:32:06 2007
@@ -9,6 +9,8 @@
PWD:=$(shell pwd)
endif
+include makeopts
+
ARCH:=$(shell uname -m | sed -e s/i.86/i386/)
ifeq ($(DEB_HOST_GNU_TYPE),)
@@ -17,18 +19,6 @@
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)
KINCLUDES:=$(KSRC)/include
@@ -38,6 +28,7 @@
BUILDVER:=linux26
endif
+# FIXME: get this from autoconf (as it sources the .config)
# Set HOTPLUG_FIRMWARE=no to override automatic building with hotplug support
# if it is enabled in the kernel.
ifeq ($(BUILDVER),linux26)
@@ -55,39 +46,6 @@
CFLAGS+=-DHOTPLUG_FIRMWARE
endif
-# If the file .zaptel.makeopts is present in your home directory, you can
-# include all of your favorite menuselect options so that every time you download
-# a new version of Asterisk, you don't have to run menuselect to set them.
-# The file /etc/zaptel.makeopts will also be included but can be overridden
-# by the file in your home directory.
-
-GLOBAL_MAKEOPTS=$(wildcard /etc/zaptel.makeopts)
-USER_MAKEOPTS=$(wildcard ~/.zaptel.makeopts)
-
-ifeq ($(strip $(foreach var,clean distclean dist-clean update,$(findstring $(var),$(MAKECMDGOALS)))),)
- ifneq ($(wildcard menuselect.makeopts),)
- include menuselect.makeopts
- endif
-endif
-
-ifeq ($(strip $(foreach var,clean distclean dist-clean update,$(findstring $(var),$(MAKECMDGOALS)))),)
- ifneq ($(wildcard makeopts),)
- include makeopts
- endif
-endif
-
-MODULES := pciradio tor2 torisa wcfxo wct1xxp wctdm wctdm24xxp \
- wcte11xp wcusb zaptel ztd-eth ztd-loc ztdummy ztdynamic \
- zttranscode
-MODULES:=$(filter-out $(MENUSELECT_MODULES),$(MODULES))
-
-ZAP_SUBDIRS := xpp # wctc4xp wct4xxp
-ZAP_SUBDIRS := $(filter-out $(MENUSELECT_MODULES),$(ZAP_SUBDIRS))
-
-ifeq ($(findstring xpp,$(MENUSELECT_MODULES)),)
- BUILD_XPP:=yes
-endif
-
CFLAGS+=-g -Wall -DSTANDALONE_ZAPATA -DBUILDING_TONEZONE #-DTONEZONE_DRIVER
ifneq (,$(findstring ppc,$(UNAME_M)))
CFLAGS_PPC:=-fsigned-char
@@ -105,16 +63,18 @@
MODULE_ALIASES=wcfxs wctdm8xxp wct2xxp
KMAKE := $(MAKE) -C $(KSRC) SUBDIRS=$(PWD)/kernel \
- MODULES="$(MODULES)" ZAP_SUBDIRS="$(ZAP_SUBDIRS)"
+ MODULES="$(MOD_NAMES)" ZAP_SUBDIRS="$(MOD_DIRS)"
KMAKE_INST = $(KMAKE) \
INSTALL_MOD_PATH=$(INSTALL_PREFIX) INSTALL_MOD_DIR=misc modules_install
+# FIXME: use $prefix from autoconf
ROOT_PREFIX=
INSTALL_PREFIX=$(DESTDIR)
CONFIG_FILE=$(INSTALL_PREFIX)/etc/zaptel.conf
CFLAGS+=-DZAPTEL_CONFIG=\"$(CONFIG_FILE)\"
+# FIXME: check in autoconf
CHKCONFIG:=$(shell sh -c 'type -p chkconfig' 2> /dev/null)
ifndef CHKCONFIG
CHKCONFIG:=:
@@ -136,6 +96,7 @@
LTZ_SO_MINOR_VER:= 0
LTZ_SO := $(LTZ_SO_BASE).$(LTZ_SO_MAJOR_VER).$(LTZ_SO_MINOR_VER)
+# FIXME: get pathes from autoconf. See e.g. kernel/xpp/utils/Makefile .
BIN_DIR:=$(INSTALL_PREFIX)/sbin
LIB_DIR:=$(INSTALL_PREFIX)/usr/lib
INC_DIR:=$(INSTALL_PREFIX)/usr/include
@@ -143,24 +104,18 @@
LDCONFIG = /sbin/ldconfig
SBINDIR = $(INSTALL_PREFIX)/sbin
-BINS_INSTALL = $(BINS)
MANDIR = $(INSTALL_PREFIX)/share/man
INCLUDE_DIR = $(INSTALL_PREFIX)/usr/include/zaptel
-BINS:=fxotune fxstest sethdlc-new ztcfg ztdiag ztmonitor ztspeed zttest zttool
-UTILS:=$(filter-out zttool ztcfg,$(BINS))
-UTILSO:=$(UTILS:%=%.o)
-BINS:=$(filter-out $(MENUSELECT_UTILS),$(BINS))
-UTILS_ALL := $(UTILS)
-
-all: menuselect.makeopts modules programs
-
-programs: $(BINS) $(LTZ_SO) $(LTZ_A) xpp-utils
-
-xpp-utils:
-ifeq (yes,$(BUILD_XPP))
- @$(MAKE) -C kernel/xpp/utils
-endif
+UTILSO := $(UTIL_NAMES:%=%.o)
+
+all: modules programs
+
+# FIXME: will re-run the recursive make on utils-subdirs
+programs: $(UTIL_NAMES) $(LTZ_SO) $(LTZ_A) $(UTIL_DIRS)
+
+$(UTIL_DIRS): %:
+ @$(MAKE) -C $@
modules: $(BUILDVER)
@@ -190,10 +145,7 @@
tonezone.lo: tonezone.c
$(CC) -c $(LCFLAGS) -o $@ $^
-torisatool: torisatool.o
- $(CC) -o $@ $^
-
-prereq: config.status kernel/version.h
+prereq: kernel/version.h
zttool.o: CFLAGS+=$(NEWT_INCLUDE)
zttool.o: $(ZPATEL_H)
@@ -217,16 +169,13 @@
ztcfg.c: ztcfg.h
ztcfg-shared: ztcfg.o $(LTZ_SO)
- $(CC) -o $@ $^ -lm
-
-data:
- $(KMAKE) ZAP_SUBDIRS=datamods MODULES=datamods
+ztcfg-shared: LDLIBS += -lm
ztcfg: ztcfg.o $(LTZ_A)
- $(CC) -o $@ $^ -lm
+ztcfg: LDLIBS += -lm
ztcfg-dude: ztcfg-dude.o mknotch.o complex.o $(LTZ_SO)
- $(CC) -o $@ $^ -lm -lstdc++
+ztcfg-dude: LDLIBS += -lm -lstdc++
mknotch.o complex.o: %.o: %.cc
$(CC) -o $@ -c $^
@@ -243,6 +192,15 @@
stackcheck: checkstack modules
./checkstack *.o
+data:
+ $(KMAKE) ZAP_SUBDIRS=datamods MODULES=datamods
+
+#############################
+# mISDN stuff:
+# mISDN is unrelated to Zaptel. The b410p target is included here
+# because it is yet another out-of-tree kernel build and hence shares
+# many prerequirements (and also for people used to look for drivers of
+# Digium's cards).
MISDNVERSION=1_1_3
MISDNUSERVERSION=1_1_3
b410p:
@@ -265,20 +223,24 @@
tar -zxf mISDNuser-$(MISDNUSERVERSION).tar.gz
$(MAKE) -C mISDNuser-$(MISDNUSERVERSION) install
-$(UTILS): %: %.o
- $(CC) $(CFLAGS) -o $@ $< $(LDFLAGS) $(LDLIBS)
+# b410p/mISDN stuff ends here.
+#############################
+
+
+$(UTIL_NAMES): %: %.o
+ $(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS) $(LDLIBS)
$(UTILSO): %.o: %.c
$(CC) $(CFLAGS) -o $@ -c $<
install: all install-programs install-modules devices
-install-programs: $(BINS_INSTALL) $(LTZ_A) $(LTZ_SO) firmware
+install-programs: $(UTIL_NAMES) $(LTZ_A) $(LTZ_SO) firmware
ifeq ($(HOTPLUG_FIRMWARE),yes)
$(MAKE) -C firmware hotplug-install
endif
install -d $(SBINDIR)
- install $(BINS_INSTALL) $(SBINDIR)/
+ install $(UTIL_NAMES) $(SBINDIR)/
install -d $(INCLUDE_DIR)
$(INSTALL) -m 644 kernel/zaptel.h tonezone.h $(INCLUDE_DIR)/
install -d $(MANDIR)/man8
@@ -291,9 +253,6 @@
if [ -z "$(INSTALL_PREFIX)" ] && $(CHECK_SELINUX) ; then \
/sbin/restorecon -v $(LIB_DIR)/$(LTZ_SO_BASE); \
fi
-ifeq ($(BUILDVER),linux26)
- $(KMAKE_INST)
-else
install: all devices install-modules install-libs install-include install-xpp
ifeq ($(HOTPLUG_FIRMWARE),yes)
@@ -332,10 +291,10 @@
$(LIB_DIR)/$(LTZ_SO)
if [ -z "$(INSTALL_PREFIX)" ] && [ -x /usr/sbin/sestatus ] && (/usr/sbin/sestatus | grep "SELinux status:" | grep -q "enabled") ; then /sbin/restorecon -v $(LIB_DIR)/$(LTZ_SO); fi
-install-xpp:
-ifeq (yes,$(BUILD_XPP))
- @$(MAKE) -C xpp/utils install
-endif
+#install-xpp:
+#ifeq (yes,$(BUILD_XPP))
+# @$(MAKE) -C kernel/xpp/utils install
+#endif
install-include:
$(INSTALL) -D -m 644 zaptel.h $(INSTALL_PREFIX)/usr/include/zaptel/zaptel.h
@@ -380,11 +339,6 @@
install-udev: devices
-# make should *fail* and not silently succeed if a program did not build
-install-programs: $(BINS)
- $(INSTALL) -d $(BIN_DIR)
- $(INSTALL) $(BINS) $(BIN_DIR)
-
uninstall-hotplug:
$(MAKE) -C firmware hotplug-uninstall
@@ -444,7 +398,7 @@
clean:
-@$(MAKE) -C menuselect clean
rm -f torisatool makefw tor2fw.h radfw.h
- rm -f $(BINS)
+ rm -f $(UTIL_NAMES_ALL)
rm -f *.o ztcfg tzdriver sethdlc sethdlc-new
rm -f $(LTZ_SO) $(LTZ_A) *.lo
ifeq ($(BUILDVER),linux26)
@@ -453,14 +407,11 @@
$(MAKE) -C kernel clean
endif
$(MAKE) -C firmware clean
- $(MAKE) -C kernel/xpp/utils clean
+ for dir in $(UTIL_DIRS); do $(MAKE) -C $$subdir clean; done
rm -rf .tmp_versions
rm -f gendigits tones.h
rm -f libtonezone*
- rm -f tor2ee
- rm -f fxotune
rm -f core
- rm -f ztcfg-shared fxstest
rm -rf misdn*
rm -rf mISDNuser*
@@ -497,6 +448,4 @@
.EXPORT_ALL_VARIABLES:
-.PHONY: menuselect distclean dist-clean clean all install devices programs modules tests devel data stackcheck install-udev config update install-programs install-modules install-include install-libs install-xpp xpp-utils uninstall-modules
-
-endif
+.PHONY: menuselect distclean dist-clean clean all install devices programs modules tests devel data stackcheck install-udev config update install-programs install-modules install-include install-libs uninstall-modules
Modified: team/tzafrir/kernelmove_14/TODO
URL: http://svn.digium.com/view/zaptel/team/tzafrir/kernelmove_14/TODO?view=diff&rev=2651&r1=2650&r2=2651
==============================================================================
--- team/tzafrir/kernelmove_14/TODO (original)
+++ team/tzafrir/kernelmove_14/TODO Wed Jun 13 14:32:06 2007
@@ -1,10 +1,13 @@
Working:
* Basic 2.6 build.
* userspace build.
+* autoconf/makefile fix. menuselect out.
-* Test menuselect integration.
+* building of utilities subdirectories (currently: xpp-utils) is broken.
+ Workaround: exclpicit make -C kernel/xpp/utils [install]
* trim kernel/Makefile
* build wct4xxp/ and wctc4xxp/ (the octasic API mess)
+ Workaround: ./configure --with-modules=all,-wct4xxp/,-wctc4xxp/
* kernel 2.4 build
* 'make clean' may trigger a configure of menuselect
* install
Modified: team/tzafrir/kernelmove_14/configure
URL: http://svn.digium.com/view/zaptel/team/tzafrir/kernelmove_14/configure?view=diff&rev=2651&r1=2650&r2=2651
==============================================================================
--- team/tzafrir/kernelmove_14/configure (original)
+++ team/tzafrir/kernelmove_14/configure Wed Jun 13 14:32:06 2007
@@ -1,5 +1,5 @@
#! /bin/sh
-# From configure.ac Revision: 2216 .
+# From configure.ac Revision: 2610 .
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.61.
#
@@ -686,6 +686,14 @@
USB_LIB
USB_INCLUDE
PBX_LIBUSB
+KVERS
+KSRC
+MOD_NAMES
+MOD_DIRS
+UTIL_NAMES
+UTIL_DIRS
+UTIL_NAMES_ALL
+UTIL_DIRS_ALL
LIBOBJS
LTLIBOBJS'
ac_subst_files=''
@@ -1270,6 +1278,11 @@
--with-ncurses=PATH use ncurses files in PATH
--with-newt=PATH use newt files in PATH
--with-usb=PATH use libusb files in PATH
+ --with-modules kernel modules to build. all, none, or
+ comma-separated list.
+ --with-ksrc kernel source path
+ --with-utils utilities to build. all, none, or comma-separated
+ list.
Some influential environment variables:
CC C compiler command
@@ -5320,6 +5333,164 @@
exit 1
fi
fi
+
+
+
+
+
+# FIXME: generate list automatically:
+ALL_MODULES="pciradio tor2 torisa wcfxo wct1xxp wctdm wctdm24xxp \
+wcte11xp wcte12xp wcusb zaptel ztd-eth ztd-loc ztdummy ztdynamic \
+zttranscode wct4xxp/ wctc4xxp/ xpp/"
+
+
+# Check whether --with-modules was given.
+if test "${with_modules+set}" = set; then
+ withval=$with_modules; use_modules="$withval"
+else
+ use_modules="all"
+
+fi
+
+
+for val in `echo $use_modules | tr , ' ' `; do
+ case "$val" in
+ none) MODS='';;
+ all) MODS="$ALL_MODULES";;
+ -*) # -module: remove util:
+ remval=`echo $val | sed -e 's|^-||'`;
+ MODS=`echo $MODS | sed -e "s|$remval||"`
+ ;;
+ *) MODS="$MODS $val";;
+ esac
+done
+
+# verify all target modules are in ALL_MODULES:
+MODS_NEW=''
+echo $ALL_MODULES | tr ' ' '\n' >config.all_mods
+for mod in $MODS; do
+ if grep -qF "$mod" config.all_mods; then
+ MODS_NEW="$MODS_NEW $mod"
+ fi
+done
+MODS="$MODS_NEW"
+rm config.all_mods
+
+# Fix dependencies: We'll get rid of duplicates later.
+# ztd-eth and ztd-loc need ztdynamic:
+if echo $MODS | egrep -q 'ztd-(eth|loc)'; then
+ MODS="$MODS ztdynamic"
+fi
+
+# If there is any module: it needs zaptel
+if test "x$MODS" != 'x' && test "x$MODS" != 'x '; then
+ MODS="$MODS zaptel"
+fi
+
+
+# Remove duplicates:
+MODS=`echo $MODS | tr ' ' '\n' | sort -u | xargs`
+
+
+# Check whether --with-ksrc was given.
+if test "${with_ksrc+set}" = set; then
+ withval=$with_ksrc; KSRC="$withval"
+
+fi
+
+
+if test "x$KSRC" = 'xnone' && test "x$MODS" != 'x'; then
+ # kernel modules but without source? huh?
+ { { echo "$as_me:$LINENO: error: cannot build kernel modules --without kernel source" >&5
+echo "$as_me: error: cannot build kernel modules --without kernel source" >&2;}
+ { (exit 1); exit 1; }; }
+fi
+
+if test "x$KSRC" = 'x'; then
+ # no source defined. Need to detect.
+ KVERS=${KVERS:-`uname -r`}
+ KSRC=/lib/modules/$KVERS/build
+fi
+
+if test "x$KSRC" != 'xnone'; then
+ if test ! -r $KSRC/.config; then
+ { { echo "$as_me:$LINENO: error: kernel source dir $KSRC has no .config file" >&5
+echo "$as_me: error: kernel source dir $KSRC has no .config file" >&2;}
+ { (exit 1); exit 1; }; }
+ fi
+ . $KSRC/.config
+
+ # TODO: add here a sanity checks for the kernel source directory
+ # TODO: add here a test to build a dummy kernel module
+
+ # CONFIG_USB comes from the kernel .config .
+ case "$CONFIG_USB" in
+ y|m):;;
+ *)MODS=`echo MODS | sed -e 's/wcusb\|xpp\//g'` ;;
+ esac
+fi
+
+
+
+
+# A first approximation for the complete list of utilities
+# Used, e.g. for the clean target.
+XPP_UTILS_DIR=kernel/xpp/utils
+UTILS=`grep -l main *.c | sed -e 's/\.c$//' | xargs`
+UTILS="$UTILS $XPP_UTILS_DIR/"
+
+
+# Check whether --with-utils was given.
+if test "${with_utils+set}" = set; then
+ withval=$with_utils; use_utils="$withval"
+else
+ use_utils="all"
+
+fi
+
+
+for val in `echo $use_utils | tr , ' ' `; do
+ case "$val" in
+ none) BINS='';;
+ all) BINS="fxotune fxstest sethdlc-new ztcfg ztdiag ztmonitor zttest zttool $XPP_UTILS_DIR/";;
+ -*) # -util: remove util:
+ remval=`echo $val | sed -e 's|^-||'`;
+ BINS=`echo $BINS | sed -e "s|$remval||"`
+ ;;
+ xpp) BINS="$BINS $XPP_UTILS_DIR/";;
+ *) BINS="$BINS $val";;
+ esac
+done
+
+# verify all target utilities are in UTILS:
+BINS_NEW=''
+echo $UTILS | tr ' ' '\n' >config.all_utils
+for util in $BINS; do
+ if grep -qF "$util" config.all_utils; then
+ BINS_NEW="$BINS_NEW $util"
+ fi
+done
+rm config.all_utils
+
+# Remove duplicates:
+BINS=`echo $BINS_NEW | tr ' ' '\n' | sort -u | xargs`
+
+# zttool depends on the curses lib:
+if test "$PBX_LIBCURSES" = 0; then
+ BINS=`echo $BINS | sed -e 's/zttool//'`
+fi
+
+MOD_NAMES=`echo $MODS| tr ' ' '\n' | grep -v / | xargs`
+MOD_DIRS=` echo $MODS| tr ' ' '\n' | grep / | xargs`
+
+UTIL_NAMES=`echo $BINS| tr ' ' '\n' | grep -v / | xargs`
+UTIL_DIRS=` echo $BINS| tr ' ' '\n' | grep / | xargs`
+
+UTIL_NAMES_ALL=`echo $UTILS| tr ' ' '\n' | grep -v / | xargs`
+UTIL_DIRS_ALL=` echo $UTILS| tr ' ' '\n' | grep / | xargs`
+
+
+
@@ -6026,11 +6197,19 @@
USB_LIB!$USB_LIB$ac_delim
USB_INCLUDE!$USB_INCLUDE$ac_delim
PBX_LIBUSB!$PBX_LIBUSB$ac_delim
+KVERS!$KVERS$ac_delim
+KSRC!$KSRC$ac_delim
+MOD_NAMES!$MOD_NAMES$ac_delim
+MOD_DIRS!$MOD_DIRS$ac_delim
+UTIL_NAMES!$UTIL_NAMES$ac_delim
+UTIL_DIRS!$UTIL_DIRS$ac_delim
+UTIL_NAMES_ALL!$UTIL_NAMES_ALL$ac_delim
+UTIL_DIRS_ALL!$UTIL_DIRS_ALL$ac_delim
LIBOBJS!$LIBOBJS$ac_delim
LTLIBOBJS!$LTLIBOBJS$ac_delim
_ACEOF
- if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 71; then
+ if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 79; then
break
elif $ac_last_try; then
{ { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
@@ -6363,6 +6542,16 @@
fi
+{ echo "$as_me:$LINENO: Will build the following:" >&5
+echo "$as_me: Will build the following:" >&6;}
+{ echo "$as_me:$LINENO: Utilities: $BINS ." >&5
+echo "$as_me: Utilities: $BINS ." >&6;}
+if test "x$KSRC" != 'xnone'; then
+ { echo "$as_me:$LINENO: Kernel Modules and subdirectories: $MODS ." >&5
+echo "$as_me: Kernel Modules and subdirectories: $MODS ." >&6;}
+ { echo "$as_me:$LINENO: Kernel $KVERS from $KSRC ." >&5
+echo "$as_me: Kernel $KVERS from $KSRC ." >&6;}
+fi
{ echo "$as_me:$LINENO: *** Zaptel build successfully configured ***" >&5
echo "$as_me: *** Zaptel build successfully configured ***" >&6;}
Modified: team/tzafrir/kernelmove_14/configure.ac
URL: http://svn.digium.com/view/zaptel/team/tzafrir/kernelmove_14/configure.ac?view=diff&rev=2651&r1=2650&r2=2651
==============================================================================
--- team/tzafrir/kernelmove_14/configure.ac (original)
+++ team/tzafrir/kernelmove_14/configure.ac Wed Jun 13 14:32:06 2007
@@ -60,8 +60,159 @@
AST_EXT_LIB([newt], [newtBell], [newt.h], [NEWT], [newt])
AST_EXT_LIB([usb], [usb_init], [usb.h], [USB], [libusb])
+# FIXME: generate list automatically:
+ALL_MODULES="pciradio tor2 torisa wcfxo wct1xxp wctdm wctdm24xxp \
+wcte11xp wcte12xp wcusb zaptel ztd-eth ztd-loc ztdummy ztdynamic \
+zttranscode wct4xxp/ wctc4xxp/ xpp/"
+
+AC_ARG_WITH(modules,
+ [AS_HELP_STRING([--with-modules],
+ [kernel modules to build. all, none, or comma-separated list.])],
+ [use_modules="$withval"],
+ [use_modules="all"]
+)
+
+for val in `echo $use_modules | tr , ' ' `; do
+ case "$val" in
+ none) MODS='';;
+ all) MODS="$ALL_MODULES";;
+ -*) # -module: remove util:
+ remval=`echo $val | sed -e 's|^-||'`;
+ MODS=`echo $MODS | sed -e "s|$remval||"`
+ ;;
+ *) MODS="$MODS $val";;
+ esac
+done
+
+# verify all target modules are in ALL_MODULES:
+MODS_NEW=''
+echo $ALL_MODULES | tr ' ' '\n' >config.all_mods
+for mod in $MODS; do
+ if grep -qF "$mod" config.all_mods; then
+ MODS_NEW="$MODS_NEW $mod"
+ fi
+done
+MODS="$MODS_NEW"
+rm config.all_mods
+
+# Fix dependencies: We'll get rid of duplicates later.
+# ztd-eth and ztd-loc need ztdynamic:
+if echo $MODS | egrep -q 'ztd-(eth|loc)'; then
+ MODS="$MODS ztdynamic"
+fi
+
+# If there is any module: it needs zaptel
+if test "x$MODS" != 'x' && test "x$MODS" != 'x '; then
+ MODS="$MODS zaptel"
+fi
+
+
+# Remove duplicates:
+MODS=`echo $MODS | tr ' ' '\n' | sort -u | xargs`
+
+AC_ARG_WITH(ksrc,
+ [AS_HELP_STRING([--with-ksrc],[kernel source path])],
+ [KSRC="$withval"]
+)
+
+if test "x$KSRC" = 'xnone' && test "x$MODS" != 'x'; then
+ # kernel modules but without source? huh?
+ AC_MSG_ERROR(cannot build kernel modules --without kernel source)
+fi
+
+if test "x$KSRC" = 'x'; then
+ # no source defined. Need to detect.
+ KVERS=${KVERS:-`uname -r`}
+ KSRC=/lib/modules/$KVERS/build
+fi
+
+if test "x$KSRC" != 'xnone'; then
+ if test ! -r $KSRC/.config; then
+ AC_MSG_ERROR([kernel source dir $KSRC has no .config file])
+ fi
+ . $KSRC/.config
+
+ # TODO: add here a sanity checks for the kernel source directory
+ # TODO: add here a test to build a dummy kernel module
+
+ # CONFIG_USB comes from the kernel .config .
+ case "$CONFIG_USB" in
+ y|m):;;
+ *)MODS=`echo MODS | sed -e 's/wcusb\|xpp\//g'` ;;
+ esac
+fi
+
+AC_SUBST(KVERS)
+AC_SUBST(KSRC)
+
+# A first approximation for the complete list of utilities
+# Used, e.g. for the clean target.
+XPP_UTILS_DIR=kernel/xpp/utils
+UTILS=`grep -l main *.c | sed -e 's/\.c$//' | xargs`
+UTILS="$UTILS $XPP_UTILS_DIR/"
+
+AC_ARG_WITH(utils,
+ [AS_HELP_STRING([--with-utils],
+ [utilities to build. all, none, or comma-separated list.])],
+ [use_utils="$withval"],
+ [use_utils="all"]
+)
+
+for val in `echo $use_utils | tr , ' ' `; do
+ case "$val" in
+ none) BINS='';;
+ all) BINS="fxotune fxstest sethdlc-new ztcfg ztdiag ztmonitor zttest zttool $XPP_UTILS_DIR/";;
+ -*) # -util: remove util:
+ remval=`echo $val | sed -e 's|^-||'`;
+ BINS=`echo $BINS | sed -e "s|$remval||"`
+ ;;
+ xpp) BINS="$BINS $XPP_UTILS_DIR/";;
+ *) BINS="$BINS $val";;
+ esac
+done
+
+# verify all target utilities are in UTILS:
+BINS_NEW=''
+echo $UTILS | tr ' ' '\n' >config.all_utils
+for util in $BINS; do
+ if grep -qF "$util" config.all_utils; then
+ BINS_NEW="$BINS_NEW $util"
+ fi
+done
+rm config.all_utils
+
+# Remove duplicates:
+BINS=`echo $BINS_NEW | tr ' ' '\n' | sort -u | xargs`
+
+# zttool depends on the curses lib:
+if test "$PBX_LIBCURSES" = 0; then
+ BINS=`echo $BINS | sed -e 's/zttool//'`
+fi
+
+MOD_NAMES=`echo $MODS| tr ' ' '\n' | grep -v / | xargs`
+MOD_DIRS=` echo $MODS| tr ' ' '\n' | grep / | xargs`
+
+UTIL_NAMES=`echo $BINS| tr ' ' '\n' | grep -v / | xargs`
+UTIL_DIRS=` echo $BINS| tr ' ' '\n' | grep / | xargs`
+
+UTIL_NAMES_ALL=`echo $UTILS| tr ' ' '\n' | grep -v / | xargs`
+UTIL_DIRS_ALL=` echo $UTILS| tr ' ' '\n' | grep / | xargs`
+
+AC_SUBST(MOD_NAMES)
+AC_SUBST(MOD_DIRS)
+AC_SUBST(UTIL_NAMES)
+AC_SUBST(UTIL_DIRS)
+AC_SUBST(UTIL_NAMES_ALL)
+AC_SUBST(UTIL_DIRS_ALL)
+
AC_CONFIG_FILES([build_tools/menuselect-deps makeopts])
AC_OUTPUT
+AC_MSG_NOTICE(Will build the following:)
+AC_MSG_NOTICE(Utilities: $BINS .)
+if test "x$KSRC" != 'xnone'; then
+ AC_MSG_NOTICE(Kernel Modules and subdirectories: $MODS .)
+ AC_MSG_NOTICE(Kernel $KVERS from $KSRC .)
+fi
AC_MSG_NOTICE(*** Zaptel build successfully configured ***)
Propchange: team/tzafrir/kernelmove_14/kernel/wct4xxp/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Wed Jun 13 14:32:06 2007
@@ -1,3 +1,4 @@
*.mod.c
*.cmd
*.ko
+.*.d
Modified: team/tzafrir/kernelmove_14/kernel/wct4xxp/Makefile.kernel26
URL: http://svn.digium.com/view/zaptel/team/tzafrir/kernelmove_14/kernel/wct4xxp/Makefile.kernel26?view=diff&rev=2651&r1=2650&r2=2651
==============================================================================
--- team/tzafrir/kernelmove_14/kernel/wct4xxp/Makefile.kernel26 (original)
+++ team/tzafrir/kernelmove_14/kernel/wct4xxp/Makefile.kernel26 Wed Jun 13 14:32:06 2007
@@ -1,7 +1,10 @@
obj-m += wct4xxp.o
-OCT_CFLAGS := $(shell $(src)/../../oct612x/octasic-helper cflags $(src)/../../oct612x)
-OCT_OBJS := $(shell $(src)/../../oct612x/octasic-helper objects $(obj)/../../oct612x)
+OCT_PATH := /../../oct612x
+OCT_SRC := $(src)/../../oct612x
+
+OCT_CFLAGS := $(shell $(OCT_SRC)/octasic-helper cflags $(src)/../../oct612x)
+OCT_OBJS := $(shell $(OCT_SRC)/octasic-helper objects $(obj)/../../oct612x)
EXTRA_CFLAGS := -I$(src)/.. $(OCT_CFLAGS) -Wno-undef -DSTANDALONE_ZAPATA
Modified: team/tzafrir/kernelmove_14/kernel/xpp/utils/Makefile
URL: http://svn.digium.com/view/zaptel/team/tzafrir/kernelmove_14/kernel/xpp/utils/Makefile?view=diff&rev=2651&r1=2650&r2=2651
==============================================================================
--- team/tzafrir/kernelmove_14/kernel/xpp/utils/Makefile (original)
+++ team/tzafrir/kernelmove_14/kernel/xpp/utils/Makefile Wed Jun 13 14:32:06 2007
@@ -4,7 +4,7 @@
INSTALL = install
INSTALL_DATA = install -m 644
-ZAPTEL_DIR ?= ../..
+ZAPTEL_DIR ?= ../../..
-include $(ZAPTEL_DIR)/makeopts
Modified: team/tzafrir/kernelmove_14/makeopts.in
URL: http://svn.digium.com/view/zaptel/team/tzafrir/kernelmove_14/makeopts.in?view=diff&rev=2651&r1=2650&r2=2651
==============================================================================
--- team/tzafrir/kernelmove_14/makeopts.in (original)
+++ team/tzafrir/kernelmove_14/makeopts.in Wed Jun 13 14:32:06 2007
@@ -37,3 +37,14 @@
USB_LIB=@NCURSES_LIB@
USB_INCLUDE=@USB_INCLUDE@
+MOD_NAMES=@MOD_NAMES@
+MOD_DIRS=@MOD_DIRS@
+UTIL_NAMES=@UTIL_NAMES@
+UTIL_DIRS=@UTIL_DIRS@
+UTILS_NAMES_ALL=@UTIL_NAMES_ALL@
+UTIL_DIRS_ALL=@UTIL_DIRS_ALL@
+
+KSRC=@KSRC@
+KVERS=@KVERS@
+
+FIRMWARES=
More information about the svn-commits
mailing list