Magellan Linux

Diff of /tags/mkinitrd-6_2_0/Makefile

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 532 by niro, Sat Sep 1 22:45:15 2007 UTC revision 984 by niro, Sun May 30 11:32:42 2010 UTC
# Line 1  Line 1 
1  VERSION = 1  VERSION = 1
2  PATCHLEVEL = 4  PATCHLEVEL = 16
3  SUBLEVEL = 2  SUBLEVEL = 1
4  EXTRAVERSION =  EXTRAVERSION =
5  NAME = Unnamed  NAME = Unnamed
6    
# Line 142  VPATH := $(srctree)$(if $(KBUILD_EXTMOD Line 142  VPATH := $(srctree)$(if $(KBUILD_EXTMOD
142  export srctree objtree VPATH TOPDIR  export srctree objtree VPATH TOPDIR
143    
144    
 # SUBARCH tells the usermode build what the underlying arch is.  That is set  
 # first, and if a usermode build is happening, the "ARCH=um" on the command  
 # line overrides the setting of ARCH below.  If a native build is happening,  
 # then ARCH is assigned, getting whatever value it gets normally, and  
 # SUBARCH is subsequently ignored.  
   
 SUBARCH := $(shell uname -m | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ \  
   -e s/arm.*/arm/ -e s/sa110/arm/ \  
   -e s/s390x/s390/ -e s/parisc64/parisc/ \  
   -e s/ppc.*/powerpc/ -e s/mips.*/mips/ )  
   
145  # Cross compiling and selecting different set of gcc/bin-utils  # Cross compiling and selecting different set of gcc/bin-utils
146  # ---------------------------------------------------------------------------  # ---------------------------------------------------------------------------
147  #  #
# Line 172  SUBARCH := $(shell uname -m | sed -e s/i Line 161  SUBARCH := $(shell uname -m | sed -e s/i
161  # Default value for CROSS_COMPILE is not to prefix executables  # Default value for CROSS_COMPILE is not to prefix executables
162  # Note: Some architectures assign CROSS_COMPILE in their arch/*/Makefile  # Note: Some architectures assign CROSS_COMPILE in their arch/*/Makefile
163    
164  ARCH ?= $(SUBARCH)  CROSS_COMPILE ?=
165  CROSS_COMPILE ?=  # bbox: we may have CONFIG_CROSS_COMPILER_PREFIX in .config,
166    # and it has not been included yet... thus using an awkward syntax.
167    ifeq ($(CROSS_COMPILE),)
168    CROSS_COMPILE := $(shell grep ^CONFIG_CROSS_COMPILER_PREFIX .config 2>/dev/null)
169    CROSS_COMPILE := $(subst CONFIG_CROSS_COMPILER_PREFIX=,,$(CROSS_COMPILE))
170    CROSS_COMPILE := $(subst ",,$(CROSS_COMPILE))
171    #")
172    endif
173    
174    # SUBARCH tells the usermode build what the underlying arch is.  That is set
175    # first, and if a usermode build is happening, the "ARCH=um" on the command
176    # line overrides the setting of ARCH below.  If a native build is happening,
177    # then ARCH is assigned, getting whatever value it gets normally, and
178    # SUBARCH is subsequently ignored.
179    
180    ifneq ($(CROSS_COMPILE),)
181    SUBARCH := $(shell echo $(CROSS_COMPILE) | cut -d- -f1)
182    else
183    SUBARCH := $(shell uname -m)
184    endif
185    SUBARCH := $(shell echo $(SUBARCH) | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ \
186     -e s/arm.*/arm/ -e s/sa110/arm/ \
187     -e s/s390x/s390/ -e s/parisc64/parisc/ \
188     -e s/ppc.*/powerpc/ -e s/mips.*/mips/ )
189    
190    ARCH ?= $(SUBARCH)
191    
192  # Architecture as present in compile.h  # Architecture as present in compile.h
193  UTS_MACHINE := $(ARCH)  UTS_MACHINE := $(ARCH)
# Line 183  CONFIG_SHELL := $(shell if [ -x "$$BASH" Line 197  CONFIG_SHELL := $(shell if [ -x "$$BASH"
197    else if [ -x /bin/bash ]; then echo /bin/bash; \    else if [ -x /bin/bash ]; then echo /bin/bash; \
198    else echo sh; fi ; fi)    else echo sh; fi ; fi)
199    
 HOSTCC   = gcc  
 HOSTCXX   = g++  
 HOSTCFLAGS = -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer  
 HOSTCXXFLAGS = -O2  
   
