Magellan Linux

Diff of /trunk/mkinitrd-magellan/busybox/Makefile

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

revision 815 by niro, Sat Sep 1 22:45:15 2007 UTC revision 816 by niro, Fri Apr 24 18:33:46 2009 UTC
# Line 1  Line 1 
1  VERSION = 1  VERSION = 1
2  PATCHLEVEL = 4  PATCHLEVEL = 13
3  SUBLEVEL = 2  SUBLEVEL = 4
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    endif
172    
173    # SUBARCH tells the usermode build what the underlying arch is.  That is set
174    # first, and if a usermode build is happening, the "ARCH=um" on the command
175    # line overrides the setting of ARCH below.  If a native build is happening,
176    # then ARCH is assigned, getting whatever value it gets normally, and
177    # SUBARCH is subsequently ignored.
178    
179    ifneq ($(CROSS_COMPILE),)
180    SUBARCH := $(shell echo $(CROSS_COMPILE) | cut -d- -f1)
181    else
182    SUBARCH := $(shell uname -m)
183    endif
184    SUBARCH := $(shell echo $(SUBARCH) | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ \
185     -e s/arm.*/arm/ -e s/sa110/arm/ \
186     -e s/s390x/s390/ -e s/parisc64/parisc/ \
187     -e s/ppc.*/powerpc/ -e s/mips.*/mips/ )
188    
189    ARCH ?= $(SUBARCH)
190    
191  # Architecture as present in compile.h  # Architecture as present in compile.h
192  UTS_MACHINE := $(ARCH)  UTS_MACHINE := $(ARCH)
# Line 183  CONFIG_SHELL := $(shell if [ -x "$$BASH" Line 196  CONFIG_SHELL := $(shell if [ -x "$$BASH"
196    else if [ -x /bin/bash ]; then echo /bin/bash; \    else if [ -x /bin/bash ]; then echo /bin/bash; \
197    else echo sh; fi ; fi)    else echo sh; fi ; fi)
198    
 HOSTCC   = gcc  
 HOSTCXX   = g++  
 HOSTCFLAGS = -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer  
 HOSTCXXFLAGS = -O2  
   
