summaryrefslogtreecommitdiff
path: root/Rules.mak
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2002-12-05 08:41:41 +0000
committerEric Andersen <andersen@codepoet.org>2002-12-05 08:41:41 +0000
commitc9f20d9fb93c6c316518483fd103f3afab5cf1af (patch)
tree72904548bb54dcaf78017d3b35296765437e0bd5 /Rules.mak
parentdeca106b6dad70ad0a1312a82d762aa8d8ad52ba (diff)
downloadbusybox-w32-c9f20d9fb93c6c316518483fd103f3afab5cf1af.tar.gz
busybox-w32-c9f20d9fb93c6c316518483fd103f3afab5cf1af.tar.bz2
busybox-w32-c9f20d9fb93c6c316518483fd103f3afab5cf1af.zip
Yet another major rework of the BusyBox config system, using the considerably
modified Kbuild system I put into uClibc. With this, there should be no more need to modify Rules.mak since I've moved all the interesting options into the config system. I think I've got everything updated, but you never know, I may have made some mistakes, so watch closely. -Erik
Diffstat (limited to 'Rules.mak')
-rw-r--r--Rules.mak116
1 files changed, 46 insertions, 70 deletions
diff --git a/Rules.mak b/Rules.mak
index 56c4025b2..58c03b6e8 100644
--- a/Rules.mak
+++ b/Rules.mak
@@ -17,68 +17,25 @@
17# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18# 18#
19 19
20#--------------------------------------------------------
20PROG := busybox 21PROG := busybox
21VERSION := 0.61.pre 22VERSION := 0.61.pre
22BUILDTIME := $(shell TZ=UTC date -u "+%Y.%m.%d-%H:%M%z") 23BUILDTIME := $(shell TZ=UTC date -u "+%Y.%m.%d-%H:%M%z")
23HOSTCC := gcc
24HOSTCFLAGS:= -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer
25 24
26 25
27# What OS are you compiling busybox for? This allows you to include 26#--------------------------------------------------------
28# OS specific things, syscall overrides, etc.
29TARGET_OS:=linux
30
31# With a modern GNU make(1) (highly recommended, that's what all the 27# With a modern GNU make(1) (highly recommended, that's what all the
32# developers use), all of the following configuration values can be 28# developers use), all of the following configuration values can be
33# overridden at the command line. For example: 29# overridden at the command line. For example:
34# make CROSS=powerpc-linux- BB_SRC_DIR=$HOME/busybox PREFIX=/mnt/app 30# make CROSS=powerpc-linux- BB_SRC_DIR=$HOME/busybox PREFIX=/mnt/app
31#--------------------------------------------------------
35 32
36# If you want to add some simple compiler switches (like -march=i686), 33# If you are running a cross compiler, you will want to set 'CROSS'
37# especially from the command line, use this instead of CFLAGS directly. 34# to something more interesting... Target architecture is determined
38# For optimization overrides, it's better still to set OPTIMIZATION. 35# by asking the CC compiler what arch it compiles things for, so unless
39CFLAGS_EXTRA:=#-Werror 36# your compiler is broken, you should not need to specify TARGET_ARCH
40 37CROSS =$(subst ",, $(strip $(CROSS_COMPILER_PREFIX)))
41# If you want a static binary, turn this on. 38CC = $(CROSS)gcc
42DOSTATIC:=false
43
44# Set the following to `true' to make a debuggable build.
45# Leave this set to `false' for production use.
46DODEBUG:=false
47
48# This enables compiling with dmalloc ( http://dmalloc.com/ )
49# which is an excellent public domain mem leak and malloc problem
50# detector. To enable dmalloc, before running busybox you will
51# want to first set up your environment.
52# eg: `export DMALLOC_OPTIONS=debug=0x34f47d83,inter=100,log=logfile`
53# The debug= value is generated using the following command
54# dmalloc -p log-stats -p log-non-free -p log-bad-space -p log-elapsed-time \
55# -p check-fence -p check-heap -p check-lists -p check-blank \
56# -p check-funcs -p realloc-copy -p allow-free-null
57# Do not enable this for production builds...
58DODMALLOC:=false
59
60# Electric-fence is another very useful malloc debugging library.
61# Do not enable this for production builds...
62DOEFENCE:=false
63
64# If you want large file summit support, turn this on.
65# This has no effect if you don't have a kernel with lfs
66# support, and a system with libc-2.1.3 or later.
67# Some of the programs that can benefit from lfs support
68# are dd, gzip, mount, tar, and mkfs_minix.
69# LFS allows you to use the above programs for files
70# larger than 2GB!
71DOLFS:=false
72
73# If you have a "pristine" source directory, point BB_SRC_DIR to it.
74# Experimental and incomplete; tell the mailing list
75# <busybox@busybox.net> if you do or don't like it so far.
76BB_SRC_DIR:=
77
78# If you are running a cross compiler, you may want to set CROSS
79# to something more interesting, like "arm-linux-".
80CROSS:=
81CC := $(CROSS)gcc
82AR := $(CROSS)ar 39AR := $(CROSS)ar
83AS := $(CROSS)as 40AS := $(CROSS)as
84LD := $(CROSS)ld 41LD := $(CROSS)ld
@@ -86,12 +43,24 @@ NM := $(CROSS)nm
86STRIP := $(CROSS)strip 43STRIP := $(CROSS)strip
87CPP := $(CC) -E 44CPP := $(CC) -E
88MAKEFILES := $(TOPDIR).config 45MAKEFILES := $(TOPDIR).config
89export VERSION BUILDTIME TOPDIR HOSTCC HOSTCFLAGS CROSS CC AR AS LD NM STRIP CPP
90 46
47# What OS are you compiling busybox for? This allows you to include
48# OS specific things, syscall overrides, etc.
49TARGET_OS:=linux
50
51# Select the compiler needed to build binaries for your development system
52HOSTCC := gcc
53HOSTCFLAGS:= -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer
91 54
92# To compile vs uClibc, just use the compiler wrapper built by uClibc... 55# If you want to add some simple compiler switches (like -march=i686),
93# Everything should compile and work as expected these days... 56# especially from the command line, use this instead of CFLAGS directly.
94#CC:=/usr/i386-linux-uclibc/bin/i386-uclibc-gcc 57# For optimization overrides, it's better still to set OPTIMIZATION.
58CFLAGS_EXTRA=$(subst ",, $(strip $(EXTRA_CFLAGS_OPTIONS)))
59
60# If you have a "pristine" source directory, point BB_SRC_DIR to it.
61# Experimental and incomplete; tell the mailing list
62# <busybox@busybox.net> if you do or don't like it so far.
63BB_SRC_DIR:=
95 64
96# To compile vs some other alternative libc, you may need to use/adjust 65# To compile vs some other alternative libc, you may need to use/adjust
97# the following lines to meet your needs... 66# the following lines to meet your needs...
@@ -115,7 +84,10 @@ WARNINGS:=-Wall -Wstrict-prototypes -Wshadow
115CFLAGS:=-I$(TOPDIR)include 84CFLAGS:=-I$(TOPDIR)include
116ARFLAGS:=-r 85ARFLAGS:=-r
117 86
118TARGET_ARCH:=${shell $(CC) -dumpmachine | sed -e s'/-.*//' \ 87#--------------------------------------------------------
88export VERSION BUILDTIME TOPDIR HOSTCC HOSTCFLAGS CROSS CC AR AS LD NM STRIP CPP
89ifeq ($(strip $(TARGET_ARCH)),)
90TARGET_ARCH:=$(shell $(CC) -dumpmachine | sed -e s'/-.*//' \
119 -e 's/i.86/i386/' \ 91 -e 's/i.86/i386/' \
120 -e 's/sparc.*/sparc/' \ 92 -e 's/sparc.*/sparc/' \
121 -e 's/arm.*/arm/g' \ 93 -e 's/arm.*/arm/g' \
@@ -123,8 +95,18 @@ TARGET_ARCH:=${shell $(CC) -dumpmachine | sed -e s'/-.*//' \
123 -e 's/ppc/powerpc/g' \ 95 -e 's/ppc/powerpc/g' \
124 -e 's/v850.*/v850/g' \ 96 -e 's/v850.*/v850/g' \
125 -e 's/sh[234]/sh/' \ 97 -e 's/sh[234]/sh/' \
126 -e 's/mips.*/mips/' \ 98 -e 's/mips-.*/mips/' \
127 } 99 -e 's/mipsel-.*/mipsel/' \
100 -e 's/cris.*/cris/' \
101 )
102endif
103
104# Pull in the user's uClibc configuration
105ifeq ($(filter $(noconfig_targets),$(MAKECMDGOALS)),)
106include_config := 1
107-include $(TOPDIR).config
108endif
109
128# A nifty macro to make testing gcc features easier 110# A nifty macro to make testing gcc features easier
129check_gcc=$(shell if $(CC) $(1) -S -o /dev/null -xc /dev/null > /dev/null 2>&1; \ 111check_gcc=$(shell if $(CC) $(1) -S -o /dev/null -xc /dev/null > /dev/null 2>&1; \
130 then echo "$(1)"; else echo "$(2)"; fi) 112 then echo "$(1)"; else echo "$(2)"; fi)
@@ -159,24 +141,20 @@ OPTIMIZATIONS:=$(OPTIMIZATION) -fomit-frame-pointer
159# prone to casual user adjustment. 141# prone to casual user adjustment.
160# 142#
161 143
162ifeq ($(strip $(DOLFS)),true) 144ifeq ($(strip $(DOLFS)),y)
163 # For large file summit support 145 # For large file summit support
164 CFLAGS+=-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 146 CFLAGS+=-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64
165endif 147endif
166ifeq ($(strip $(DODMALLOC)),true) 148ifeq ($(strip $(DODMALLOC)),y)
167 # For testing mem leaks with dmalloc 149 # For testing mem leaks with dmalloc
168 CFLAGS+=-DDMALLOC 150 CFLAGS+=-DDMALLOC
169 LIBRARIES:=-ldmalloc 151 LIBRARIES:=-ldmalloc
170 # Force debug=true, since this is useless when not debugging...
171 DODEBUG:=true
172else 152else
173 ifeq ($(strip $(DOEFENCE)),true) 153 ifeq ($(strip $(DOEFENCE)),y)
174 LIBRARIES:=-lefence 154 LIBRARIES:=-lefence
175 # Force debug=true, since this is useless when not debugging...
176 DODEBUG:=true
177 endif 155 endif
178endif 156endif
179ifeq ($(strip $(DODEBUG)),true) 157ifeq ($(strip $(DODEBUG)),y)
180 CFLAGS +=$(WARNINGS) -g -D_GNU_SOURCE 158 CFLAGS +=$(WARNINGS) -g -D_GNU_SOURCE
181 LDFLAGS +=-Wl,-warn-common 159 LDFLAGS +=-Wl,-warn-common
182 STRIPCMD:=/bin/true -Not_stripping_since_we_are_debugging 160 STRIPCMD:=/bin/true -Not_stripping_since_we_are_debugging
@@ -185,7 +163,7 @@ else
185 LDFLAGS += -s -Wl,-warn-common 163 LDFLAGS += -s -Wl,-warn-common
186 STRIPCMD:=$(STRIP) --remove-section=.note --remove-section=.comment 164 STRIPCMD:=$(STRIP) --remove-section=.note --remove-section=.comment
187endif 165endif
188ifeq ($(strip $(DOSTATIC)),true) 166ifeq ($(strip $(DOSTATIC)),y)
189 LDFLAGS += --static 167 LDFLAGS += --static
190endif 168endif
191 169
@@ -203,8 +181,6 @@ ifneq ($(strip $(BB_SRC_DIR)),)
203 VPATH:=$(BB_SRC_DIR) 181 VPATH:=$(BB_SRC_DIR)
204endif 182endif
205 183
206CFLAGS += -DBB_VER='"$(VERSION)"'
207CFLAGS += -DBB_BT='"$(BUILDTIME)"'
208OBJECTS:=$(APPLET_SOURCES:.c=.o) busybox.o usage.o applets.o 184OBJECTS:=$(APPLET_SOURCES:.c=.o) busybox.o usage.o applets.o
209CFLAGS += $(CROSS_CFLAGS) 185CFLAGS += $(CROSS_CFLAGS)
210ifdef BB_INIT_SCRIPT 186ifdef BB_INIT_SCRIPT