-
-PROG=busybox
-VERSION=0.36
-BUILDTIME=$(shell date "+%Y%m%d-%H%M")
-
-# Comment out the following to make a debuggable build
-# Leave this off for production use.
-DODEBUG=false
-# If you want a static binary, turn this on. I can't think
-# of many situations where anybody would ever want it static,
-# but...
-DOSTATIC=false
-
-#This will choke on a non-debian system
-ARCH=`uname -m | sed -e 's/i.86/i386/' | sed -e 's/sparc.*/sparc/'`
-
-GCCMAJVERSION=`$(CC) --version | sed -n "s/^\([0-9]\)\.\([0-9].*\)[\.].*/\1/p"`
-GCCMINVERSION=`$(CC) --version | sed -n "s/^\([0-9]\)\.\([0-9].*\)[\.].*/\2/p"`
-
-GCCSUPPORTSOPTSIZE=$(shell \
-if ( test $(GCCMAJVERSION) -eq 2 ) ; then \
- if ( test $(GCCMINVERSION) -ge 95 ) ; then \
- echo "true"; \
- else \
- echo "false"; \
- fi; \
-else \
- if ( test $(GCCMAJVERSION) -gt 2 ) ; then \
- echo "true"; \
- else \
- echo "false"; \
- fi; \
-fi; )
-
-
-ifeq ($(GCCSUPPORTSOPTSIZE), true)
- OPTIMIZATION=-Os
-else
- OPTIMIZATION=-O2
+PROG := busybox
+VERSION := 0.47pre
+BUILDTIME := $(shell TZ=UTC date --utc "+%Y.%m.%d-%H:%M%z")
+export VERSION
+
+# If you want a static binary, turn this on.
+DOSTATIC = false
+
+# Set the following to `true' to make a debuggable build.
+# Leave this set to `false' for production use.
+# eg: `make DODEBUG=true tests'
+# Do not enable this for production builds...
+DODEBUG = false
+
+# This enables compiling with dmalloc ( http://dmalloc.com/ )
+# which is an excellent public domain mem leak and malloc problem
+# detector. To enable dmalloc, before running busybox you will
+# want to first set up your environment.
+# eg: `export DMALLOC_OPTIONS=debug=0x14f47d83,inter=100,log=logfile`
+# Do not enable this for production builds...
+DODMALLOC = false
+
+# If you are running a cross compiler, you may want to set this
+# to something more interesting...
+CROSS =
+CC = $(CROSS)gcc
+STRIPTOOL = $(CROSS)strip
+
+# To compile vs an alternative libc, you may need to use/adjust
+# the following lines to meet your needs. This is how I make
+# busybox compile with uC-Libc...
+#LIBCDIR=/home/andersen/CVS/uC-libc
+#GCCINCDIR = $(shell gcc -print-search-dirs | sed -ne "s/install: \(.*\)/\1include/gp")
+#CFLAGS+=-nostdinc -fno-builtin -I$(LIBCDIR)/include -I$(GCCINCDIR)
+#LDFLAGS+=-nostdlib
+#LIBRARIES = $(LIBCDIR)/libc.a
+
+#--------------------------------------------------------
+
+# use '-Os' optimization if available, else use -O2
+OPTIMIZATION = $(shell if $(CC) -Os -S -o /dev/null -xc /dev/null >/dev/null 2>&1; \
+ then echo "-Os"; else echo "-O2" ; fi)
+
+WARNINGS = -Wall
+
+ifeq ($(DODMALLOC),true)
+ # For testing mem leaks with dmalloc
+ CFLAGS+=-DDMALLOC
+ LIBRARIES = -ldmalloc
+ # Force debug=true, since this is useless when not debugging...
+ DODEBUG = true