ash: fix mishandling of bash-style redirects
[oweals/busybox.git] / Makefile
index 78c701ec059f9cd9fefbc8c1acb17b944ca96b38..3a49a6971776d7cb88d239ab631b260482226f85 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
 VERSION = 1
-PATCHLEVEL = 11
+PATCHLEVEL = 16
 SUBLEVEL = 0
-EXTRAVERSION = .svn
+EXTRAVERSION = .git
 NAME = Unnamed
 
 # *DOCUMENTATION*
@@ -161,13 +161,14 @@ export srctree objtree VPATH TOPDIR
 # Default value for CROSS_COMPILE is not to prefix executables
 # Note: Some architectures assign CROSS_COMPILE in their arch/*/Makefile
 
-CROSS_COMPILE  ?=
+CROSS_COMPILE ?=
 # bbox: we may have CONFIG_CROSS_COMPILER_PREFIX in .config,
 # and it has not been included yet... thus using an awkward syntax.
 ifeq ($(CROSS_COMPILE),)
 CROSS_COMPILE := $(shell grep ^CONFIG_CROSS_COMPILER_PREFIX .config 2>/dev/null)
 CROSS_COMPILE := $(subst CONFIG_CROSS_COMPILER_PREFIX=,,$(CROSS_COMPILE))
 CROSS_COMPILE := $(subst ",,$(CROSS_COMPILE))
+#")
 endif
 
 # SUBARCH tells the usermode build what the underlying arch is.  That is set
@@ -186,8 +187,7 @@ SUBARCH := $(shell echo $(SUBARCH) | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ \
                                         -e s/s390x/s390/ -e s/parisc64/parisc/ \
                                         -e s/ppc.*/powerpc/ -e s/mips.*/mips/ )
 
-ARCH           ?= $(SUBARCH)
-$(warning ARCH=$(ARCH) SUBARCH=$(SUBARCH))
+ARCH ?= $(SUBARCH)
 
 # Architecture as present in compile.h
 UTS_MACHINE := $(ARCH)
@@ -316,6 +316,8 @@ AFLAGS_KERNEL       =
 # Use LINUXINCLUDE when you must reference the include/ directory.
 # Needed to be compatible with the O= option
 CFLAGS         := $(CFLAGS)
+# Added only to final link stage of busybox binary
+CFLAGS_busybox := $(CFLAGS_busybox)
 CPPFLAGS       := $(CPPFLAGS)
 AFLAGS         := $(AFLAGS)
 LDFLAGS                := $(LDFLAGS)
@@ -356,6 +358,15 @@ scripts_basic:
 # To avoid any implicit rule to kick in, define an empty command.
 scripts/basic/%: scripts_basic ;
 
+# bbox: we have helpers in applets/
+# we depend on scripts_basic, since scripts/basic/fixdep
+# must be built before any other host prog
+PHONY += applets_dir
+applets_dir: scripts_basic
+       $(Q)$(MAKE) $(build)=applets
+
+applets/%: applets_dir ;
+
 PHONY += outputmakefile
 # outputmakefile generates a Makefile in the output directory, if using a
 # separate output directory. This allows convenient use of make in the
@@ -455,6 +466,7 @@ libs-y              := \
                libbb/ \
                libpwdgrp/ \
                loginutils/ \
+               mailutils/ \
                miscutils/ \
                modutils/ \
                networking/ \
@@ -504,7 +516,7 @@ endif
 # command line.
 # This allow a user to issue only 'make' to build a kernel including modules
 # Defaults busybox but it is usually overridden in the arch makefile
-all: busybox
+all: busybox doc
 
 -include $(srctree)/arch/$(ARCH)/Makefile
 
@@ -581,7 +593,7 @@ quiet_cmd_busybox__ ?= LINK    $@
       cmd_busybox__ ?= $(srctree)/scripts/trylink \
       "$@" \
       "$(CC)" \
-      "$(CFLAGS)" \
+      "$(CFLAGS) $(CFLAGS_busybox)" \
       "$(LDFLAGS) $(EXTRA_LDFLAGS)" \
       "$(core-y)" \
       "$(libs-y)" \
@@ -697,6 +709,8 @@ ifeq ($(SKIP_STRIP),y)
 else
        $(Q)$(STRIP) -s --remove-section=.note --remove-section=.comment \
                busybox_unstripped -o $@
+# strip is confused by PIE executable and does not set exec bits
+       $(Q)chmod a+x $@
 endif
 
 # The actual objects are generated when descending,
@@ -792,7 +806,7 @@ ifneq ($(KBUILD_MODULES),)
        $(Q)rm -f $(MODVERDIR)/*
 endif
 
-archprepare: prepare1 scripts_basic
+archprepare: prepare1 scripts_basic applets_dir
 
 prepare0: archprepare FORCE
        $(Q)$(MAKE) $(build)=.
@@ -929,8 +943,9 @@ endif # CONFIG_MODULES
 # make distclean Remove editor backup files, patch leftover files and the like
 
 # Directories & files removed with 'make clean'
-CLEAN_DIRS  += $(MODVERDIR)
-CLEAN_FILES += busybox* System.map .kernelrelease \
+CLEAN_DIRS  += $(MODVERDIR) _install 0_lib
+CLEAN_FILES += busybox busybox_unstripped* busybox.links \
+                System.map .kernelrelease \
                 .tmp_kallsyms* .tmp_version .tmp_busybox* .tmp_System.map
 
 # Directories & files removed with 'make mrproper'
@@ -941,7 +956,8 @@ MRPROPER_FILES += .config .config.old include/asm .version .old_version \
                  include/usage_compressed.h \
                  include/applet_tables.h \
                  applets/usage \
-                 .kernelrelease Module.symvers tags TAGS cscope*
+                 .kernelrelease Module.symvers tags TAGS cscope* \
+                 busybox_old
 
 # clean - Delete most, but leave enough to build external modules
 #
@@ -957,10 +973,16 @@ clean: archclean $(clean-dirs)
        $(call cmd,rmdirs)
        $(call cmd,rmfiles)
        @find . $(RCS_FIND_IGNORE) \
-               \( -name '*.[oas]' -o -name '*.ko' -o -name '.*.cmd' \
+               \( -name '*.[oas]' -o -name '*.ko' -o -name '.*.cmd' \
                -o -name '.*.d' -o -name '.*.tmp' -o -name '*.mod.c' \) \
                -type f -print | xargs rm -f
 
+PHONY += doc-clean
+doc-clean: rm-files := docs/busybox.pod \
+                 docs/BusyBox.html docs/BusyBox.1 docs/BusyBox.txt
+doc-clean:
+       $(call cmd,rmfiles)
+
 # mrproper - Delete all generated files, including .config
 #
 mrproper: rm-dirs  := $(wildcard $(MRPROPER_DIRS))
@@ -981,9 +1003,9 @@ PHONY += distclean
 
 distclean: mrproper
        @find $(srctree) $(RCS_FIND_IGNORE) \
-               \( -name '*.orig' -o -name '*.rej' -o -name '*~' \
+               \( -name '*.orig' -o -name '*.rej' -o -name '*~' \
                -o -name '*.bak' -o -name '#*#' -o -name '.*.orig' \
-               -o -name '.*.rej' -o -name '*.tmp' -o -size 0 \
+               -o -name '.*.rej' -o -name '*.tmp' -o -size 0 \
                -o -name '*%' -o -name '.*.cmd' -o -name 'core' \) \
                -type f -print | xargs rm -f
 
@@ -1087,7 +1109,7 @@ clean:    rm-dirs := $(MODVERDIR)
 clean: $(clean-dirs)
        $(call cmd,rmdirs)
        @find $(KBUILD_EXTMOD) $(RCS_FIND_IGNORE) \
-               \( -name '*.[oas]' -o -name '*.ko' -o -name '.*.cmd' \
+               \( -name '*.[oas]' -o -name '*.ko' -o -name '.*.cmd' \
                -o -name '.*.d' -o -name '.*.tmp' -o -name '*.mod.c' \) \
                -type f -print | xargs rm -f