[zaptel-commits] tzafrir: branch tzafrir/kernelmove r2241 - /team/tzafrir/kernelmove/

zaptel-commits at lists.digium.com zaptel-commits at lists.digium.com
Tue Feb 27 06:24:56 MST 2007


Author: tzafrir
Date: Tue Feb 27 07:24:55 2007
New Revision: 2241

URL: http://svn.digium.com/view/zaptel?view=rev&rev=2241
Log:
The install target basically works now. This branch is now worht a look.
* Main makefile largely simplified:
* Removing all kernel-2.4-specific rules and variables.
* Removed the target _all to avoid a needless recursive call.
* Removed kernel flags from CFLAGS.
* Generally clean up CFLAGS
* Calling libtonezone.so with the full name.
* Hopefully with minimal reduced functionality.
* Remove generation of automatic ztcfg rules (they needed fixing to work
  with INSTALL_PREFIX, and they are not needed anyway)

Modified:
    team/tzafrir/kernelmove/Makefile
    team/tzafrir/kernelmove/TODO

Modified: team/tzafrir/kernelmove/Makefile
URL: http://svn.digium.com/view/zaptel/team/tzafrir/kernelmove/Makefile?view=diff&rev=2241&r1=2240&r2=2241
==============================================================================
--- team/tzafrir/kernelmove/Makefile (original)
+++ team/tzafrir/kernelmove/Makefile Tue Feb 27 07:24:55 2007
@@ -31,31 +31,9 @@
 KVERS_MAJ:=$(shell echo $(KVERS) | cut -d. -f1-2)
 KINCLUDES:=$(KSRC)/include
 
-CFLAGS+=-I. -O4 -g -Wall -DBUILDING_TONEZONE #-DTONEZONE_DRIVER
+CFLAGS+=-I. -g -Wall -DBUILDING_TONEZONE #-DTONEZONE_DRIVER
 CFLAGS+=-Ikernel # FIXME: we can't really need everything from there.
-ifneq (,$(findstring ppc,$(UNAME_M)))
-CFLAGS_PPC:=-fsigned-char
-endif
-ifneq (,$(findstring x86_64,$(UNAME_M)))
-CFLAGS_x86_64:=-m64
-endif
-CFLAGS+=$(CFLAGS_PPC) $(CFLAGS_x86_64)
 LCFLAGS=-fPIC $(CFLAGS) -DBUILDING_TONEZONE
-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
-ifneq (,$(wildcard $(KINCLUDES)/linux/modversions.h))
-  KFLAGS+=-DMODVERSIONS -include $(KINCLUDES)/linux/modversions.h
-endif
-ifneq (,$(findstring ppc,$(UNAME_M)))
-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
-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
@@ -78,11 +56,12 @@
  endif
 endif
 
+CHECK_SELINUX	= [ -x /usr/sbin/sestatus ] && (/usr/sbin/sestatus | grep "SELinux status:" | grep -q "enabled")
+
 #
 # Features are now configured in zconfig.h
 #
 
-KFLAGS+=-DSTANDALONE_ZAPATA
 CFLAGS+=-DSTANDALONE_ZAPATA
 KMAKE  = $(MAKE) -C $(KSRC) SUBDIRS=$(PWD)/kernel
 KMAKE_INST = $(KMAKE) \
@@ -92,7 +71,8 @@
 INSTALL_PREFIX=$(DESTDIR)
 
 CONFIG_FILE=$(INSTALL_PREFIX)/etc/zaptel.conf
-CFLAGS+=-DZAPTEL_CONFIG=\"$(CONFIG_FILE)\"
+
+UDEV_RULES_DIR	= $(INSTALL_PREFIX)/etc/udev/rules.d
 
 ifeq ($(KVERS_MAJ),2.4)
   BUILDVER:=linux24
@@ -124,16 +104,16 @@
 endif
 endif
 
