From c9f7297b684b0daba5d1a939ba13c98de97eff8f Mon Sep 17 00:00:00 2001 From: kpfleming Date: Wed, 17 May 2006 19:06:34 +0000 Subject: Merged revisions 1064-1065 via svnmerge from https://origsvn.digium.com/svn/zaptel/branches/1.2 ........ r1064 | kpfleming | 2006-05-17 11:49:46 -0500 (Wed, 17 May 2006) | 2 lines move udev rules creating into a script, and generate it properly based on the installed udev version ........ r1065 | kpfleming | 2006-05-17 13:50:38 -0500 (Wed, 17 May 2006) | 2 lines move module-rules building into a script, and remove some old unnecessary steps ........ git-svn-id: http://svn.digium.com/svn/zaptel/trunk@1067 5390a7c7-147a-4af0-8ec9-7488f05a26cb --- Makefile | 154 ++++++++++++--------------------------------------------------- 1 file changed, 29 insertions(+), 125 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 340dc3d..ac759c4 100644 --- a/Makefile +++ b/Makefile @@ -4,9 +4,9 @@ # Copyright (C) 2001-2006 Digium, Inc. # # + .EXPORT_ALL_VARIABLES: -BASEADDR=0xd0000 PWD:=$(shell pwd) HOSTCC=gcc @@ -77,54 +77,15 @@ else BUILDVER:=linux26 endif -ifeq ($(BUILDVER),linux26) - ifneq (,$(wildcard $(ROOT_PREFIX)/etc/modprobe.d)) - MODCONF:=$(ROOT_PREFIX)/etc/modprobe.d/zaptel - else - ifneq (,$(wildcard $(ROOT_PREFIX)/etc/modules.d)) - MODCONF:=$(ROOT_PREFIX)/etc/modules.d/zaptel - else - ifneq (,$(wildcard $(ROOT_PREFIX)/etc/modprobe.conf)) - MODCONF:=$(ROOT_PREFIX)/etc/modprobe.conf - MODCONFBACKUP:=1 - else - ifneq (,$(wildcard $(ROOT_PREFIX)/etc/conf.modules)) - MODCONF:=$(ROOT_PREFIX)/etc/conf.modules - MODCONFBACKUP:=1 - endif - endif - endif - endif - # get the minor version of module-init-tools, since only 3.2.x and above support - # $CMDLINE_OPTS replacement - MODTOOLSVERSION:=$(shell /sbin/modprobe --version | awk '{print $$3;}' | cut -d . -f2) - ifneq ($(MODTOOLSVERSION),1) - MODCMDLINE:=\$$CMDLINE_OPTS - endif -else # BUILDVER == linux24 - ifneq (,$(wildcard $(ROOT_PREFIX)/etc/modutils)) - MODCONF:=$(ROOT_PREFIX)/etc/modutils/zaptel - MODCONFBACKUP:=1 - else - ifneq (,$(wildcard $(ROOT_PREFIX)/etc/modules.conf)) - MODCONF:=$(ROOT_PREFIX)/etc/modules.conf - MODCONFBACKUP:=1 - endif - endif -endif - # This is not related to the version that we build. Rather, to the # version that we runs. If we build for 2.4 using 2.4 headers on a 2.6 # system with udev mounted on /dev , no point in installing files to /dev # because they'll be wiped at next reboot. -DYNFS:=$(shell ps ax | grep -q -v grep | grep -qw 'devfsd\|udevd' && echo "yes") +DYNFS:=$(shell ps ax | grep -v grep | grep -qw 'devfsd\|udevd' && echo "yes") -# Check for udev permissions directories +# Check for udev rules directories ifneq (,$(wildcard $(ROOT_PREFIX)/etc/udev/rules.d)) UDEVRULES=yes - ifneq (,$(wildcard $(ROOT_PREFIX)/etc/udev/permissions.d)) - UDEVPERMISSIONS=yes - endif endif CHKCONFIG:=$(shell sh -c 'type -p chkconfig' 2> /dev/null) @@ -157,7 +118,7 @@ MODULES:=zaptel tor2 torisa wcusb wcfxo wctdm wctdm24xxp \ ztd-loc # ztdummy #MODULES+=wcfxsusb # build ztdummy by default for 2.6 kernels -ifeq (${BUILDVER},linux26) +ifeq ($(BUILDVER),linux26) MODULES+=ztdummy endif @@ -195,10 +156,6 @@ UTILS:=tor2ee ztspeed zttool ztmonitor sethdlc-new \ usbfxstest fxstest fxotune fxsdump ztdiag UTILSO:=$(UTILS:%=%.o) -#PRIMARY=wcfxsusb -PRIMARY=torisa -#PRIMARY=wcfxo - all: modules $(LIBTONEZONE_SO) programs: $(BINS) @@ -353,12 +310,7 @@ ifndef DYNFS done else # DYNFS ifdef UDEVRULES - ifdef UDEVPERMISSIONS - install -m 644 udev/zaptel.rules $(INSTALL_PREFIX)/etc/udev/rules.d - install -m 644 udev/zaptel.permissions $(INSTALL_PREFIX)/etc/udev/permissions.d - else # !UDEVPERMISSIONS (newer, combined syntax) - install -m 644 udev/zaptel.rules-combined $(INSTALL_PREFIX)/etc/udev/rules.d/zaptel.rules - endif + build_tools/genudevrules > $(INSTALL_PREFIX)/etc/udev/rules.d/zaptel.rules else # !UDEVRULES @echo "**** Dynamic filesystem detected -- not creating device nodes" endif @@ -372,29 +324,25 @@ install: all devices 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 zaptel.ko ]; then \ - for x in $(MODULESKO); do \ - rm -f $(INSTALL_PREFIX)/lib/modules/$(KVERS)/extra/$$x ; \ - done; \ - $(KMAKE_INST); \ - if [ -f datamods/syncppp.ko ]; then \ - $(MAKE) -C datamods install; \ - else \ - rm -f $(INSTALL_PREFIX)/lib/modules/$(KVERS)/misc/{hdlc_*,syncppp}.ko; \ - fi; \ - if ! [ -f wcfxsusb.ko ]; then \ - rm -f $(INSTALL_PREFIX)/lib/modules/$(KVERS)/misc/wcfxsusb.ko; \ - fi; \ - rm -f $(INSTALL_PREFIX)/lib/modules/$(KVERS)/misc/wcfxs.ko; \ +ifeq ($(BUILDVER),linux26) + for x in $(MODULESKO); do \ + rm -f $(INSTALL_PREFIX)/lib/modules/$(KVERS)/extra/$$x ; \ + done; \ + $(KMAKE_INST); \ + if [ -f datamods/syncppp.ko ]; then \ + $(MAKE) -C datamods install; \ else \ - for x in $(MODULESO); do \ - install -D -m 644 $$x $(INSTALL_PREFIX)/lib/modules/$(KVERS)/misc/$$x ; \ - done; \ - 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; \ + rm -f $(INSTALL_PREFIX)/lib/modules/$(KVERS)/misc/{hdlc_*,syncppp}.ko; \ fi +else + for x in $(MODULESO); do \ + 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) [ `id -u` = 0 ] && /sbin/ldconfig || : rm -f $(INSTALL_PREFIX)/usr/lib/$(LIBTONEZONE_SO) @@ -402,64 +350,20 @@ install: all devices $(INSTALL_PREFIX)/usr/lib/$(LIBTONEZONE_SO).$(LIBTONEZONE_SO_MAJOR_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 -q "SELinux status:" | grep -q "enabled") ; then restorecon -v $(INSTALL_PREFIX)/usr/lib/$(LIBTONEZONE_SO); fi + 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/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 install -m 644 doc/ztcfg.8 $(INSTALL_PREFIX)/usr/share/man/man8 install -m 644 doc/zttool.8 $(INSTALL_PREFIX)/usr/share/man/man8 - if [ -n "$(MODCONF)" ]; then \ - if [ -n "$(MODCONFBACKUP)" ]; then \ - if [ -f $(MODCONF) ]; then mv -f $(MODCONF) $(MODCONF).bak ; fi; \ - cat $(MODCONF).bak | grep -q -v "alias char-major-250" | \ - grep -q -v "post-install torisa /sbin/ztcfg" | \ - grep -q -v "post-install wcfxsusb /sbin/ztcfg" | \ - grep -q -v "alias wctdm" | \ - grep -q -v "post-install wctdm /sbin/ztcfg" > $(MODCONF); \ - if ! grep -q "options torisa" $(MODCONF); then \ - echo "options torisa base=$(BASEADDR)" >> $(MODCONF); \ - fi; \ - if ! grep -q "alias char-major-196" $(MODCONF); then \ - echo "alias char-major-196 $(PRIMARY)" >> $(MODCONF); \ - fi; \ - else \ - grep "^options" $(MODCONF) > $(MODCONF).new; \ - rm -f $(MODCONF) $(MODCONF).bak; \ - mv $(MODCONF).new $(MODCONF); \ - fi; \ - for x in $(MODULES); do \ - 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 $(MODCMDLINE) && /sbin/ztcfg" >> $(MODCONF); \ - else echo "post-install $$x /sbin/ztcfg" >> $(MODCONF); \ - fi; \ - fi; \ - fi; \ - fi; \ - done; \ - if ! grep -q "alias wcfxs" $(MODCONF); then \ - echo "alias wcfxs wctdm" >> $(MODCONF); \ - fi; \ - if ! grep -q "alias wct2xxp" $(MODCONF); then \ - echo "alias wct2xxp wct4xxp" >> $(MODCONF); \ - fi; \ - fi + build_tools/genmodconf $(BUILDVER) "$(ROOT_PREFIX)" "$(filter-out zaptel,$(MODULES))" if [ -d /etc/modutils ]; then \ /sbin/update-modules ; \ fi [ `id -u` = 0 ] && /sbin/depmod -a $(KVERS) || : [ -f $(CONFIG_FILE) ] || install -D -m 644 zaptel.conf.sample $(CONFIG_FILE) -install-udev: - ifdef UDEVRULES - ifdef UDEVPERMISSIONS - install -m 644 udev/zaptel.rules $(INSTALL_PREFIX)/etc/udev/rules.d - install -m 644 udev/zaptel.permissions $(INSTALL_PREFIX)/etc/udev/permissions.d - else # !UDEVPERMISSIONS (newer, combined syntax) - install -m 644 udev/zaptel.rules-combined $(INSTALL_PREFIX)/etc/udev/rules.d/zaptel.rules - endif - endif +install-udev: devices config: if [ -d $(INSTALL_PREFIX)/etc/rc.d/init.d ]; then \ @@ -486,7 +390,7 @@ update: rm -f .version; \ if [ `grep -q -c ^C update.out` -gt 0 ]; then \ echo ; echo "The following files have conflicts:" ; \ - grep -q ^C update.out | cut -b4- ; \ + grep ^C update.out | cut -b4- ; \ fi ; \ rm -f update.out; \ elif [ -d CVS ]; then \ @@ -495,7 +399,7 @@ update: rm -f .version; \ if [ `grep -q -c ^C update.out` -gt 0 ]; then \ echo ; echo "The following files have conflicts:" ; \ - grep -q ^C update.out | cut -d' ' -f2- ; \ + grep ^C update.out | cut -d' ' -f2- ; \ fi ; \ rm -f update.out; \ else \ @@ -522,10 +426,10 @@ install-linux26: $(MODULESKO) clean: rm -f torisatool makefw tor2fw.h radfw.h - rm -f ${BINS} + rm -f $(BINS) rm -f *.o ztcfg tzdriver sethdlc sethdlc-new rm -f $(TZOBJS) $(LIBTONEZONE_SO) *.lo -ifeq (${BUILDVER},linux26) +ifeq ($(BUILDVER),linux26) $(KMAKE) clean $(MAKE) -C datamods clean endif -- cgit v1.2.3