199  # Decide whether to build built-in, modular, or both.  # Decide whether to build built-in, modular, or both.
200  # Normally, just do built-in.  # Normally, just do built-in.
201    
# Line 262  export quiet Q KBUILD_VERBOSE Line 270  export quiet Q KBUILD_VERBOSE
270  # Look for make include files relative to root of kernel src  # Look for make include files relative to root of kernel src
271  MAKEFLAGS += --include-dir=$(srctree)  MAKEFLAGS += --include-dir=$(srctree)
272    
273    HOSTCC   = gcc
274    HOSTCXX   = g++
275    HOSTCFLAGS :=
276    HOSTCXXFLAGS :=
277  # We need some generic definitions  # We need some generic definitions
278  include $(srctree)/scripts/Kbuild.include  include $(srctree)/scripts/Kbuild.include
279    
280    HOSTCFLAGS += $(call hostcc-option,-Wall -Wstrict-prototypes -O2 -fomit-frame-pointer,)
281    HOSTCXXFLAGS += -O2
282    
283  # For maximum performance (+ possibly random breakage, uncomment  # For maximum performance (+ possibly random breakage, uncomment
284  # the following)  # the following)
285    
# Line 299  AFLAGS_KERNEL = Line 314  AFLAGS_KERNEL =
314    
315  # Use LINUXINCLUDE when you must reference the include/ directory.  # Use LINUXINCLUDE when you must reference the include/ directory.
316  # Needed to be compatible with the O= option  # Needed to be compatible with the O= option
317  CFLAGS :=  CFLAGS := $(CFLAGS)
318  CPPFLAGS :=  # Added only to final link stage of busybox binary
319  AFLAGS :=  CFLAGS_busybox := $(CFLAGS_busybox)
320    CPPFLAGS := $(CPPFLAGS)
321    AFLAGS := $(AFLAGS)
322    LDFLAGS := $(LDFLAGS)
323    LDLIBS :=
324    
325  # Read KERNELRELEASE from .kernelrelease (if it exists)  # Read KERNELRELEASE from .kernelrelease (if it exists)
326  KERNELRELEASE = $(shell cat .kernelrelease 2> /dev/null)  KERNELRELEASE = $(shell cat .kernelrelease 2> /dev/null)
# Line 315  export VERSION PATCHLEVEL SUBLEVEL KERNE Line 334  export VERSION PATCHLEVEL SUBLEVEL KERNE
334  export CPPFLAGS NOSTDINC_FLAGS LINUXINCLUDE OBJCOPYFLAGS LDFLAGS  export CPPFLAGS NOSTDINC_FLAGS LINUXINCLUDE OBJCOPYFLAGS LDFLAGS
335  export CFLAGS CFLAGS_KERNEL CFLAGS_MODULE  export CFLAGS CFLAGS_KERNEL CFLAGS_MODULE
336  export AFLAGS AFLAGS_KERNEL AFLAGS_MODULE  export AFLAGS AFLAGS_KERNEL AFLAGS_MODULE
337    export FLTFLAGS
338    
339  # When compiling out-of-tree modules, put MODVERDIR in the module  # When compiling out-of-tree modules, put MODVERDIR in the module
340  # tree rather than in the kernel tree. The kernel tree might  # tree rather than in the kernel tree. The kernel tree might
# Line 356  endif Line 376  endif
376  # 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).
377    
378  no-dot-config-targets := clean mrproper distclean \  no-dot-config-targets := clean mrproper distclean \
379   cscope TAGS tags help %docs check%   cscope TAGS tags help %docs
380    #bbox# check% is removed from above
381    
382  config-targets := 0  config-targets := 0
383  mixed-targets  := 0  mixed-targets  := 0
# Line 435  libs-y := \ Line 456  libs-y := \
456   libbb/ \   libbb/ \
457   libpwdgrp/ \   libpwdgrp/ \
458   loginutils/ \   loginutils/ \
459     mailutils/ \
460   miscutils/ \   miscutils/ \
461   modutils/ \   modutils/ \
462   networking/ \   networking/ \
463   networking/libiproute/ \   networking/libiproute/ \
464   networking/udhcp/ \   networking/udhcp/ \
465     printutils/ \
466   procps/ \   procps/ \
467   runit/ \   runit/ \
468     selinux/ \
469   shell/ \   shell/ \
470   sysklogd/ \   sysklogd/ \
471   util-linux/ \   util-linux/ \
472     util-linux/volume_id/ \
473    
474  endif # KBUILD_EXTMOD  endif # KBUILD_EXTMOD
475    
# Line 480  endif Line 505  endif
505  # 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
506  # command line.  # command line.
507  # 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
508  # Defaults busybox but it is usually overriden in the arch makefile  # Defaults busybox but it is usually overridden in the arch makefile
509  all: busybox  all: busybox doc
510    
511  -include $(srctree)/arch/$(ARCH)/Makefile  -include $(srctree)/arch/$(ARCH)/Makefile
512    
# Line 489  all: busybox Line 514  all: busybox
514  #bbox# NOSTDINC_FLAGS += -nostdinc -isystem $(shell $(CC) -print-file-name=include)  #bbox# NOSTDINC_FLAGS += -nostdinc -isystem $(shell $(CC) -print-file-name=include)
515  CHECKFLAGS += $(NOSTDINC_FLAGS)  CHECKFLAGS += $(NOSTDINC_FLAGS)
516    
 # 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,)  
   