-LTZ_A:=libtonezone.a
-LTZ_A_OBJS:=zonedata.o tonezone.o
-LTZ_SO:=libtonezone.so
-LTZ_SO_OBJS:=zonedata.lo tonezone.lo
-LTZ_SO_MAJOR_VER:=1
-LTZ_SO_MINOR_VER:=0
+LTZ_A		:= libtonezone.a
+LTZ_A_OBJS	:= zonedata.o tonezone.o
+LTZ_SO_BASE	:= libtonezone.so
+LTZ_SO_OBJS	:= zonedata.lo tonezone.lo
+LTZ_SO_MAJOR_VER:= 1
+LTZ_SO_MINOR_VER:= 0
+LTZ_SO		:= $(LTZ_SO_BASE).$(LTZ_SO_MAJOR_VER).$(LTZ_SO_MINOR_VER)
 
 MODULES:=pciradio tor2 torisa wcfxo wct1xxp wctdm wctdm24xxp wcte11xp wcusb zaptel ztd-eth ztd-loc ztdummy ztdynamic zttranscode
 #ZAP_SUBDIRS:=wct4xxp ztcodec_dte xpp datamods
-ZAP_SUBDIRS:=wct4xxp ztcodec_dte xpp 
 MODULES:=$(filter-out $(MENUSELECT_MODULES),$(MODULES))
 MODULE_ALIASES=wcfxs wctdm8xxp wct2xxp
 
@@ -148,24 +128,23 @@
 INC_DIR:=$(INSTALL_PREFIX)/usr/include
 MOD_DIR:=$(INSTALL_PREFIX)/lib/modules/$(KVERS)/misc
 
-MOD_DESTDIR:=zaptel
-
-ifeq (0,1)
-obj-m:=$(MODULESO)
+LDCONFIG	= /sbin/ldconfig
+SBINDIR		= $(INSTALL_PREFIX)/sbin
+BINS_INSTALL	= $(BINS)
+MANDIR		= $(INSTALL_PREFIX)/share/man
+INCLUDE_DIR	= $(INSTALL_PREFIX)/usr/include/zaptel
+
 ifeq ($(findstring wct4xxp,$(MENUSELECT_MODULES)),)
-obj-m+=wct4xxp/
-MODULES+=wct4xxp
+ZAP_SUBDIRS	+= wct4xxp
 endif
 
 ifeq ($(findstring ztcodec_dte,$(MENUSELECT_MODULES)),)
-obj-m+=ztcodec_dte/
-MODULES+=ztcodec_dte
+ZAP_SUBDIRS	+= ztcodec_dte
 endif
 
 ifeq ($(findstring xpp_usb,$(MENUSELECT_MODULES)),)
 obj-m+=xpp/
-MODULES+=xpp
-endif
+ZAP_SUBDIRS	+= xpp
 endif
 
 # Set this to override hotplug firmware loading and revert to classic header
@@ -179,12 +158,9 @@
 UTILSO:=$(UTILS:%=%.o)
 BINS:=$(filter-out $(MENUSELECT_UTILS),$(BINS))
 
-all: menuselect.makeopts 
-	@$(MAKE) _all
-
-_all: $(if $(MODULES),modules) programs $(LTZ_SO) $(LTZ_A)
-
-programs: $(BINS)
+all: menuselect.makeopts modules programs
+
+programs: $(BINS) $(LTZ_SO) $(LTZ_A)
 
 modules: $(BUILDVER)
 
@@ -195,8 +171,6 @@
 linux26: prereq
 	@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) HOTPLUG_FIRMWARE=$(HOTPLUG_FIRMWARE) modules
-
-xpp: linux26
 
 version.h:
 	@ZAPTELVERSION="${ZAPTELVERSION}" build_tools/make_version_h > $@.tmp
@@ -205,35 +179,10 @@
 	fi
 	@rm -f $@.tmp
 
-wct4xxp/wct4xxp.o:
-	$(MAKE) -C wct4xxp KFLAGS="$(KFLAGS) -I.." CFLAGS="$(CFLAGS) -I.."
-
-ztcodec_dte/ztcodec_dte.o:
-	$(MAKE) -C ztcodec_dte KFLAGS="$(KFLAGS) -I.." CFLAGS="$(CFLAGS) -I.."
-
 devel: tor2ee 
 
 tests: patgen pattest patlooptest hdlcstress hdlctest hdlcgen hdlcverify timertest
 
