home *** CD-ROM | disk | FTP | other *** search
/ PC Welt 2006 November (DVD) / PCWELT_11_2006.ISO / casper / filesystem.squashfs / usr / src / linux-headers-2.6.17-6 / debian / ruleset / misc / modules.mk < prev    next >
Encoding:
Text File  |  2005-11-02  |  4.4 KB  |  125 lines

  1. ######################### -*- Mode: Makefile-Gmake -*- ########################
  2. ## modules.mk --- 
  3. ## Author           : Manoj Srivastava ( srivasta@glaurung.internal.golden-gryphon.com ) 
  4. ## Created On       : Mon Oct 31 18:08:29 2005
  5. ## Created On Node  : glaurung.internal.golden-gryphon.com
  6. ## Last Modified By : Manoj Srivastava
  7. ## Last Modified On : Mon Oct 31 18:08:29 2005
  8. ## Last Machine Used: glaurung.internal.golden-gryphon.com
  9. ## Update Count     : 0
  10. ## Status           : Unknown, Use with caution!
  11. ## HISTORY          : 
  12. ## Description      : deals with setting up variables, looking at
  13. ##                    directories, and creating a list of valid third party
  14. ##                    modules available for the kernel being built.
  15. ## 
  16. ## arch-tag: 9b687fd4-a7d0-4360-8ce6-3ce3a0e2cfac
  17. ## 
  18. ## 
  19. ## This program is free software; you can redistribute it and/or modify
  20. ## it under the terms of the GNU General Public License as published by
  21. ## the Free Software Foundation; either version 2 of the License, or
  22. ## (at your option) any later version.
  23. ##
  24. ## This program is distributed in the hope that it will be useful,
  25. ## but WITHOUT ANY WARRANTY; without even the implied warranty of
  26. ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  27. ## GNU General Public License for more details.
  28. ##
  29. ## You should have received a copy of the GNU General Public License
  30. ## along with this program; if not, write to the Free Software
  31. ## Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  32. ##
  33. ###############################################################################
  34.  
  35.  
  36. # Deal with modules issues
  37. ifeq ($(strip $(CONFDIR)),)
  38.   ifeq ($(strip $(patch_the_kernel)),YES)
  39.     CONFDIR     = $(PATCH_DIR)
  40.   else
  41.     ifeq ($(strip $(patch_the_kernel)),yes)
  42.       CONFDIR     = $(PATCH_DIR)
  43.     else
  44.       $(eval $(which_debdir))
  45.       CONFDIR     = $(DEBDIR)/Config
  46.     endif
  47.   endif
  48. endif
  49.  
  50. # The file which has local configuration
  51. $(eval $(which_debdir))
  52. CONFIG_FILE := $(shell if test -e .config ; then \
  53.                            echo .config; \
  54.                        elif test -e $(DEBCONFIG) ; then \
  55.                            echo $(DEBCONFIG); \
  56.                        elif test -e $(CONFDIR)/config ; then \
  57.                            echo $(CONFDIR)/config ; \
  58.                        elif test -e $(DEBDIR)/config ; then \
  59.                            echo $(DEBDIR)/config ; \
  60.                        elif test -e /boot/config-$(version) ; then \
  61.                            echo /boot/config-$(version) ; \
  62.                        elif test -e /boot/config-$$(uname -r) ; then \
  63.                            echo /boot/config-$$(uname -r) ; \
  64.                        else echo /dev/null ; \
  65.                        fi)
  66.  
  67.  
  68. ifeq ($(DEB_HOST_GNU_SYSTEM), linux-gnu)
  69.   config = .config
  70. else
  71.   ifeq ($(DEB_HOST_GNU_SYSTEM), kfreebsd-gnu)
  72.     config = $(architecture)/conf/GENERIC
  73.   endif
  74. endif
  75.  
  76.  
  77. # define MODULES_ENABLED if appropriate
  78. ifneq ($(filter kfreebsd-gnu, $(DEB_HOST_GNU_SYSTEM)):$(strip $(shell grep -E ^[^\#]*CONFIG_MODULES $(CONFIG_FILE))),:)
  79.   MODULES_ENABLED := YES
  80. endif
  81.  
  82. # accept both space separated list of modules, as well as comma
  83. # separated ones
  84. valid_modules:=
  85.  
  86. # See what modules we are talking about
  87. ifeq ($(strip $(MODULES_ENABLED)),YES)
  88. ifneq ($(strip $(KPKG_SELECTED_MODULES)),)
  89. canonical_modules=$(subst $(comma),$(space),$(KPKG_SELECTED_MODULES))
  90. else
  91. canonical_modules=$(shell test -e $(MODULE_LOC) && \
  92.                        find $(MODULE_LOC) -follow -maxdepth 1 -type d -print |\
  93.                grep -E -v '^$(MODULE_LOC)/$$')
  94. endif
  95.  
  96.  
  97. # Now, if we have any modules at all, they are in canonical_modules
  98. ifneq ($(strip $(canonical_modules)),)
  99.  
  100. # modules can have the full path, or just the name of the module. We
  101. # make all the modules ahve absolute paths by fleshing them out.
  102. path_modules   :=$(filter     /%, $(canonical_modules))
  103. no_path_modules:=$(filter-out /%, $(canonical_modules))
  104. fleshed_out    :=$(foreach mod,$(no_path_modules),$(MODULE_LOC)/$(mod))
  105.  
  106. # Hmmph. recreate the canonical modules; now everything has a full
  107. # path name.
  108.  
  109. canonical_modules:=$(path_modules) $(fleshed_out)
  110. # test to see if the dir names are real
  111. valid_modules = $(shell for dir in $(canonical_modules); do \
  112.                             if [ -d $$dir ] && [ -x $$dir/debian/rules ]; then \
  113.                                echo $$dir;                  \
  114.                             fi;                             \
  115.                         done)
  116.  
  117.  
  118. endif
  119. endif
  120.  
  121.  
  122. #Local variables:
  123. #mode: makefile
  124. #End:
  125.