[asterisk-bugs] [Zaptel 0004280]: zaptel makefile cleanup

noreply at bugs.digium.com noreply at bugs.digium.com
Sat Jun 7 10:51:56 CDT 2008


A NOTE has been added to this issue. 
====================================================================== 
http://bugs.digium.com/view.php?id=4280 
====================================================================== 
Reported By:                tzafrir
Assigned To:                kpfleming
====================================================================== 
Project:                    Zaptel
Issue ID:                   4280
Category:                   Core/General
Reproducibility:            N/A
Severity:                   feature
Priority:                   normal
Status:                     closed
Zaptel Version:             CVS HEAD 
SVN Branch (only for SVN checkouts, not tarball releases): N/A 
SVN Revision (number only!):  
Disclaimer on File?:        No 
Request Review:              
Resolution:                 fixed
Fixed in Version:           
====================================================================== 
Date Submitted:             05-15-2005 18:14 CDT
Last Modified:              06-07-2008 10:51 CDT
====================================================================== 
Summary:                    zaptel makefile cleanup
Description: 
The makefiles seem to require many fixes to be used by the Debian packages.
I wanted to submit most of those fixes, and in the process clean up the
makefiles. Zaptel seemed like a good place to start as it has some obvious
places. This attempts to address some.

Problems:

* Not trivial to build for a different kernel than the one installed.
`uname -r` is used in a number of place.

* long and complicated $(shell) constructs. When lines start to get over
80 chars, things are messy.

* make will silently fail. Unlike a standard makefile, dependencies are
not used well enough here and an error that prevented from building half
the targets could go unnoticed.

* long and complicated install target


I attach a diff with numerous changes. I don't expect them to be
implemented as-is, but I hope it can be a point of reference. It did get
zaptel built on my system, but I use Stable, so I haven't really tested
further.

Some of the changes:

* using the static rule '$(MODULES): %.c: %.o zaptel.h' helped cleaning up
the modules part. Smilar rules could be used

* Use ':=' instead of '=' in many places

* Is there a reason not to use -fsigned-char everywhere? It seems to be a
nop on platforms where it's not required for zaptel. It is reuired on some
other platforms, BTW: mips, s390, etc. (big endians?)

* define KSRC as a user-overridable kernel source path. Uses 'uname -r' if
not set.

* /usr/include/linux is used not only by the breakage-happy people of
RedHat. Is it used on practically any distro.

* don't add a $(shell if .. then echo ..) to CFLAGS and co. use them in
ifneq conditions.

* Where there are nested make if-s, indent (with spaces!)

* ldconfig: Not happy about hwat I put. 
======================================================================
Relationships       ID      Summary
----------------------------------------------------------------------
parent of           0004355 zaptel makefile cleanup
related to          0004358 zaptel/Makefile broken for RHEL3
====================================================================== 

---------------------------------------------------------------------- 
 svnbot - 06-07-08 10:51  
---------------------------------------------------------------------- 
Repository: dahdi
Revision: 650

U   trunk/Makefile

------------------------------------------------------------------------
r650 | kpfleming | 2008-06-07 10:51:52 -0500 (Sat, 07 Jun 2008) | 13 lines

major cleanup:
  allow builds against any installed kernel using KVERS
  allow builds against any kernel sources using KSRC
  for 2.6 kernels, use the kernel's "module_install" script instead of
doing it ourselves
  don't make extraneous libtonezone symlinks
  efficiency improvements (don't use $(shell) when not needed, and only
one time when needed)
  use more concise rules

ideas came from bug http://bugs.digium.com/view.php?id=4280, along with some of
the implementation

tested against make-3.80 and make-3.79.1
tested against 2.6.11.10, 2.4.30 and 2.6.8-(mumble) SUSE kernels

------------------------------------------------------------------------

http://svn.digium.com/view/dahdi?view=rev&revision=650 

Issue History 
Date Modified   Username       Field                    Change               
====================================================================== 
06-07-08 10:51  svnbot         Note Added: 0088040                          
======================================================================




More information about the asterisk-bugs mailing list