-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
-
-wcusb.o: wcusb.h
-
-wcfxsusb.o: wcfxsusb.h
-
-wctdm.o: wctdm.h
-
-wctdm24xxp.o: wctdm.h
-
-pciradio.o: radfw.h
-
-ztdummy.o: ztdummy.h
-
-#REM# $(MODULESO): %.o: %.c zaptel.h
-#REM# 	$(CC) $(KFLAGS) -o $@ -c $<
-#REM# 
 tor2ee.o: tor2-hw.h
 
 tor2ee: LDLIBS+=-lpci
@@ -246,8 +195,6 @@
 
 torisatool: torisatool.o
 	$(CC) -o $@ $^
-
-zaptel.c: tones.h 
 
 #prereq: config.status tones.h tor2fw.h radfw.h version.h
 prereq: config.status version.h
@@ -269,9 +216,10 @@
 	ranlib $@
 
 $(LTZ_SO): $(LTZ_SO_OBJS)
-	$(CC) -shared -Wl,-soname,$(LTZ_SO).$(LTZ_SO_MAJOR_VER).$(LTZ_SO_MINOR_VER) -o $@ $^ -lm
-
-ztcfg.c: ztcfg.h
+	$(CC) -shared -Wl,-soname,$(LTZ_SO) -o $@ $^ -lm
+
+ztcfg.o: ztcfg.h
+ztcfg.o: CFLAGS+=-DZAPTEL_CONFIG=\"$(CONFIG_FILE)\"
 
 ztcfg-shared: ztcfg.o $(LTZ_SO)
 	$(CC) -o $@ $^ -lm
@@ -285,10 +233,7 @@
 ztcfg-dude: ztcfg-dude.o mknotch.o complex.o $(LTZ_SO)
 	$(CC) -o $@ $^ -lm -lstdc++
 
-mknotch.o: mknotch.cc
-	$(CC) -o $@ -c $^
-
-complex.o: complex.cc
+mknotch.o complex.o: %.o: %.cc
 	$(CC) -o $@ -c $^
 
 usbfxstest: LDLIBS+=-lzap
@@ -351,81 +296,38 @@
 	done
 else # DYNFS
   ifdef UDEVRULES
-	build_tools/genudevrules > $(INSTALL_PREFIX)/etc/udev/rules.d/zaptel.rules
+	install -d $(UDEV_RULES_DIR)
+	build_tools/genudevrules > $(UDEV_RULES_DIR)/zaptel.rules
   else # !UDEVRULES
 	@echo "**** Dynamic filesystem detected -- not creating device nodes"
   endif
 endif
 
-xpp-install:
-ifneq (,$(findstring xpp,$(obj-m)))
-	@$(MAKE) -C xpp/utils install
-endif
-
-install: all devices firmware install-libs install-include xpp-install
+install: all devices firmware 
 ifeq ($(HOTPLUG_FIRMWARE),yes)
 	$(MAKE) -C firmware hotplug-install
 endif