200  # Decide whether to build built-in, modular, or both.  # Decide whether to build built-in, modular, or both.
201  # Normally, just do built-in.  # Normally, just do built-in.
202    
# Line 262  export quiet Q KBUILD_VERBOSE Line 271  export quiet Q KBUILD_VERBOSE
271  # Look for make include files relative to root of kernel src  # Look for make include files relative to root of kernel src
272  MAKEFLAGS += --include-dir=$(srctree)  MAKEFLAGS += --include-dir=$(srctree)
273    
274    HOSTCC   = gcc
275    HOSTCXX   = g++
276    HOSTCFLAGS :=
277    HOSTCXXFLAGS :=
278  # We need some generic definitions  # We need some generic definitions
279  include $(srctree)/scripts/Kbuild.include  include $(srctree)/scripts/Kbuild.include
280    
281    HOSTCFLAGS += $(call hostcc-option,-Wall -Wstrict-prototypes -O2 -fomit-frame-pointer,)
282    HOSTCXXFLAGS += -O2
283    
284  # For maximum performance (+ possibly random breakage, uncomment  # For maximum performance (+ possibly random breakage, uncomment
285  # the following)  # the following)
286    
# Line 299  AFLAGS_KERNEL = Line 315  AFLAGS_KERNEL =
315    
316  # Use LINUXINCLUDE when you must reference the include/ directory.  # Use LINUXINCLUDE when you must reference the include/ directory.
317  # Needed to be compatible with the O= option  # Needed to be compatible with the O= option
318  CFLAGS :=  CFLAGS := $(CFLAGS)
319  CPPFLAGS :=  # Added only to final link stage of busybox binary
320  AFLAGS :=  CFLAGS_busybox := $(CFLAGS_busybox)
321    CPPFLAGS := $(CPPFLAGS)
322    AFLAGS := $(AFLAGS)
323    LDFLAGS := $(LDFLAGS)
324    LDLIBS :=
325    
326  # Read KERNELRELEASE from .kernelrelease (if it exists)  # Read KERNELRELEASE from .kernelrelease (if it exists)
327  KERNELRELEASE = $(shell cat .kernelrelease 2> /dev/null)  KERNELRELEASE = $(shell cat .kernelrelease 2> /dev/null)
# Line 315  export VERSION PATCHLEVEL SUBLEVEL KERNE Line 335  export VERSION PATCHLEVEL SUBLEVEL KERNE
335  export CPPFLAGS NOSTDINC_FLAGS LINUXINCLUDE OBJCOPYFLAGS LDFLAGS  export CPPFLAGS NOSTDINC_FLAGS LINUXINCLUDE OBJCOPYFLAGS LDFLAGS
336  export CFLAGS CFLAGS_KERNEL CFLAGS_MODULE  export CFLAGS CFLAGS_KERNEL CFLAGS_MODULE
337  export AFLAGS AFLAGS_KERNEL AFLAGS_MODULE  export AFLAGS AFLAGS_KERNEL AFLAGS_MODULE
338    export FLTFLAGS
339    
340  # When compiling out-of-tree modules, put MODVERDIR in the module  # When compiling out-of-tree modules, put MODVERDIR in the module
341  # tree rather than in the kernel tree. The kernel tree might  # tree rather than in the kernel tree. The kernel tree might
# Line 337  scripts_basic: Line 358  scripts_basic:
358  # To avoid any implicit rule to kick in, define an empty command.  # To avoid any implicit rule to kick in, define an empty command.
359  scripts/basic/%: scripts_basic ;  scripts/basic/%: scripts_basic ;
360    
361    # bbox: we have helpers in applets/
362    # we depend on scripts_basic, since scripts/basic/fixdep
363    # must be built before any other host prog
364    PHONY += applets_dir
365    applets_dir: scripts_basic
366     $(Q)$(MAKE) $(build)=applets
367    
368    applets/%: applets_dir ;
369    
370  PHONY += outputmakefile  PHONY += outputmakefile
371  # outputmakefile generates a Makefile in the output directory, if using a  # outputmakefile generates a Makefile in the output directory, if using a
372  # separate output directory. This allows convenient use of make in the  # separate output directory. This allows convenient use of make in the
# Line 356  endif Line 386  endif
386  # of make so .config is not included in this case either (for *config).  # of make so .config is not included in this case either (for *config).
387    
388  no-dot-config-targets := clean mrproper distclean \  no-dot-config-targets := clean mrproper distclean \
389   cscope TAGS tags help %docs check%   cscope TAGS tags help %docs
390    #bbox# check% is removed from above
391    
392  config-targets := 0  config-targets := 0
393  mixed-targets  := 0  mixed-targets  := 0
# Line 435  libs-y := \ Line 466  libs-y := \
466   libbb/ \   libbb/ \
467   libpwdgrp/ \   libpwdgrp/ \
468   loginutils/ \   loginutils/ \
469     mailutils/ \
470   miscutils/ \   miscutils/ \
471   modutils/ \   modutils/ \
472   networking/ \   networking/ \
473   networking/libiproute/ \   networking/libiproute/ \
474   networking/udhcp/ \   networking/udhcp/ \
475     printutils/ \
476   procps/ \   procps/ \
477   runit/ \   runit/ \
478     selinux/ \
479   shell/ \   shell/ \
480   sysklogd/ \   sysklogd/ \
481   util-linux/ \   util-linux/ \
482     util-linux/volume_id/ \
483    
484  endif # KBUILD_EXTMOD  endif # KBUILD_EXTMOD
485    
# Line 480  endif Line 515  endif
515  # The all: target is the default when no target is given on the  # The all: target is the default when no target is given on the
516  # command line.  # command line.
517  # This allow a user to issue only 'make' to build a kernel including modules  # This allow a user to issue only 'make' to build a kernel including modules
518  # Defaults busybox but it is usually overriden in the arch makefile  # Defaults busybox but it is usually overridden in the arch makefile
519  all: busybox  all: busybox doc
520    
521  -include $(srctree)/arch/$(ARCH)/Makefile  -include $(srctree)/arch/$(ARCH)/Makefile
522    
# Line 489  all: busybox Line 524  all: busybox
524  #bbox# NOSTDINC_FLAGS += -nostdinc -isystem $(shell $(CC) -print-file-name=include)  #bbox# NOSTDINC_FLAGS += -nostdinc -isystem $(shell $(CC) -print-file-name=include)
525  CHECKFLAGS += $(NOSTDINC_FLAGS)  CHECKFLAGS += $(NOSTDINC_FLAGS)
526    
 # warn about C99 declaration after statement  
 CFLAGS += $(call cc-option,-Wdeclaration-after-statement,)  
   
 # disable pointer signedness warnings in gcc 4.0  
 CFLAGS += $(call cc-option,-Wno-pointer-sign,)  
   
