[BusyBox] Pristine source directory (patch)

Larry Doolittle ldoolitt at recycle.lbl.gov
Tue Nov 21 01:25:20 UTC 2000


I bet this opens up a big can of worms, but here goes:
with the following Makefile patch, I can use a "pristine sources"
directory for Busybox.  Then

    REF=/home/busybox-0.48
    mkdir busybox-0.48-arm
    cd busybox-0.48-arm
    cp $REF/Makefile .
    cp $REF/Config.h .
    make BB_SRC_DIR=$REF CROSS=arm-linux-
    cd ..
    mkdir busybox-0.48-native
    cd busybox-0.48-native
    cp $REF/Makefile .
    cp $REF/Config.h .
    make BB_SRC_DIR=$REF

will make both a native and a cross-compiled binary.
I kept the Makefile and Config.h separate so the multiple
builds can have different configurations.

I haven't tried to make the install process work in
this context, that shouldn't be any harder.

       - Larry


--- /home/ldoolitt/cvs/busybox/Makefile	Fri Oct 27 11:26:18 2000
+++ ./Makefile	Mon Nov 20 17:17:12 2000
@@ -26,6 +26,9 @@
 # If you want a static binary, turn this on.
 DOSTATIC = false
 
+# If you have a "pristine" source directory, point BB_SRC_DIR to it.
+BB_SRC_DIR = .
+
 # Set the following to `true' to make a debuggable build.
 # Leave this set to `false' for production use.
 # eg: `make DODEBUG=true tests'
@@ -49,10 +52,10 @@
 # larger than 2GB!
 DOLFS = false
 
-
 # If you are running a cross compiler, you may want to set this
-# to something more interesting...
-CROSS = #powerpc-linux-
+# to something more interesting, like "powerpc-linux-".
+CROSS = 
+
 CC = $(CROSS)gcc
 STRIPTOOL = $(CROSS)strip
 
@@ -73,6 +76,7 @@
 
 WARNINGS = -Wall
 
+CFLAGS+=-I$(BB_SRC_DIR) -I .
 ifeq ($(DOLFS),true)
     # For large file summit support
     CFLAGS+=-D_FILE_OFFSET_BITS=64
@@ -113,7 +117,7 @@
     PREFIX = `pwd`/_install
 endif
 
-OBJECTS   = $(shell ./busybox.sh) busybox.o messages.o usage.o utility.o
+OBJECTS   = $(shell cd $(BB_SRC_DIR); ./busybox.sh) busybox.o messages.o usage.o utility.o
 CFLAGS    += -DBB_VER='"$(VERSION)"'
 CFLAGS    += -DBB_BT='"$(BUILDTIME)"'
 ifdef BB_INIT_SCRIPT
@@ -176,13 +180,14 @@
 busybox.links: Config.h
 	- ./busybox.mkll | sort >$@
 
-nfsmount.o cmdedit.o: %.o: %.h
-$(OBJECTS): %.o: Config.h busybox.h  %.c Makefile
+nfsmount.o cmdedit.o: %.o: $(BB_SRC_DIR)/%.h
+$(OBJECTS): %.o: $(BB_SRC_DIR)/%.c Config.h $(BB_SRC_DIR)/busybox.h Makefile
+	$(COMPILE.c) $(OUTPUT_OPTION) $<
 
 utility.o: loop.h
 
 loop.h:
-	@./mk_loop_h.sh
+	@$(BB_SRC_DIR)/mk_loop_h.sh
 
 test tests:
 	cd tests && $(MAKE) all





More information about the busybox mailing list