diff options
author | Eric Andersen <andersen@codepoet.org> | 2002-12-05 08:41:41 +0000 |
---|---|---|
committer | Eric Andersen <andersen@codepoet.org> | 2002-12-05 08:41:41 +0000 |
commit | c9f20d9fb93c6c316518483fd103f3afab5cf1af (patch) | |
tree | 72904548bb54dcaf78017d3b35296765437e0bd5 /Rules.mak | |
parent | deca106b6dad70ad0a1312a82d762aa8d8ad52ba (diff) | |
download | busybox-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.mak | 116 |
1 files changed, 46 insertions, 70 deletions
@@ -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 | #-------------------------------------------------------- | ||
20 | PROG := busybox | 21 | PROG := busybox |
21 | VERSION := 0.61.pre | 22 | VERSION := 0.61.pre |
22 | BUILDTIME := $(shell TZ=UTC date -u "+%Y.%m.%d-%H:%M%z") | 23 | BUILDTIME := $(shell TZ=UTC date -u "+%Y.%m.%d-%H:%M%z") |
23 | HOSTCC := gcc | ||
24 | HOSTCFLAGS:= -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. | ||
29 | TARGET_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 |
39 | CFLAGS_EXTRA:=#-Werror | 36 | # your compiler is broken, you should not need to specify TARGET_ARCH |
40 | 37 | CROSS =$(subst ",, $(strip $(CROSS_COMPILER_PREFIX))) | |
41 | # If you want a static binary, turn this on. | 38 | CC = $(CROSS)gcc |
42 | DOSTATIC:=false | ||
43 | |||
44 | # Set the following to `true' to make a debuggable build. | ||
45 | # Leave this set to `false' for production use. | ||
46 | DODEBUG:=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... | ||
58 | DODMALLOC:=false | ||
59 | |||
60 | # Electric-fence is another very useful malloc debugging library. | ||
61 | # Do not enable this for production builds... | ||
62 | DOEFENCE:=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! | ||
71 | DOLFS:=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. | ||
76 | BB_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-". | ||
80 | CROSS:= | ||
81 | CC := $(CROSS)gcc | ||
82 | AR := $(CROSS)ar | 39 | AR := $(CROSS)ar |
83 | AS := $(CROSS)as | 40 | AS := $(CROSS)as |
84 | LD := $(CROSS)ld | 41 | LD := $(CROSS)ld |
@@ -86,12 +43,24 @@ NM := $(CROSS)nm | |||
86 | STRIP := $(CROSS)strip | 43 | STRIP := $(CROSS)strip |
87 | CPP := $(CC) -E | 44 | CPP := $(CC) -E |
88 | MAKEFILES := $(TOPDIR).config | 45 | MAKEFILES := $(TOPDIR).config |
89 | export 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. | ||
49 | TARGET_OS:=linux | ||
50 | |||
51 | # Select the compiler needed to build binaries for your development system | ||
52 | HOSTCC := gcc | ||
53 | HOSTCFLAGS:= -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. |
58 | CFLAGS_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. | ||
63 | BB_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 | |||
115 | CFLAGS:=-I$(TOPDIR)include | 84 | CFLAGS:=-I$(TOPDIR)include |
116 | ARFLAGS:=-r | 85 | ARFLAGS:=-r |
117 | 86 | ||
118 | TARGET_ARCH:=${shell $(CC) -dumpmachine | sed -e s'/-.*//' \ | 87 | #-------------------------------------------------------- |
88 | export VERSION BUILDTIME TOPDIR HOSTCC HOSTCFLAGS CROSS CC AR AS LD NM STRIP CPP | ||
89 | ifeq ($(strip $(TARGET_ARCH)),) | ||
90 | TARGET_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 | ) | ||
102 | endif | ||
103 | |||
104 | # Pull in the user's uClibc configuration | ||
105 | ifeq ($(filter $(noconfig_targets),$(MAKECMDGOALS)),) | ||
106 | include_config := 1 | ||
107 | -include $(TOPDIR).config | ||
108 | endif | ||
109 | |||
128 | # A nifty macro to make testing gcc features easier | 110 | # A nifty macro to make testing gcc features easier |
129 | check_gcc=$(shell if $(CC) $(1) -S -o /dev/null -xc /dev/null > /dev/null 2>&1; \ | 111 | check_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 | ||
162 | ifeq ($(strip $(DOLFS)),true) | 144 | ifeq ($(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 |
165 | endif | 147 | endif |
166 | ifeq ($(strip $(DODMALLOC)),true) | 148 | ifeq ($(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 | ||
172 | else | 152 | else |
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 |
178 | endif | 156 | endif |
179 | ifeq ($(strip $(DODEBUG)),true) | 157 | ifeq ($(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 |
187 | endif | 165 | endif |
188 | ifeq ($(strip $(DOSTATIC)),true) | 166 | ifeq ($(strip $(DOSTATIC)),y) |
189 | LDFLAGS += --static | 167 | LDFLAGS += --static |
190 | endif | 168 | endif |
191 | 169 | ||
@@ -203,8 +181,6 @@ ifneq ($(strip $(BB_SRC_DIR)),) | |||
203 | VPATH:=$(BB_SRC_DIR) | 181 | VPATH:=$(BB_SRC_DIR) |
204 | endif | 182 | endif |
205 | 183 | ||
206 | CFLAGS += -DBB_VER='"$(VERSION)"' | ||
207 | CFLAGS += -DBB_BT='"$(BUILDTIME)"' | ||
208 | OBJECTS:=$(APPLET_SOURCES:.c=.o) busybox.o usage.o applets.o | 184 | OBJECTS:=$(APPLET_SOURCES:.c=.o) busybox.o usage.o applets.o |
209 | CFLAGS += $(CROSS_CFLAGS) | 185 | CFLAGS += $(CROSS_CFLAGS) |
210 | ifdef BB_INIT_SCRIPT | 186 | ifdef BB_INIT_SCRIPT |