527  # Default kernel image to build when no specific target is given.  # Default kernel image to build when no specific target is given.
528  # KBUILD_IMAGE may be overruled on the commandline or  # KBUILD_IMAGE may be overruled on the commandline or
529  # set in the environment  # set in the environment
# Line 561  busybox-all  := $(core-y) $(libs-y) Line 590  busybox-all  := $(core-y) $(libs-y)
590  # Rule to link busybox - also used during CONFIG_KALLSYMS  # Rule to link busybox - also used during CONFIG_KALLSYMS
591  # May be overridden by arch/$(ARCH)/Makefile  # May be overridden by arch/$(ARCH)/Makefile
592  quiet_cmd_busybox__ ?= LINK    $@  quiet_cmd_busybox__ ?= LINK    $@
593        cmd_busybox__ ?= $(srctree)/scripts/trylink $(CC) $(LDFLAGS) \        cmd_busybox__ ?= $(srctree)/scripts/trylink \
594        -o $@ \        "$@" \
595        -Wl,--warn-common -Wl,--sort-common \        "$(CC)" \
596        -Wl,--start-group $(busybox-all) -Wl,--end-group        "$(CFLAGS) $(CFLAGS_busybox)" \
597          "$(LDFLAGS) $(EXTRA_LDFLAGS)" \
598          "$(core-y)" \
599          "$(libs-y)" \
600          "$(LDLIBS)"
601    
602  # Generate System.map  # Generate System.map
603  quiet_cmd_sysmap = SYSMAP  quiet_cmd_sysmap = SYSMAP
# Line 671  busybox_unstripped: $(busybox-all) FORCE Line 704  busybox_unstripped: $(busybox-all) FORCE
704   $(Q)rm -f .old_version   $(Q)rm -f .old_version
705    
706  busybox: busybox_unstripped  busybox: busybox_unstripped
707    ifeq ($(SKIP_STRIP),y)
708     $(Q)cp $< $@
709    else
710   $(Q)$(STRIP) -s --remove-section=.note --remove-section=.comment \   $(Q)$(STRIP) -s --remove-section=.note --remove-section=.comment \
711   busybox_unstripped -o $@   busybox_unstripped -o $@
712    # strip is confused by PIE executable and does not set exec bits
713     $(Q)chmod a+x $@
714    endif
715    
716  # The actual objects are generated when descending,  # The actual objects are generated when descending,
717  # make sure no implicit rule kicks in  # make sure no implicit rule kicks in
# Line 715  localver = $(subst $(space),, \ Line 754  localver = $(subst $(space),, \
754  # Currently, only git is supported.  # Currently, only git is supported.
755  # Other SCMs can edit scripts/setlocalversion and add the appropriate  # Other SCMs can edit scripts/setlocalversion and add the appropriate
756  # checks as needed.  # checks as needed.
757  ifdef CONFIG_LOCALVERSION_AUTO  ifdef _BB_DISABLED_CONFIG_LOCALVERSION_AUTO
758   _localver-auto = $(shell $(CONFIG_SHELL) \   _localver-auto = $(shell $(CONFIG_SHELL) \
759                    $(srctree)/scripts/setlocalversion $(srctree))                    $(srctree)/scripts/setlocalversion $(srctree))
760   localver-auto  = $(LOCALVERSION)$(_localver-auto)   localver-auto  = $(LOCALVERSION)$(_localver-auto)
# Line 748  PHONY += prepare-all Line 787  PHONY += prepare-all
787  # 2) Create the include2 directory, used for the second asm symlink  # 2) Create the include2 directory, used for the second asm symlink
788  prepare3: .kernelrelease  prepare3: .kernelrelease
789  ifneq ($(KBUILD_SRC),)  ifneq ($(KBUILD_SRC),)
790   @echo '  Using $(srctree) as source for kernel'   @echo '  Using $(srctree) as source for busybox'
791   $(Q)if [ -f $(srctree)/.config ]; then \   $(Q)if [ -f $(srctree)/.config ]; then \
792   echo "  $(srctree) is not clean, please run 'make mrproper'";\   echo "  $(srctree) is not clean, please run 'make mrproper'";\
793   echo "  in the '$(srctree)' directory.";\   echo "  in the '$(srctree)' directory.";\
# Line 767  ifneq ($(KBUILD_MODULES),) Line 806  ifneq ($(KBUILD_MODULES),)
806   $(Q)rm -f $(MODVERDIR)/*   $(Q)rm -f $(MODVERDIR)/*
807  endif  endif
808    
809  archprepare: prepare1 scripts_basic  archprepare: prepare1 scripts_basic applets_dir
810    
811  prepare0: archprepare FORCE  prepare0: archprepare FORCE
812   $(Q)$(MAKE) $(build)=.   $(Q)$(MAKE) $(build)=.
# Line 828  depend dep: Line 867  depend dep:
867  # ---------------------------------------------------------------------------  # ---------------------------------------------------------------------------
868  # Modules  # Modules
869    
870  ifdef CONFIG_MODULES  ifdef _BB_DISABLED_CONFIG_MODULES
871    
872  # By default, build modules as well  # By default, build modules as well
873    
# Line 904  endif # CONFIG_MODULES Line 943  endif # CONFIG_MODULES
943  # make distclean Remove editor backup files, patch leftover files and the like  # make distclean Remove editor backup files, patch leftover files and the like
944    
945  # Directories & files removed with 'make clean'  # Directories & files removed with 'make clean'
946  CLEAN_DIRS  += $(MODVERDIR)  CLEAN_DIRS  += $(MODVERDIR) _install 0_lib
947  CLEAN_FILES += busybox* System.map \  CLEAN_FILES += busybox busybox_unstripped* busybox.links \
948                    System.map .kernelrelease \
949                  .tmp_kallsyms* .tmp_version .tmp_busybox* .tmp_System.map                  .tmp_kallsyms* .tmp_version .tmp_busybox* .tmp_System.map
950    
951  # Directories & files removed with 'make mrproper'  # Directories & files removed with 'make mrproper'
# Line 914  MRPROPER_FILES += .config .config.old in Line 954  MRPROPER_FILES += .config .config.old in
954    include/autoconf.h \    include/autoconf.h \
955    include/bbconfigopts.h \    include/bbconfigopts.h \
956    include/usage_compressed.h \    include/usage_compressed.h \
957    .kernelrelease Module.symvers tags TAGS cscope*    include/applet_tables.h \
958      applets/usage \
959      .kernelrelease Module.symvers tags TAGS cscope* \
960      busybox_old
961    
962  # clean - Delete most, but leave enough to build external modules  # clean - Delete most, but leave enough to build external modules
963  #  #
# Line 930  clean: archclean $(clean-dirs) Line 973  clean: archclean $(clean-dirs)
973   $(call cmd,rmdirs)   $(call cmd,rmdirs)
974   $(call cmd,rmfiles)   $(call cmd,rmfiles)
975   @find . $(RCS_FIND_IGNORE) \   @find . $(RCS_FIND_IGNORE) \
976   \( -name '*.[oas]' -o -name '*.ko' -o -name '.*.cmd' \   \( -name '*.[oas]' -o -name '*.ko' -o -name '.*.cmd' \
977   -o -name '.*.d' -o -name '.*.tmp' -o -name '*.mod.c' \) \   -o -name '.*.d' -o -name '.*.tmp' -o -name '*.mod.c' \) \
978   -type f -print | xargs rm -f   -type f -print | xargs rm -f
979    
980    PHONY += doc-clean
981    doc-clean: rm-files := docs/busybox.pod \
982      docs/BusyBox.html docs/BusyBox.1 docs/BusyBox.txt
983    doc-clean:
984     $(call cmd,rmfiles)
985    
986  # mrproper - Delete all generated files, including .config  # mrproper - Delete all generated files, including .config
987  #  #
988  mrproper: rm-dirs  := $(wildcard $(MRPROPER_DIRS))  mrproper: rm-dirs  := $(wildcard $(MRPROPER_DIRS))
# Line 954  PHONY += distclean Line 1003  PHONY += distclean
1003    
1004  distclean: mrproper  distclean: mrproper
1005   @find $(srctree) $(RCS_FIND_IGNORE) \   @find $(srctree) $(RCS_FIND_IGNORE) \
1006   \( -name '*.orig' -o -name '*.rej' -o -name '*~' \   \( -name '*.orig' -o -name '*.rej' -o -name '*~' \
1007   -o -name '*.bak' -o -name '#*#' -o -name '.*.orig' \   -o -name '*.bak' -o -name '#*#' -o -name '.*.orig' \
1008   -o -name '.*.rej' -o -size 0 \   -o -name '.*.rej' -o -name '*.tmp' -o -size 0 \
1009   -o -name '*%' -o -name '.*.cmd' -o -name 'core' \) \   -o -name '*%' -o -name '.*.cmd' -o -name 'core' \) \
1010   -type f -print | xargs rm -f   -type f -print | xargs rm -f
1011    
# Line 1060  clean: rm-dirs := $(MODVERDIR) Line 1109  clean: rm-dirs := $(MODVERDIR)
1109  clean: $(clean-dirs)  clean: $(clean-dirs)
1110   $(call cmd,rmdirs)   $(call cmd,rmdirs)
1111   @find $(KBUILD_EXTMOD) $(RCS_FIND_IGNORE) \   @find $(KBUILD_EXTMOD) $(RCS_FIND_IGNORE) \
1112   \( -name '*.[oas]' -o -name '*.ko' -o -name '.*.cmd' \   \( -name '*.[oas]' -o -name '*.ko' -o -name '.*.cmd' \
1113   -o -name '.*.d' -o -name '.*.tmp' -o -name '*.mod.c' \) \   -o -name '.*.d' -o -name '.*.tmp' -o -name '*.mod.c' \) \
1114   -type f -print | xargs rm -f   -type f -print | xargs rm -f
1115    

Legend:
Removed from v.532  
changed lines
  Added in v.984