-	if [ -f ztcfg ]; then \
-		$(INSTALL) -D -m 755 ztcfg $(INSTALL_PREFIX)/sbin/ztcfg; \
-	fi
-	if [ -f sethdlc-new ]; then \
-		$(INSTALL) -D -m 755 sethdlc-new $(INSTALL_PREFIX)/sbin/sethdlc; \
-	elif [ -f sethdlc ]; then \
-		$(INSTALL) -D -m 755 sethdlc $(INSTALL_PREFIX)/sbin/sethdlc; \
-	fi
-	if [ -f zttool ]; then \
-		$(INSTALL) -D -m 755 zttool $(INSTALL_PREFIX)/sbin/zttool; \
+	install -d $(SBINDIR)
+	install $(BINS_INSTALL) $(SBINDIR)/
+	install -d $(INCLUDE_DIR)
+	$(INSTALL) -m 644 kernel/zaptel.h tonezone.h $(INCLUDE_DIR)/
+	install -d $(MANDIR)/man8
+	$(INSTALL) -m 644 doc/*.8 $(MANDIR)/man8/
+	install -d $(LIB_DIR)
+	$(INSTALL) $(LTZ_A) $(LTZ_SO) $(LIB_DIR)/
+	$(LDCONFIG) || $(LDCONFIG) -n $(LIB_DIR)
+	# FIXME: should this be set for the symlink LTZ_SO_BASE or for 
+	# the real file LTZ_SO ? 
+	if [ -z "$(INSTALL_PREFIX)" ] && $(CHECK_SELINUX) ; then \
+	  /sbin/restorecon -v $(LIB_DIR)/$(LTZ_SO_BASE); \
 	fi
 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 \
-		rm -f $(INSTALL_PREFIX)/lib/modules/$(KVERS)/misc/{hdlc_*,syncppp}.ko; \
-	fi
+	$(KMAKE_INST)
 else
-	for x in $(MODULESO) wct4xxp/wct4xxp.o; 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) -m 644 doc/ztcfg.8 $(INSTALL_PREFIX)/usr/share/man/man8
-	$(INSTALL) -m 644 doc/zttool.8 $(INSTALL_PREFIX)/usr/share/man/man8
+	$(MAKE) -C kernel install
+endif
 	[ `id -u` = 0 ] && /sbin/depmod -a $(KVERS) || :
 	[ -f $(CONFIG_FILE) ] || $(INSTALL) -D -m 644 zaptel.conf.sample $(CONFIG_FILE)
-	build_tools/genmodconf $(BUILDVER) "$(ROOT_PREFIX)" "$(filter-out zaptel,$(MODULES)) $(MODULE_ALIASES)"
-	@if [ -d /etc/modutils ]; then \
-		/sbin/update-modules ; \
-	fi
-
-install-libs: $(LTZ_SO) $(LTZ_A)
-	$(INSTALL) -D -m 755 $(LTZ_A) $(LIB_DIR)/$(LTZ_A)
-	$(INSTALL) -D -m 755 $(LTZ_SO) $(LIB_DIR)/$(LTZ_SO).$(LTZ_SO_MAJOR_VER).$(LTZ_SO_MINOR_VER)
-	if [ -z "$(INSTALL_PREFIX)" -a `id -u` = 0 ]; then \
-		/sbin/ldconfig || : ;\
-	fi
-	rm -f $(LIB_DIR)$(LTZ_SO)
-	$(LN) -sf $(LTZ_SO).$(LTZ_SO_MAJOR_VER).$(LTZ_SO_MINOR_VER) \
-		$(LIB_DIR)/$(LTZ_SO).$(LTZ_SO_MAJOR_VER)
-	$(LN) -sf $(LTZ_SO).$(LTZ_SO_MAJOR_VER).$(LTZ_SO_MINOR_VER) \
-		$(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-include:
-	$(INSTALL) -D -m 644 zaptel.h $(INSTALL_PREFIX)/usr/include/zaptel/zaptel.h
-	$(INSTALL) -D -m 644 tonezone.h $(INSTALL_PREFIX)/usr/include/zaptel/tonezone.h
-	rm -f $(INSTALL_PREFIX)/usr/include/linux/zaptel.h
-	rm -f $(INSTALL_PREFIX)/usr/include/linux/torisa.h
-	rm -f $(INSTALL_PREFIX)/usr/include/zaptel.h
-	rm -f $(INSTALL_PREFIX)/usr/include/torisa.h
-	rm -f $(INSTALL_PREFIX)/usr/include/tonezone.h
 
 install-udev: devices
 

Modified: team/tzafrir/kernelmove/TODO
URL: http://svn.digium.com/view/zaptel/team/tzafrir/kernelmove/TODO?view=diff&rev=2241&r1=2240&r2=2241
==============================================================================
--- team/tzafrir/kernelmove/TODO (original)
+++ team/tzafrir/kernelmove/TODO Tue Feb 27 07:24:55 2007
@@ -2,13 +2,14 @@
 
 * Kernel 2.6 builds
 * Kernel 2.4 basically builds (firmware building doesn't work)
+* 'make install' basically works on 2.6, still untested on 2.4 .
 
 TODO:
+* Merge changes from trunk.
 * Fix building the datamod dir(?)
 * firmwares: who's responsoble for them? Needs some rewrite.
 * "Kbuild" is not good for some older 2.6 kernels. (Makefile/makefile?)
 * How do we provide version.h to kernel dir?
 * How do we provide zaptel.h to userspace?
-* Trim main Makefile.
 * dependencies? (ztd-eth->ztdynamic).
 * Configuration system.



More information about the zaptel-commits mailing list