summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile140
1 files changed, 93 insertions, 47 deletions
diff --git a/Makefile b/Makefile
index b5ed3af..8164ddd 100644
--- a/Makefile
+++ b/Makefile
@@ -7,7 +7,10 @@
.EXPORT_ALL_VARIABLES:
+.PHONY: menuselect distclean dist-clean clean
+
HOSTCC=gcc
+CC=gcc
ifeq ($(PWD),)
PWD=$(shell pwd)
endif
@@ -56,6 +59,23 @@ ifeq ($(KVERS_MAJ),2.4)
endif
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)
+
+ifneq ($(wildcard menuselect.makeopts),)
+ include menuselect.makeopts
+endif
+
+ifneq ($(wildcard makeopts),)
+ include makeopts
+endif
+
#
# Features are now configured in zconfig.h
#
@@ -107,14 +127,11 @@ LIBTONEZONE_SO:=libtonezone.so
LIBTONEZONE_SO_MAJOR_VER:=1
LIBTONEZONE_SO_MINOR_VER:=0
-MODULES:=zaptel tor2 torisa wcusb wcfxo wctdm wctdm24xxp \
- ztdynamic ztd-eth wct1xxp wct4xxp wcte11xp pciradio \
- ztd-loc zttranscode
-#MODULES+=wcfxsusb
-# build ztdummy by default for 2.6 kernels
-ifeq ($(BUILDVER),linux26)
-MODULES+=ztdummy
+ifneq ($(findstring xpp,$(MENUSELECT_MODULES)),)
+ BUILD_XPP=yes
+ MENUSELECT_MODULES:=$(filter-out xpp,$(MENUSELECT_MODULES))
endif
+MODULES:=$(MENUSELECT_MODULES)
MODULESO:=$(MODULES:%=%.o)
MODULESKO:=$(MODULES:%=%.ko)
@@ -140,19 +157,18 @@ wct4xxp-objs:=wct4xxp_base.o vpm450m.o
# 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))
+ifneq (,$(shell [ 0$(SUBLEVEL) -ge 10 ] && [ "$(ARCH)" = 'i386' ] && [ "x$(BUILD_XPP)" = "xyes" ] && echo 1))
obj-m+=xpp/
endif
-ifneq (,$(wildcard /usr/include/newt.h))
-ZTTOOL:=zttool
-endif
-BINS:=ztcfg ztmonitor ztspeed $(ZTTOOL) zttest fxotune
-UTILS:=tor2ee ztspeed zttool ztmonitor sethdlc-new \
- usbfxstest fxstest fxotune fxsdump ztdiag
+BINS:=$(MENUSELECT_UTILS)
+UTILS:=$(filter-out zttool fxstest ztcfg,$(MENUSELECT_UTILS))
UTILSO:=$(UTILS:%=%.o)
-all: modules $(LIBTONEZONE_SO)
+all: menuselect.makeopts
+ @$(MAKE) _all
+
+_all: modules $(LIBTONEZONE_SO)
programs: $(BINS)
@@ -242,9 +258,10 @@ vpm450m_fw.h: OCT6114-128D.ima fw2h
zaptel.c: tones.h
-prereq: tones.h tor2fw.h radfw.h version.h
+prereq: config.status tones.h tor2fw.h radfw.h version.h
zttool.o: zttool.c zaptel.h
+ $(CC) -g -c $(NEWT_INCLUDE) $(CFLAGS) -o $@ $<
ztprovision.o: ztprovision.c zaptel.h
@@ -252,7 +269,7 @@ ztmonitor.o: ztmonitor.c zaptel.h
ztspeed: CFLAGS=
ztspeed.o: CFLAGS=
-zttool: LDFLAGS+=-lnewt
+zttool: LDFLAGS+=$(NEWT_LIB)
sethdlc-new.o: CFLAGS+=-I$(KINCLUDES)
libtonezone.a: $(TZOBJS)
@@ -336,13 +353,13 @@ else # DYNFS
endif
install: all devices
- install -D -m 755 ztcfg $(INSTALL_PREFIX)/sbin/ztcfg
+ $(INSTALL) -D -m 755 ztcfg $(INSTALL_PREFIX)/sbin/ztcfg
if [ -f sethdlc-new ]; then \
- install -D -m 755 sethdlc-new $(INSTALL_PREFIX)/sbin/sethdlc; \
+ $(INSTALL) -D -m 755 sethdlc-new $(INSTALL_PREFIX)/sbin/sethdlc; \
elif [ -f sethdlc ]; then \
- install -D -m 755 sethdlc $(INSTALL_PREFIX)/sbin/sethdlc ; \
+ $(INSTALL) -D -m 755 sethdlc $(INSTALL_PREFIX)/sbin/sethdlc ; \
fi
- if [ -f zttool ]; then install -D -m 755 zttool $(INSTALL_PREFIX)/sbin/zttool; fi
+ if [ -f zttool ]; then $(INSTALL) -D -m 755 zttool $(INSTALL_PREFIX)/sbin/zttool; fi
ifeq ($(BUILDVER),linux26)
for x in $(MODULESKO); do \
rm -f $(INSTALL_PREFIX)/lib/modules/$(KVERS)/extra/$$x ; \
@@ -355,30 +372,30 @@ ifeq ($(BUILDVER),linux26)
fi
else
for x in $(MODULESO); do \
- install -D -m 644 $$x $(INSTALL_PREFIX)/lib/modules/$(KVERS)/misc/$$x ; \
+ $(INSTALL) -D -m 644 $$x $(INSTALL_PREFIX)/lib/modules/$(KVERS)/misc/$$x ; \
done
endif
if ! [ -f wcfxsusb.o ]; then \
rm -f $(INSTALL_PREFIX)/lib/modules/$(KVERS)/misc/wcfxsusb.o; \
fi; \
rm -f $(INSTALL_PREFIX)/lib/modules/$(KVERS)/misc/wcfxs.o
- install -D -m 755 $(LIBTONEZONE_SO) $(INSTALL_PREFIX)/usr/lib/$(LIBTONEZONE_SO).$(LIBTONEZONE_SO_MAJOR_VER).$(LIBTONEZONE_SO_MINOR_VER)
+ $(INSTALL) -D -m 755 $(LIBTONEZONE_SO) $(INSTALL_PREFIX)/usr/lib/$(LIBTONEZONE_SO).$(LIBTONEZONE_SO_MAJOR_VER).$(LIBTONEZONE_SO_MINOR_VER)
[ `id -u` = 0 ] && /sbin/ldconfig || :
rm -f $(INSTALL_PREFIX)/usr/lib/$(LIBTONEZONE_SO)
- ln -sf $(LIBTONEZONE_SO).$(LIBTONEZONE_SO_MAJOR_VER).$(LIBTONEZONE_SO_MINOR_VER) \
+ $(LN) -sf $(LIBTONEZONE_SO).$(LIBTONEZONE_SO_MAJOR_VER).$(LIBTONEZONE_SO_MINOR_VER) \
$(INSTALL_PREFIX)/usr/lib/$(LIBTONEZONE_SO).$(LIBTONEZONE_SO_MAJOR_VER)
- ln -sf $(LIBTONEZONE_SO).$(LIBTONEZONE_SO_MAJOR_VER).$(LIBTONEZONE_SO_MINOR_VER) \
+ $(LN) -sf $(LIBTONEZONE_SO).$(LIBTONEZONE_SO_MAJOR_VER).$(LIBTONEZONE_SO_MINOR_VER) \
$(INSTALL_PREFIX)/usr/lib/$(LIBTONEZONE_SO)
if [ -x /usr/sbin/sestatus ] && (/usr/sbin/sestatus | grep "SELinux status:" | grep -q "enabled") ; then restorecon -v $(INSTALL_PREFIX)/usr/lib/$(LIBTONEZONE_SO); fi
- install -D -m 644 zaptel.h $(INSTALL_PREFIX)/usr/include/zaptel.h
- install -D -m 644 torisa.h $(INSTALL_PREFIX)/usr/include/torisa.h
+ $(INSTALL) -D -m 644 zaptel.h $(INSTALL_PREFIX)/usr/include/zaptel.h
+ $(INSTALL) -D -m 644 torisa.h $(INSTALL_PREFIX)/usr/include/torisa.h
rm -f $(INSTALL_PREFIX)/usr/include/linux/zaptel.h
rm -f $(INSTALL_PREFIX)/usr/include/linux/torisa.h
- install -D -m 644 tonezone.h $(INSTALL_PREFIX)/usr/include/tonezone.h
- install -m 644 doc/ztcfg.8 $(INSTALL_PREFIX)/usr/share/man/man8
- install -m 644 doc/zttool.8 $(INSTALL_PREFIX)/usr/share/man/man8
+ $(INSTALL) -D -m 644 tonezone.h $(INSTALL_PREFIX)/usr/include/tonezone.h
+ $(INSTALL) -m 644 doc/ztcfg.8 $(INSTALL_PREFIX)/usr/share/man/man8
+ $(INSTALL) -m 644 doc/zttool.8 $(INSTALL_PREFIX)/usr/share/man/man8
[ `id -u` = 0 ] && /sbin/depmod -a $(KVERS) || :
- [ -f $(CONFIG_FILE) ] || install -D -m 644 zaptel.conf.sample $(CONFIG_FILE)
+ [ -f $(CONFIG_FILE) ] || $(INSTALL) -D -m 644 zaptel.conf.sample $(CONFIG_FILE)
build_tools/genmodconf $(BUILDVER) "$(ROOT_PREFIX)" "$(filter-out zaptel,$(MODULES))"
@if [ -d /etc/modutils ]; then \
/sbin/update-modules ; \
@@ -388,20 +405,20 @@ install-udev: devices
config:
if [ -d $(INSTALL_PREFIX)/etc/rc.d/init.d ]; then \
- install -D -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 -D -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 [ -d /etc/default ] && [ ! -f /etc/default/zaptel ]; then \
- install -D -m 644 zaptel.sysconfig $(INSTALL_PREFIX)/etc/default/zaptel; \
+ $(INSTALL) -D -m 644 zaptel.sysconfig $(INSTALL_PREFIX)/etc/default/zaptel; \
fi
if [ -d /etc/sysconfig ] && [ ! -f /etc/sysconfig/zaptel ]; then \
- install -D -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 -D -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
update:
@@ -409,9 +426,9 @@ update:
echo "Updating from Subversion..." ; \
svn update | tee update.out; \
rm -f .version; \
- if [ `grep -c ^C update.out` -gt 0 ]; then \
+ if [ `$(GREP) -c ^C update.out` -gt 0 ]; then \
echo ; echo "The following files have conflicts:" ; \
- grep ^C update.out | cut -b4- ; \
+ $(GREP) ^C update.out | cut -b4- ; \
fi ; \
rm -f update.out; \
else \
@@ -420,23 +437,24 @@ update:
# 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)
- 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) -d $(BIN_DIR)
+ $(INSTALL) $(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-modules: install-$(BUILDVER)
install-linux24: vpm450m_fw.h.o$(MODULES_BUILD)
- install -d $(MOD_DIR)
- install -m 644 $(MODULES_BUILD) $(MOD_DIR)
+ $(INSTALL) -d $(MOD_DIR)
+ $(INSTALL) -m 644 $(MODULES_BUILD) $(MOD_DIR)
install-linux26: $(MODULESKO)
$(KMAKE_INST)
clean:
+ @$(MAKE) -C menuselect clean
rm -f torisatool makefw tor2fw.h radfw.h fw2h
rm -f $(BINS)
rm -f *.o ztcfg tzdriver sethdlc sethdlc-new
@@ -458,4 +476,32 @@ endif
rm -rf mISDNuser*
rm -f fw2h vpm450m_fw.h
+distclean: dist-clean
+
+dist-clean: clean
+ @$(MAKE) -C menuselect dist-clean
+ @$(MAKE) -C mxml clean
+ rm -f makeopts menuselect.makeopts
+ rm -f config.log config.status
FORCE:
+
+config.status: configure
+ @CFLAGS="" ./configure
+ @echo "****"
+ @echo "**** The configure script was just executed, so 'make' needs to be"
+ @echo "**** restarted."
+ @echo "****"
+ @exit 1
+
+menuselect.makeopts: menuselect/menuselect makeopts.xml
+ @menuselect/menuselect --check-deps ${GLOBAL_MAKEOPTS} ${USER_MAKEOPTS} $@
+
+menuselect: menuselect/menuselect
+ -@menuselect/menuselect $(GLOBAL_MAKEOPTS) $(USER_MAKEOPTS) menuselect.makeopts && echo "menuselect changes saved!" || echo "menuselect changes NOT saved!"
+
+menuselect/menuselect: menuselect/menuselect.c menuselect/menuselect_curses.c menuselect/menuselect.h menuselect/linkedlists.h config.status mxml/libmxml.a
+ @CFLAGS="" $(MAKE) -C menuselect menuselect
+
+mxml/libmxml.a:
+ @cd mxml && unset CFLAGS LIBS && test -f config.h || ./configure
+ $(MAKE) -C mxml libmxml.a