Make cin be static
[oweals/busybox.git] / Makefile
index 5faac87d64027e0eb991c19299c41c49b4ace678..285f3ab66620871919ded3fd9c3875372c7376f6 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -19,7 +19,7 @@
 #
 
 PROG      := busybox
-VERSION   := 0.48pre
+VERSION   := 0.49pre
 BUILDTIME := $(shell TZ=UTC date --utc "+%Y.%m.%d-%H:%M%z")
 export VERSION
 
@@ -28,6 +28,11 @@ export VERSION
 # overridden at the command line.  For example:
 #   make CROSS=powerpc-linux- BB_SRC_DIR=$HOME/busybox PREFIX=/mnt/app
 
+# If you want to add some simple compiler switches (like -march=i686),
+# especially from the command line, use this instead of CFLAGS directly.
+# For optimization overrides, it's better still to set OPTIMIZATION.
+CFLAGS_EXTRA =
 # If you want a static binary, turn this on.
 DOSTATIC = false
 
@@ -35,7 +40,7 @@ DOSTATIC = false
 # Leave this set to `false' for production use.
 # eg: `make DODEBUG=true tests'
 # Do not enable this for production builds...
-DODEBUG = true
+DODEBUG = false
 
 # This enables compiling with dmalloc ( http://dmalloc.com/ )
 # which is an excellent public domain mem leak and malloc problem
@@ -67,12 +72,21 @@ 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 -I$(LIBCDIR)/include -I$(GCCINCDIR)
+# busybox compile staticly with uClibc (needs BB_FEATURE_NFSMOUNT
+# disabled at the moment).  Note the _full_ path for LIBCDIR.
+# This is because make doesn't do ~ expansion...
+#LIBCDIR=/home/andersen/CVS/uClibc
 #LDFLAGS+=-nostdlib
 #LIBRARIES = $(LIBCDIR)/libc.a -lgcc
+#CROSS_CFLAGS+=-nostdinc -I$(LIBCDIR)/include -I$(GCCINCDIR)
+#GCCINCDIR = $(shell gcc -print-search-dirs | sed -ne "s/install: \(.*\)/\1include/gp")
+
+# This is how I compile with the uClibc shared lib...
+#LIBCDIR=/home/andersen/CVS/uClibc
+#LDFLAGS+=-nostdlib
+#LIBRARIES = -luClibc -lgcc $(LIBCDIR)/crt0.o
+#CROSS_CFLAGS+=-nostdinc -I$(LIBCDIR)/include -I$(GCCINCDIR)
+#GCCINCDIR = $(shell gcc -print-search-dirs | sed -ne "s/install: \(.*\)/\1include/gp")
 
 #--------------------------------------------------------
 
@@ -93,14 +107,13 @@ ifeq ($(DODMALLOC),true)
     # Force debug=true, since this is useless when not debugging...
     DODEBUG = true
 endif
-# -D_GNU_SOURCE is needed because environ is used in init.c
 ifeq ($(DODEBUG),true)
-    CFLAGS += $(WARNINGS) -g -D_GNU_SOURCE
-    LDFLAGS += 
-    STRIP   =
+    CFLAGS  += $(WARNINGS) -g -D_GNU_SOURCE
+    LDFLAGS += -Wl,-warn-common
+    STRIP    =
 else
     CFLAGS  += $(WARNINGS) $(OPTIMIZATION) -fomit-frame-pointer -D_GNU_SOURCE
-    LDFLAGS  += -s
+    LDFLAGS += -s -Wl,-warn-common
     STRIP    = $(STRIPTOOL) --remove-section=.note --remove-section=.comment $(PROG)
 endif
 ifeq ($(DOSTATIC),true)
@@ -135,7 +148,7 @@ else
     VPATH = .:$(BB_SRC_DIR)
     CONFIG_LIST = $(addsuffix /Config.h,$(subst :, ,$(VPATH)))
     CONFIG_H    = $(word 1,$(shell ls -f -1 $(CONFIG_LIST) 2>/dev/null))
-    CFLAGS += -I- $(patsubst %,-I%,$(subst :, ,$(VPATH)))
+    CFLAGS += -I- $(patsubst %,-I%,$(subst :, ,$(VPATH))) $(CROSS_CFLAGS)
 endif
 
 OBJECTS   = $(shell $(BB_SRC_DIR)/busybox.sh $(CONFIG_H) $(BB_SRC_DIR)) busybox.o messages.o usage.o utility.o
@@ -145,6 +158,9 @@ ifdef BB_INIT_SCRIPT
     CFLAGS += -DINIT_SCRIPT='"$(BB_INIT_SCRIPT)"'
 endif
 
+# Put user-supplied flags at the end, where they
+# have a chance of winning.
+CFLAGS += $(CFLAGS_EXTRA)
 
 all: busybox busybox.links doc
 
@@ -208,11 +224,11 @@ busybox: $(OBJECTS)
        $(CC) $(LDFLAGS) -o $@ $^ $(LIBRARIES)
        $(STRIP)
 
-busybox.links: Config.h
+busybox.links: Config.h applets.h
        - $(BB_SRC_DIR)/busybox.mkll $(CONFIG_H) $(BB_SRC_DIR)/applets.h >$@
 
 nfsmount.o cmdedit.o: %.o: %.h
-$(OBJECTS): %.o: %.c Config.h busybox.h Makefile
+$(OBJECTS): %.o: %.c Config.h busybox.h applets.h Makefile
 
 utility.o: loop.h
 
@@ -228,6 +244,7 @@ clean:
            docs/busybox.lineo.com/BusyBox.html
        - rm -f docs/busybox.txt docs/busybox.dvi docs/busybox.ps \
            docs/busybox.pdf docs/busybox.lineo.com/busybox.html
+       - rm -f Config.h.ORG bb.def.h busybox.REGRESS.sh.results bb.OptionsAndFeatures
        - rm -rf docs/busybox _install
        - rm -f busybox.links loop.h *~ *.o core