diff options
author | Eric Andersen <andersen@codepoet.org> | 2001-02-17 00:42:47 +0000 |
---|---|---|
committer | Eric Andersen <andersen@codepoet.org> | 2001-02-17 00:42:47 +0000 |
commit | 19f86207f5c9cdcd192295e3ac3130a40f180d39 (patch) | |
tree | d84d5ef8a6914a3a2b77c360471d195f0c32a8e2 | |
parent | 69c8572f296380df78a20818ca9208b35b7dbd16 (diff) | |
download | busybox-w32-19f86207f5c9cdcd192295e3ac3130a40f180d39.tar.gz busybox-w32-19f86207f5c9cdcd192295e3ac3130a40f180d39.tar.bz2 busybox-w32-19f86207f5c9cdcd192295e3ac3130a40f180d39.zip |
Update the build system for pristine source directory builds. This
update is primarily work done by Larry Doolittle, but I did some
touchups of my own to make it work for me,
-Erik
-rw-r--r-- | Config.h | 22 | ||||
-rw-r--r-- | Makefile | 129 | ||||
-rwxr-xr-x | applets/busybox.sh | 6 | ||||
-rw-r--r-- | applets/usage.c | 2 | ||||
-rwxr-xr-x | busybox.sh | 6 | ||||
-rwxr-xr-x | libbb/mk_loop_h.sh | 23 | ||||
-rwxr-xr-x | mk_loop_h.sh | 23 | ||||
-rwxr-xr-x | pristine_setup.sh | 39 | ||||
-rw-r--r-- | usage.c | 2 |
9 files changed, 167 insertions, 85 deletions
@@ -142,25 +142,18 @@ | |||
142 | // | 142 | // |
143 | // Turn this on to use Erik's very cool devps, and devmtab kernel drivers, | 143 | // Turn this on to use Erik's very cool devps, and devmtab kernel drivers, |
144 | // thereby eliminating the need for the /proc filesystem and thereby saving | 144 | // thereby eliminating the need for the /proc filesystem and thereby saving |
145 | // lots and lots memory for more important things. You can not use this and | 145 | // lots and lots memory for more important things. NOTE: If you enable this |
146 | // USE_PROCFS at the same time... NOTE: If you enable this feature, you | 146 | // feature, you _must_ have patched the kernel to include the devps patch that |
147 | // _must_ have patched the kernel to include the devps patch that is included | 147 | // is included in the busybox/kernel-patches directory. You will also need to |
148 | // in the busybox/kernel-patches directory. You will also need to create some | 148 | // create some device special files in /dev on your embedded system: |
149 | // device special files in /dev on your embedded system: | ||
150 | // mknod /dev/mtab c 10 22 | 149 | // mknod /dev/mtab c 10 22 |
151 | // mknod /dev/ps c 10 21 | 150 | // mknod /dev/ps c 10 21 |
152 | // I emailed Linus and this patch will not be going into the stock kernel. | 151 | // I emailed Linus and this patch will not be going into the stock kernel. |
153 | //#define BB_FEATURE_USE_DEVPS_PATCH | 152 | //#define BB_FEATURE_USE_DEVPS_PATCH |
154 | // | 153 | // |
155 | // enable features that use the /proc filesystem (apps that | ||
156 | // break without this will tell you on compile)... | ||
157 | // You can't use this and BB_FEATURE_USE_DEVPS_PATCH | ||
158 | // at the same time... | ||
159 | #define BB_FEATURE_USE_PROCFS | ||
160 | // | ||
161 | // This compiles out everything but the most | 154 | // This compiles out everything but the most |
162 | // trivial --help usage information (i.e. reduces binary size) | 155 | // trivial --help usage information (i.e. reduces binary size) |
163 | //#define BB_FEATURE_TRIVIAL_HELP | 156 | #define BB_FEATURE_TRIVIAL_HELP |
164 | // | 157 | // |
165 | // Use termios to manipulate the screen ('more' is prettier with this on) | 158 | // Use termios to manipulate the screen ('more' is prettier with this on) |
166 | #define BB_FEATURE_USE_TERMIOS | 159 | #define BB_FEATURE_USE_TERMIOS |
@@ -198,11 +191,6 @@ | |||
198 | //Have init enable core dumping for child processes (for debugging only) | 191 | //Have init enable core dumping for child processes (for debugging only) |
199 | //#define BB_FEATURE_INIT_COREDUMPS | 192 | //#define BB_FEATURE_INIT_COREDUMPS |
200 | // | 193 | // |
201 | // Allow init to permenently chroot, and umount the old root fs | ||
202 | // just like an initrd does. Requires a kernel patch by Werner Almesberger. | ||
203 | // ftp://icaftp.epfl.ch/pub/people/almesber/misc/umount-root-*.tar.gz | ||
204 | //#define BB_FEATURE_INIT_CHROOT | ||
205 | // | ||
206 | //Make sure nothing is printed to the console on boot | 194 | //Make sure nothing is printed to the console on boot |
207 | //#define BB_FEATURE_EXTRA_QUIET | 195 | //#define BB_FEATURE_EXTRA_QUIET |
208 | // | 196 | // |
@@ -72,7 +72,7 @@ DOLFS = false | |||
72 | # If you have a "pristine" source directory, point BB_SRC_DIR to it. | 72 | # If you have a "pristine" source directory, point BB_SRC_DIR to it. |
73 | # Experimental and incomplete; tell the mailing list | 73 | # Experimental and incomplete; tell the mailing list |
74 | # <busybox@opensource.lineo.com> if you do or don't like it so far. | 74 | # <busybox@opensource.lineo.com> if you do or don't like it so far. |
75 | BB_SRC_DIR = . | 75 | BB_SRC_DIR = |
76 | 76 | ||
77 | # If you are running a cross compiler, you may want to set this | 77 | # If you are running a cross compiler, you may want to set this |
78 | # to something more interesting, like "powerpc-linux-". | 78 | # to something more interesting, like "powerpc-linux-". |
@@ -94,14 +94,21 @@ STRIPTOOL = $(CROSS)strip | |||
94 | #CROSS_CFLAGS+=-nostdinc -I$(LIBCDIR)/include -I$(GCCINCDIR) | 94 | #CROSS_CFLAGS+=-nostdinc -I$(LIBCDIR)/include -I$(GCCINCDIR) |
95 | #GCCINCDIR = $(shell gcc -print-search-dirs | sed -ne "s/install: \(.*\)/\1include/gp") | 95 | #GCCINCDIR = $(shell gcc -print-search-dirs | sed -ne "s/install: \(.*\)/\1include/gp") |
96 | 96 | ||
97 | #-------------------------------------------------------- | ||
98 | |||
99 | # use '-Os' optimization if available, else use -O2 | 97 | # use '-Os' optimization if available, else use -O2 |
100 | OPTIMIZATION = $(shell if $(CC) -Os -S -o /dev/null -xc /dev/null >/dev/null 2>&1; \ | 98 | OPTIMIZATION := $(shell if $(CC) -Os -S -o /dev/null -xc /dev/null >/dev/null 2>&1; \ |
101 | then echo "-Os"; else echo "-O2" ; fi) | 99 | then echo "-Os"; else echo "-O2" ; fi) |
102 | 100 | ||
103 | WARNINGS = -Wall | 101 | WARNINGS = -Wall |
104 | 102 | ||
103 | # | ||
104 | #-------------------------------------------------------- | ||
105 | # If you're going to do a lot of builds with a non-vanilla configuration, | ||
106 | # it makes sense to adjust parameters above, so you can type "make" | ||
107 | # by itself, instead of following it by the same half-dozen overrides | ||
108 | # every time. The stuff below, on the other hand, is probably less | ||
109 | # prone to casual user adjustment. | ||
110 | # | ||
111 | |||
105 | ifeq ($(strip $(DOLFS)),true) | 112 | ifeq ($(strip $(DOLFS)),true) |
106 | # For large file summit support | 113 | # For large file summit support |
107 | CFLAGS+=-D_FILE_OFFSET_BITS=64 | 114 | CFLAGS+=-D_FILE_OFFSET_BITS=64 |
@@ -142,22 +149,48 @@ ifndef $(PREFIX) | |||
142 | endif | 149 | endif |
143 | 150 | ||
144 | # Additional complications due to support for pristine source dir. | 151 | # Additional complications due to support for pristine source dir. |
145 | # Config.h in the build directory should take precedence over the | 152 | # Include files in the build directory should take precedence over |
146 | # copy in BB_SRC_DIR, both during the compilation phase and the | 153 | # the copy in BB_SRC_DIR, both during the compilation phase and the |
147 | # shell script that finds the list of object files. | 154 | # shell script that finds the list of object files. |
148 | # | ||
149 | # Work in progress by <ldoolitt@recycle.lbl.gov>. | 155 | # Work in progress by <ldoolitt@recycle.lbl.gov>. |
150 | # If it gets in your way, set DISABLE_VPATH=yes | 156 | # |
151 | ifeq ($(strip $(DISABLE_VPATH)),yes) | 157 | ifneq ($(strip $(BB_SRC_DIR)),) |
152 | CONFIG_H = Config.h | 158 | VPATH = $(BB_SRC_DIR) |
153 | else | ||
154 | VPATH = .:$(BB_SRC_DIR) | ||
155 | CONFIG_LIST = $(addsuffix /Config.h,$(subst :, ,$(VPATH))) | ||
156 | CONFIG_H = $(word 1,$(shell ls -f -1 $(CONFIG_LIST) 2>/dev/null)) | ||
157 | CFLAGS += -I- $(patsubst %,-I%,$(subst :, ,$(VPATH))) | ||
158 | endif | 159 | endif |
159 | 160 | #ifneq ($(strip $(VPATH)),) | |
160 | OBJECTS = $(shell $(BB_SRC_DIR)/busybox.sh $(CONFIG_H) $(BB_SRC_DIR)) busybox.o messages.o usage.o utility.o | 161 | # CFLAGS += -I- -I. $(patsubst %,-I%,$(subst :, ,$(VPATH))) |
162 | #endif | ||
163 | |||
164 | # We need to set APPLET_SOURCES to something like | ||
165 | # $(shell busybox.sh Config.h) | ||
166 | # but in a manner that works with VPATH and BB_SRC_DIR. | ||
167 | # Possible ways to approach this: | ||
168 | # | ||
169 | # 1. Explicitly search through .:$(VPATH) for busybox.sh and config.h, | ||
170 | # then $(shell $(BUSYBOX_SH) $(CONFIG_H) $(BB_SRC_DIR)) | ||
171 | # | ||
172 | # 2. Explicity search through .:$(VPATH) for slist.mk, | ||
173 | # then $(shell $(MAKE) -f $(SLIST_MK) VPATH=$(VPATH) BB_SRC_DIR=$(BB_SRC_DIR)) | ||
174 | # | ||
175 | # 3. Create slist.mk in this directory, with commands embedded in | ||
176 | # a $(shell ...) command, and $(MAKE) it immediately. | ||
177 | # | ||
178 | # 4. Use a real rule within this makefile to create a file that sets | ||
179 | # APPLET_SOURCE_LIST, then include that file. Has complications | ||
180 | # with the first trip through the makefile (before processing the | ||
181 | # include) trying to do too much, and a spurious warning the first | ||
182 | # time make is run. | ||
183 | # | ||
184 | # This is option 3: | ||
185 | # | ||
186 | #APPLET_SOURCES = $(shell \ | ||
187 | # echo -e 'all: busybox.sh Config.h\n\t@ $$(SHELL) $$^ $$(BB_SRC_DIR)' >slist.mk; \ | ||
188 | # make -f slist.mk VPATH=$(VPATH) BB_SRC_DIR=$(BB_SRC_DIR) \ | ||
189 | #) | ||
190 | # And option 4: | ||
191 | -include applet_source_list | ||
192 | |||
193 | OBJECTS = $(APPLET_SOURCES:.c=.o) busybox.o messages.o usage.o utility.o | ||
161 | CFLAGS += $(CROSS_CFLAGS) | 194 | CFLAGS += $(CROSS_CFLAGS) |
162 | CFLAGS += -DBB_VER='"$(VERSION)"' | 195 | CFLAGS += -DBB_VER='"$(VERSION)"' |
163 | CFLAGS += -DBB_BT='"$(BUILDTIME)"' | 196 | CFLAGS += -DBB_BT='"$(BUILDTIME)"' |
@@ -166,20 +199,29 @@ ifdef BB_INIT_SCRIPT | |||
166 | endif | 199 | endif |
167 | 200 | ||
168 | ifneq ($(strip $(USE_SYSTEM_PWD_GRP)),true) | 201 | ifneq ($(strip $(USE_SYSTEM_PWD_GRP)),true) |
169 | PWD_LIB = pwd_grp/libpwd.a | 202 | PWD_GRP = pwd_grp |
170 | LIBRARIES += $(PWD_LIB) | 203 | PWD_GRP_DIR = $(BB_SRC_DIR)$(PWD_GRP) |
204 | PWD_LIB = libpwd.a | ||
205 | LIBRARIES += $(PWD_LIB) | ||
206 | PWD_CSRC=__getpwent.c pwent.c getpwnam.c getpwuid.c putpwent.c getpw.c \ | ||
207 | fgetpwent.c __getgrent.c grent.c getgrnam.c getgrgid.c fgetgrent.c \ | ||
208 | initgroups.c setgroups.c | ||
209 | PWD_OBJS=$(patsubst %.c,$(PWD_GRP)/%.o, $(PWD_CSRC)) | ||
210 | PWD_CFLAGS = -I$(PWD_GRP_DIR) | ||
171 | else | 211 | else |
172 | CFLAGS += -DUSE_SYSTEM_PWD_GRP | 212 | CFLAGS += -DUSE_SYSTEM_PWD_GRP |
173 | endif | 213 | endif |
174 | 214 | ||
175 | |||
176 | # Put user-supplied flags at the end, where they | 215 | # Put user-supplied flags at the end, where they |
177 | # have a chance of winning. | 216 | # have a chance of winning. |
178 | CFLAGS += $(CFLAGS_EXTRA) | 217 | CFLAGS += $(CFLAGS_EXTRA) |
179 | 218 | ||
180 | .EXPORT_ALL_VARIABLES: | 219 | .EXPORT_ALL_VARIABLES: |
181 | 220 | ||
182 | all: busybox busybox.links doc | 221 | all: applet_source_list busybox busybox.links doc |
222 | |||
223 | applet_source_list: busybox.sh Config.h | ||
224 | (echo -n "APPLET_SOURCES := "; $(SHELL) $^ $(BB_SRC_DIR)) > $@ | ||
183 | 225 | ||
184 | doc: olddoc | 226 | doc: olddoc |
185 | 227 | ||
@@ -191,12 +233,12 @@ docs/BusyBox.txt: docs/busybox.pod | |||
191 | @echo BusyBox Documentation | 233 | @echo BusyBox Documentation |
192 | @echo | 234 | @echo |
193 | -mkdir -p docs | 235 | -mkdir -p docs |
194 | -pod2text $(BB_SRC_DIR)/docs/busybox.pod > docs/BusyBox.txt | 236 | -pod2text $< > $@ |
195 | 237 | ||
196 | docs/BusyBox.1: docs/busybox.pod | 238 | docs/BusyBox.1: docs/busybox.pod |
197 | - mkdir -p docs | 239 | - mkdir -p docs |
198 | - pod2man --center=BusyBox --release="version $(VERSION)" \ | 240 | - pod2man --center=BusyBox --release="version $(VERSION)" \ |
199 | $(BB_SRC_DIR)/docs/busybox.pod > docs/BusyBox.1 | 241 | $< > $@ |
200 | 242 | ||
201 | docs/BusyBox.html: docs/busybox.lineo.com/BusyBox.html | 243 | docs/BusyBox.html: docs/busybox.lineo.com/BusyBox.html |
202 | -@ rm -f docs/BusyBox.html | 244 | -@ rm -f docs/BusyBox.html |
@@ -204,7 +246,7 @@ docs/BusyBox.html: docs/busybox.lineo.com/BusyBox.html | |||
204 | 246 | ||
205 | docs/busybox.lineo.com/BusyBox.html: docs/busybox.pod | 247 | docs/busybox.lineo.com/BusyBox.html: docs/busybox.pod |
206 | -@ mkdir -p docs/busybox.lineo.com | 248 | -@ mkdir -p docs/busybox.lineo.com |
207 | - pod2html --noindex $(BB_SRC_DIR)/docs/busybox.pod > \ | 249 | - pod2html --noindex $< > \ |
208 | docs/busybox.lineo.com/BusyBox.html | 250 | docs/busybox.lineo.com/BusyBox.html |
209 | -@ rm -f pod2html* | 251 | -@ rm -f pod2html* |
210 | 252 | ||
@@ -236,55 +278,62 @@ docs/busybox/busyboxdocumentation.html: docs/busybox.sgml | |||
236 | (cd docs/busybox.lineo.com; sgmltools -b html ../busybox.sgml) | 278 | (cd docs/busybox.lineo.com; sgmltools -b html ../busybox.sgml) |
237 | 279 | ||
238 | 280 | ||
239 | |||
240 | busybox: $(PWD_LIB) $(OBJECTS) | 281 | busybox: $(PWD_LIB) $(OBJECTS) |
241 | $(CC) $(LDFLAGS) -o $@ $^ $(LIBRARIES) | 282 | $(CC) $(LDFLAGS) -o $@ $^ $(LIBRARIES) |
242 | $(STRIP) | 283 | $(STRIP) |
243 | 284 | ||
244 | $(PWD_LIB): | 285 | # Without VPATH, rule expands to "/bin/sh busybox.mkll Config.h applets.h" |
245 | $(MAKE) -eC pwd_grp | 286 | # but with VPATH, some or all of those file names are resolved to the |
246 | 287 | # directories in which they live. | |
247 | busybox.links: Config.h applets.h | 288 | busybox.links: busybox.mkll Config.h applets.h |
248 | - $(BB_SRC_DIR)/busybox.mkll $(CONFIG_H) $(BB_SRC_DIR)/applets.h >$@ | 289 | - $(SHELL) $^ >$@ |
249 | 290 | ||
250 | nfsmount.o cmdedit.o: %.o: %.h | 291 | nfsmount.o cmdedit.o: %.o: %.h |
251 | $(OBJECTS): %.o: %.c Config.h busybox.h applets.h Makefile | 292 | $(OBJECTS): %.o: %.c Config.h busybox.h applets.h Makefile |
293 | $(CC) $(CFLAGS) -I- -I. $(patsubst %,-I%,$(subst :, ,$(BB_SRC_DIR))) -c $< -o $*.o | ||
294 | |||
295 | $(PWD_OBJS): %.o: %.c pwd_lib_objdir Config.h busybox.h applets.h Makefile | ||
296 | $(CC) $(CFLAGS) $(PWD_CFLAGS) -c $< -o $*.o | ||
297 | |||
298 | $(PWD_LIB): $(PWD_OBJS) | ||
299 | $(AR) $(ARFLAGS) $(PWD_LIB) $^ | ||
300 | |||
301 | pwd_lib_objdir: | ||
302 | mkdir -p $(PWD_GRP) | ||
252 | 303 | ||
253 | usage.o: usage.h | 304 | usage.o: usage.h |
254 | 305 | ||
255 | utility.o: loop.h | 306 | utility.o: loop.h |
256 | 307 | ||
257 | loop.h: mk_loop_h.sh | 308 | loop.h: mk_loop_h.sh |
258 | @ sh $< | 309 | @ $(SHELL) $< > $@ |
259 | 310 | ||
260 | test tests: | 311 | test tests: |
261 | cd tests && $(MAKE) all | 312 | cd tests && $(MAKE) all |
262 | 313 | ||
263 | clean: | 314 | clean: |
264 | - cd tests && $(MAKE) clean | 315 | - cd tests && $(MAKE) clean |
265 | - cd pwd_grp && $(MAKE) clean | ||
266 | - rm -f docs/BusyBox.txt docs/BusyBox.1 docs/BusyBox.html \ | 316 | - rm -f docs/BusyBox.txt docs/BusyBox.1 docs/BusyBox.html \ |
267 | docs/busybox.lineo.com/BusyBox.html | 317 | docs/busybox.lineo.com/BusyBox.html |
268 | - rm -f docs/busybox.txt docs/busybox.dvi docs/busybox.ps \ | 318 | - rm -f docs/busybox.txt docs/busybox.dvi docs/busybox.ps \ |
269 | docs/busybox.pdf docs/busybox.lineo.com/busybox.html | 319 | docs/busybox.pdf docs/busybox.lineo.com/busybox.html |
270 | - rm -f multibuild.log Config.h.orig | 320 | - rm -f multibuild.log Config.h.orig |
271 | - rm -rf docs/busybox _install | 321 | - rm -rf docs/busybox _install $(PWD_LIB) |
272 | - rm -f busybox.links loop.h *~ *.o core | 322 | - rm -f busybox.links loop.h *~ slist.mk core applet_source_list |
323 | - find -name *.o | xargs rm -f; | ||
273 | 324 | ||
274 | distclean: clean | 325 | distclean: clean |
275 | - rm -f busybox | 326 | - rm -f busybox |
276 | - cd tests && $(MAKE) distclean | 327 | - cd tests && $(MAKE) distclean |
277 | 328 | ||
278 | install: busybox busybox.links | 329 | install: install.sh busybox busybox.links |
279 | $(BB_SRC_DIR)/install.sh $(PREFIX) | 330 | $(SHELL) $< $(PREFIX) |
280 | 331 | ||
281 | install-hardlinks: busybox busybox.links | 332 | install-hardlinks: install.sh busybox busybox.links |
282 | $(BB_SRC_DIR)/install.sh $(PREFIX) --hardlinks | 333 | $(SHELL) $< $(PREFIX) --hardlinks |
283 | 334 | ||
284 | debug_pristine: | 335 | debug_pristine: |
285 | @ echo VPATH=\"$(VPATH)\" | 336 | @ echo VPATH=\"$(VPATH)\" |
286 | @ echo CONFIG_LIST=\"$(CONFIG_LIST)\" | ||
287 | @ echo CONFIG_H=\"$(CONFIG_H)\" | ||
288 | @ echo OBJECTS=\"$(OBJECTS)\" | 337 | @ echo OBJECTS=\"$(OBJECTS)\" |
289 | 338 | ||
290 | dist release: distclean doc | 339 | dist release: distclean doc |
diff --git a/applets/busybox.sh b/applets/busybox.sh index 547aca477..338298086 100755 --- a/applets/busybox.sh +++ b/applets/busybox.sh | |||
@@ -7,7 +7,7 @@ RAW=` \ | |||
7 | ` | 7 | ` |
8 | test "${RAW}" != "" || exit | 8 | test "${RAW}" != "" || exit |
9 | cd ${2:-.} | 9 | cd ${2:-.} |
10 | # I added in the extra "ls" so only source files that | 10 | # By running $RAW through "ls", we avoid listing |
11 | # actually exist will show up in the compile list. | 11 | # source files that don't exist. |
12 | ls -1 $RAW 2>/dev/null | sed -e 's/\.c$/\.o/g' | 12 | ls $RAW 2>/dev/null | tr '\n' ' ' |
13 | 13 | ||
diff --git a/applets/usage.c b/applets/usage.c index 1515c0898..e429c5a4e 100644 --- a/applets/usage.c +++ b/applets/usage.c | |||
@@ -1,2 +1,2 @@ | |||
1 | #define USAGE_MESSAGES | 1 | #define USAGE_MESSAGES |
2 | #include <usage.h> | 2 | #include "usage.h" |
diff --git a/busybox.sh b/busybox.sh index 547aca477..338298086 100755 --- a/busybox.sh +++ b/busybox.sh | |||
@@ -7,7 +7,7 @@ RAW=` \ | |||
7 | ` | 7 | ` |
8 | test "${RAW}" != "" || exit | 8 | test "${RAW}" != "" || exit |
9 | cd ${2:-.} | 9 | cd ${2:-.} |
10 | # I added in the extra "ls" so only source files that | 10 | # By running $RAW through "ls", we avoid listing |
11 | # actually exist will show up in the compile list. | 11 | # source files that don't exist. |
12 | ls -1 $RAW 2>/dev/null | sed -e 's/\.c$/\.o/g' | 12 | ls $RAW 2>/dev/null | tr '\n' ' ' |
13 | 13 | ||
diff --git a/libbb/mk_loop_h.sh b/libbb/mk_loop_h.sh index c33c010ca..71c987376 100755 --- a/libbb/mk_loop_h.sh +++ b/libbb/mk_loop_h.sh | |||
@@ -2,8 +2,7 @@ | |||
2 | # | 2 | # |
3 | # Figure out (i) the type of dev_t (ii) the defines for loop stuff | 3 | # Figure out (i) the type of dev_t (ii) the defines for loop stuff |
4 | # | 4 | # |
5 | 5 | # Output of this script is normally redirected to "loop.h". | |
6 | rm -f loop.h | ||
7 | 6 | ||
8 | # Since 1.3.79 there is an include file <asm/posix_types.h> | 7 | # Since 1.3.79 there is an include file <asm/posix_types.h> |
9 | # that defines __kernel_dev_t. | 8 | # that defines __kernel_dev_t. |
@@ -12,23 +11,27 @@ rm -f loop.h | |||
12 | # avoids namespace pollution. Otherwise we guess that __kernel_dev_t | 11 | # avoids namespace pollution. Otherwise we guess that __kernel_dev_t |
13 | # is an unsigned short (which is true on i386, but false on alpha). | 12 | # is an unsigned short (which is true on i386, but false on alpha). |
14 | 13 | ||
14 | # BUG: This test is actually broken if your gcc is not configured to | ||
15 | # search /usr/include, as may well happen with cross-compilers. | ||
16 | # It would be better to ask $(CC) if these files can be found. | ||
17 | |||
15 | if [ -f /usr/include/linux/posix_types.h ]; then | 18 | if [ -f /usr/include/linux/posix_types.h ]; then |
16 | echo '#include <linux/posix_types.h>' >> loop.h | 19 | echo '#include <linux/posix_types.h>' |
17 | echo '#undef dev_t' >> loop.h | 20 | echo '#undef dev_t' |
18 | echo '#define dev_t __kernel_dev_t' >> loop.h | 21 | echo '#define dev_t __kernel_dev_t' |
19 | else | 22 | else |
20 | echo '#undef dev_t' >> loop.h | 23 | echo '#undef dev_t' |
21 | echo '#define dev_t unsigned short' >> loop.h | 24 | echo '#define dev_t unsigned short' |
22 | fi | 25 | fi |
23 | 26 | ||
24 | # Next we have to find the loop stuff itself. | 27 | # Next we have to find the loop stuff itself. |
25 | # First try kernel source, then a private version. | 28 | # First try kernel source, then a private version. |
26 | 29 | ||
27 | if [ -f /usr/include/linux/loop.h ]; then | 30 | if [ -f /usr/include/linux/loop.h ]; then |
28 | echo '#include <linux/loop.h>' >> loop.h | 31 | echo '#include <linux/loop.h>' |
29 | else | 32 | else |
30 | echo '#include "real_loop.h"' >> loop.h | 33 | echo '#include "real_loop.h"' |
31 | fi | 34 | fi |
32 | 35 | ||
33 | echo '#undef dev_t' >> loop.h | 36 | echo '#undef dev_t' |
34 | 37 | ||
diff --git a/mk_loop_h.sh b/mk_loop_h.sh index c33c010ca..71c987376 100755 --- a/mk_loop_h.sh +++ b/mk_loop_h.sh | |||
@@ -2,8 +2,7 @@ | |||
2 | # | 2 | # |
3 | # Figure out (i) the type of dev_t (ii) the defines for loop stuff | 3 | # Figure out (i) the type of dev_t (ii) the defines for loop stuff |
4 | # | 4 | # |
5 | 5 | # Output of this script is normally redirected to "loop.h". | |
6 | rm -f loop.h | ||
7 | 6 | ||
8 | # Since 1.3.79 there is an include file <asm/posix_types.h> | 7 | # Since 1.3.79 there is an include file <asm/posix_types.h> |
9 | # that defines __kernel_dev_t. | 8 | # that defines __kernel_dev_t. |
@@ -12,23 +11,27 @@ rm -f loop.h | |||
12 | # avoids namespace pollution. Otherwise we guess that __kernel_dev_t | 11 | # avoids namespace pollution. Otherwise we guess that __kernel_dev_t |
13 | # is an unsigned short (which is true on i386, but false on alpha). | 12 | # is an unsigned short (which is true on i386, but false on alpha). |
14 | 13 | ||
14 | # BUG: This test is actually broken if your gcc is not configured to | ||
15 | # search /usr/include, as may well happen with cross-compilers. | ||
16 | # It would be better to ask $(CC) if these files can be found. | ||
17 | |||
15 | if [ -f /usr/include/linux/posix_types.h ]; then | 18 | if [ -f /usr/include/linux/posix_types.h ]; then |
16 | echo '#include <linux/posix_types.h>' >> loop.h | 19 | echo '#include <linux/posix_types.h>' |
17 | echo '#undef dev_t' >> loop.h | 20 | echo '#undef dev_t' |
18 | echo '#define dev_t __kernel_dev_t' >> loop.h | 21 | echo '#define dev_t __kernel_dev_t' |
19 | else | 22 | else |
20 | echo '#undef dev_t' >> loop.h | 23 | echo '#undef dev_t' |
21 | echo '#define dev_t unsigned short' >> loop.h | 24 | echo '#define dev_t unsigned short' |
22 | fi | 25 | fi |
23 | 26 | ||
24 | # Next we have to find the loop stuff itself. | 27 | # Next we have to find the loop stuff itself. |
25 | # First try kernel source, then a private version. | 28 | # First try kernel source, then a private version. |
26 | 29 | ||
27 | if [ -f /usr/include/linux/loop.h ]; then | 30 | if [ -f /usr/include/linux/loop.h ]; then |
28 | echo '#include <linux/loop.h>' >> loop.h | 31 | echo '#include <linux/loop.h>' |
29 | else | 32 | else |
30 | echo '#include "real_loop.h"' >> loop.h | 33 | echo '#include "real_loop.h"' |
31 | fi | 34 | fi |
32 | 35 | ||
33 | echo '#undef dev_t' >> loop.h | 36 | echo '#undef dev_t' |
34 | 37 | ||
diff --git a/pristine_setup.sh b/pristine_setup.sh new file mode 100755 index 000000000..dca278c73 --- /dev/null +++ b/pristine_setup.sh | |||
@@ -0,0 +1,39 @@ | |||
1 | #!/bin/sh | ||
2 | # | ||
3 | # To compile BusyBox without touching the original sources | ||
4 | # (as might be interesting for multi-target builds), create | ||
5 | # an empty directory, cd into it, and run this program by | ||
6 | # giving its explicit path (kind of like how you would run | ||
7 | # configure, if BusyBox had one). Then you should be ready | ||
8 | # to "make". Files in the build tree, in particular Config.h, | ||
9 | # will override those in the pristine source tree. | ||
10 | # | ||
11 | |||
12 | |||
13 | # if you use a ? in your path name, you lose. | ||
14 | DIR=`basedir ${0%%/pristine_setup}` | ||
15 | if [ ! -d $DIR ]; then | ||
16 | echo "unexpected problem: $DIR is not a directory. Aborting pristine setup" | ||
17 | exit | ||
18 | fi | ||
19 | |||
20 | echo " " | ||
21 | |||
22 | if [ -e ./Config.h ]; then | ||
23 | echo "./Config.h already exists: not overwriting" | ||
24 | else | ||
25 | cp $DIR/Config.h Config.h | ||
26 | fi | ||
27 | |||
28 | if [ -e ./Makefile ]; then | ||
29 | echo "./Makefile already exists: not overwriting" | ||
30 | else | ||
31 | sed -e "s?BB_SRC_DIR =?BB_SRC_DIR = $DIR?" <$DIR/Makefile >Makefile || exit | ||
32 | fi | ||
33 | |||
34 | |||
35 | echo " " | ||
36 | echo "You may now type 'make' to build busybox in this directory" | ||
37 | echo "($PWD) using the pristine sources in $DIR" | ||
38 | echo " " | ||
39 | |||
@@ -1,2 +1,2 @@ | |||
1 | #define USAGE_MESSAGES | 1 | #define USAGE_MESSAGES |
2 | #include <usage.h> | 2 | #include "usage.h" |