diff options
-rw-r--r-- | Makefile | 37 |
1 files changed, 27 insertions, 10 deletions
@@ -26,31 +26,48 @@ export VERSION | |||
26 | # Set the following to `true' to make a debuggable build. | 26 | # Set the following to `true' to make a debuggable build. |
27 | # Leave this set to `false' for production use. | 27 | # Leave this set to `false' for production use. |
28 | # eg: `make DODEBUG=true tests' | 28 | # eg: `make DODEBUG=true tests' |
29 | # Do not enable this for production builds... | ||
29 | DODEBUG = false | 30 | DODEBUG = false |
30 | 31 | ||
32 | # This enables compiling with dmalloc ( http://dmalloc.com/ ) | ||
33 | # which is an excellent public domain mem leak and malloc problem | ||
34 | # detector. To enable dmalloc, before running busybox you will | ||
35 | # want to first set up your environment. | ||
36 | # eg: `export DMALLOC_OPTIONS=debug=0x14f47d83,inter=100,log=logfile` | ||
37 | # Do not enable this for production builds... | ||
38 | DODMALLOC = false | ||
39 | |||
31 | # If you want a static binary, turn this on. | 40 | # If you want a static binary, turn this on. |
32 | DOSTATIC = false | 41 | DOSTATIC = false |
33 | 42 | ||
43 | # If you are running a cross compiler, you may want to set this | ||
44 | # to something more interesting... | ||
45 | CROSS = | ||
46 | CC = $(CROSS)gcc | ||
47 | STRIPTOOL = $(CROSS)strip | ||
48 | |||
34 | # To compile vs an alternative libc, you may need to use/adjust | 49 | # To compile vs an alternative libc, you may need to use/adjust |
35 | # the following lines to meet your needs. This is how I did it... | 50 | # the following lines to meet your needs. This is how I make |
51 | # busybox compile with uC-Libc... | ||
52 | #LIBCDIR=/home/andersen/CVS/uC-libc | ||
36 | #GCCINCDIR = $(shell gcc -print-search-dirs | sed -ne "s/install: \(.*\)/\1include/gp") | 53 | #GCCINCDIR = $(shell gcc -print-search-dirs | sed -ne "s/install: \(.*\)/\1include/gp") |
37 | #CFLAGS+=-nostdinc -fno-builtin -I/home/andersen/CVS/uC-libc/include -I$(GCCINCDIR) | 54 | #CFLAGS+=-nostdinc -fno-builtin -I$(LIBCDIR)/include -I$(GCCINCDIR) |
38 | #LDFLAGS+=-nostdlib | 55 | #LDFLAGS+=-nostdlib |
39 | #LIBRARIES = /home/andersen/CVS/uC-libc/libc.a | 56 | #LIBRARIES = $(LIBCDIR)/libc.a |
40 | |||
41 | 57 | ||
42 | CC = gcc | 58 | #-------------------------------------------------------- |
43 | 59 | ||
44 | # use '-Os' optimization if available, else use -O2 | 60 | # use '-Os' optimization if available, else use -O2 |
45 | OPTIMIZATION = $(shell if $(CC) -Os -S -o /dev/null -xc /dev/null >/dev/null 2>&1; \ | 61 | OPTIMIZATION = $(shell if $(CC) -Os -S -o /dev/null -xc /dev/null >/dev/null 2>&1; \ |
46 | then echo "-Os"; else echo "-O2" ; fi) | 62 | then echo "-Os"; else echo "-O2" ; fi) |
47 | 63 | ||
48 | 64 | ifeq ($(DODMALLOC),true) | |
49 | # Allow alternative stripping tools to be used... | 65 | # For testing mem leaks with dmalloc |
50 | ifndef $(STRIPTOOL) | 66 | CFLAGS+=-DDMALLOC |
51 | STRIPTOOL = strip | 67 | LIBRARIES = -ldmalloc |
68 | # Force debug=true, since this is useless when not debugging... | ||
69 | DODEBUG = true | ||
52 | endif | 70 | endif |
53 | |||
54 | # -D_GNU_SOURCE is needed because environ is used in init.c | 71 | # -D_GNU_SOURCE is needed because environ is used in init.c |
55 | ifeq ($(DODEBUG),true) | 72 | ifeq ($(DODEBUG),true) |
56 | CFLAGS += -Wall -g -D_GNU_SOURCE | 73 | CFLAGS += -Wall -g -D_GNU_SOURCE |