517  # Default kernel image to build when no specific target is given.  # Default kernel image to build when no specific target is given.
518  # KBUILD_IMAGE may be overruled on the commandline or  # KBUILD_IMAGE may be overruled on the commandline or
519  # set in the environment  # set in the environment
# Line 561  busybox-all  := $(core-y) $(libs-y) Line 580  busybox-all  := $(core-y) $(libs-y)
580  # Rule to link busybox - also used during CONFIG_KALLSYMS  # Rule to link busybox - also used during CONFIG_KALLSYMS
581  # May be overridden by arch/$(ARCH)/Makefile  # May be overridden by arch/$(ARCH)/Makefile
582  quiet_cmd_busybox__ ?= LINK    $@  quiet_cmd_busybox__ ?= LINK    $@
583        cmd_busybox__ ?= $(srctree)/scripts/trylink $(CC) $(LDFLAGS) \        cmd_busybox__ ?= $(srctree)/scripts/trylink \
584        -o $@ \        "$@" \
585        -Wl,--warn-common -Wl,--sort-common \        "$(CC)" \
586        -Wl,--start-group $(busybox-all) -Wl,--end-group        "$(CFLAGS) $(CFLAGS_busybox)" \
587          "$(LDFLAGS) $(EXTRA_LDFLAGS)" \
588          "$(core-y)" \
589          "$(libs-y)" \
590          "$(LDLIBS)"
591    
592  # Generate System.map  # Generate System.map
593  quiet_cmd_sysmap = SYSMAP  quiet_cmd_sysmap = SYSMAP
# Line 671  busybox_unstripped: $(busybox-all) FORCE Line 694  busybox_unstripped: $(busybox-all) FORCE
694   $(Q)rm -f .old_version   $(Q)rm -f .old_version
695    
696  busybox: busybox_unstripped  busybox: busybox_unstripped
697    ifeq ($(SKIP_STRIP),y)
698     $(Q)cp $< $@
699    else
700   $(Q)$(STRIP) -s --remove-section=.note --remove-section=.comment \   $(Q)$(STRIP) -s --remove-section=.note --remove-section=.comment \
701   busybox_unstripped -o $@   busybox_unstripped -o $@
702    # strip is confused by PIE executable and does not set exec bits
703     $(Q)chmod a+x $@
704    endif
705    
706  # The actual objects are generated when descending,  # The actual objects are generated when descending,
707  # make sure no implicit rule kicks in  # make sure no implicit rule kicks in
# Line 715  localver = $(subst $(space),, \ Line 744  localver = $(subst $(space),, \
744  # Currently, only git is supported.  # Currently, only git is supported.
745  # Other SCMs can edit scripts/setlocalversion and add the appropriate  # Other SCMs can edit scripts/setlocalversion and add the appropriate
746  # checks as needed.  # checks as needed.
747  ifdef CONFIG_LOCALVERSION_AUTO  ifdef _BB_DISABLED_CONFIG_LOCALVERSION_AUTO
748   _localver-auto = $(shell $(CONFIG_SHELL) \   _localver-auto = $(shell $(CONFIG_SHELL) \
749                    $(srctree)/scripts/setlocalversion $(srctree))                    $(srctree)/scripts/setlocalversion $(srctree))
750   localver-auto  = $(LOCALVERSION)$(_localver-auto)   localver-auto  = $(LOCALVERSION)$(_localver-auto)
# Line 748  PHONY += prepare-all Line 777  PHONY += prepare-all
777  # 2) Create the include2 directory, used for the second asm symlink  # 2) Create the include2 directory, used for the second asm symlink
778  prepare3: .kernelrelease  prepare3: .kernelrelease
779  ifneq ($(KBUILD_SRC),)  ifneq ($(KBUILD_SRC),)
780   @echo '  Using $(srctree) as source for kernel'   @echo '  Using $(srctree) as source for busybox'
781   $(Q)if [ -f $(srctree)/.config ]; then \   $(Q)if [ -f $(srctree)/.config ]; then \
782   echo "  $(srctree) is not clean, please run 'make mrproper'";\   echo "  $(srctree) is not clean, please run 'make mrproper'";\
783   echo "  in the '$(srctree)' directory.";\   echo "  in the '$(srctree)' directory.";\
# Line 828  depend dep: Line 857  depend dep:
857  # ---------------------------------------------------------------------------  # ---------------------------------------------------------------------------
858  # Modules  # Modules
859    
860  ifdef CONFIG_MODULES  ifdef _BB_DISABLED_CONFIG_MODULES
861    
862  # By default, build modules as well  # By default, build modules as well
863    
# Line 904  endif # CONFIG_MODULES Line 933  endif # CONFIG_MODULES
933  # make distclean Remove editor backup files, patch leftover files and the like  # make distclean Remove editor backup files, patch leftover files and the like
934    
935  # Directories & files removed with 'make clean'  # Directories & files removed with 'make clean'
936  CLEAN_DIRS  += $(MODVERDIR)  CLEAN_DIRS  += $(MODVERDIR) _install 0_lib
937  CLEAN_FILES += busybox* System.map \  CLEAN_FILES += busybox busybox_unstripped* busybox.links \
938                    System.map .kernelrelease \
939                  .tmp_kallsyms* .tmp_version .tmp_busybox* .tmp_System.map                  .tmp_kallsyms* .tmp_version .tmp_busybox* .tmp_System.map
940    
941  # Directories & files removed with 'make mrproper'  # Directories & files removed with 'make mrproper'
# Line 914  MRPROPER_FILES += .config .config.old in Line 944  MRPROPER_FILES += .config .config.old in
944    include/autoconf.h \    include/autoconf.h \
945    include/bbconfigopts.h \    include/bbconfigopts.h \
946    include/usage_compressed.h \    include/usage_compressed.h \
947    .kernelrelease Module.symvers tags TAGS cscope*    include/applet_tables.h \
948      applets/usage \
949      .kernelrelease Module.symvers tags TAGS cscope* \
950      busybox_old
951    
952  # clean - Delete most, but leave enough to build external modules  # clean - Delete most, but leave enough to build external modules
953  #  #
# Line 930  clean: archclean $(clean-dirs) Line 963  clean: archclean $(clean-dirs)
963   $(call cmd,rmdirs)   $(call cmd,rmdirs)
964   $(call cmd,rmfiles)   $(call cmd,rmfiles)
965   @find . $(RCS_FIND_IGNORE) \   @find . $(RCS_FIND_IGNORE) \
966   \( -name '*.[oas]' -o -name '*.ko' -o -name '.*.cmd' \   \( -name '*.[oas]' -o -name '*.ko' -o -name '.*.cmd' \
967   -o -name '.*.d' -o -name '.*.tmp' -o -name '*.mod.c' \) \   -o -name '.*.d' -o -name '.*.tmp' -o -name '*.mod.c' \) \
968   -type f -print | xargs rm -f   -type f -print | xargs rm -f
969    
970    PHONY += doc-clean
971    doc-clean: rm-files := docs/busybox.pod \
972      docs/BusyBox.html docs/BusyBox.1 docs/BusyBox.txt
973    doc-clean:
974     $(call cmd,rmfiles)
975    
976  # mrproper - Delete all generated files, including .config  # mrproper - Delete all generated files, including .config
977  #  #
978  mrproper: rm-dirs  := $(wildcard $(MRPROPER_DIRS))  mrproper: rm-dirs  := $(wildcard $(MRPROPER_DIRS))
# Line 954  PHONY += distclean Line 993  PHONY += distclean
993    
994  distclean: mrproper  distclean: mrproper
995   @find $(srctree) $(RCS_FIND_IGNORE) \   @find $(srctree) $(RCS_FIND_IGNORE) \
996   \( -name '*.orig' -o -name '*.rej' -o -name '*~' \   \( -name '*.orig' -o -name '*.rej' -o -name '*~' \
997   -o -name '*.bak' -o -name '#*#' -o -name '.*.orig' \   -o -name '*.bak' -o -name '#*#' -o -name '.*.orig' \
998   -o -name '.*.rej' -o -size 0 \   -o -name '.*.rej' -o -name '*.tmp' -o -size 0 \
999   -o -name '*%' -o -name '.*.cmd' -o -name 'core' \) \   -o -name '*%' -o -name '.*.cmd' -o -name 'core' \) \
1000   -type f -print | xargs rm -f   -type f -print | xargs rm -f
1001    
# Line 1060  clean: rm-dirs := $(MODVERDIR) Line 1099  clean: rm-dirs := $(MODVERDIR)
1099  clean: $(clean-dirs)  clean: $(clean-dirs)
1100   $(call cmd,rmdirs)   $(call cmd,rmdirs)
1101   @find $(KBUILD_EXTMOD) $(RCS_FIND_IGNORE) \   @find $(KBUILD_EXTMOD) $(RCS_FIND_IGNORE) \
1102   \( -name '*.[oas]' -o -name '*.ko' -o -name '.*.cmd' \   \( -name '*.[oas]' -o -name '*.ko' -o -name '.*.cmd' \
1103   -o -name '.*.d' -o -name '.*.tmp' -o -name '*.mod.c' \) \   -o -name '.*.d' -o -name '.*.tmp' -o -name '*.mod.c' \) \
1104   -type f -print | xargs rm -f   -type f -print | xargs rm -f
1105    

Legend:
Removed from v.815  
changed lines
  Added in v.816