[BusyBox] Pristine source directory (patch)

Matt Kraai kraai at alumni.carnegiemellon.edu
Tue Nov 21 03:15:53 UTC 2000


On Mon, Nov 20, 2000 at 05:25:20PM -0800, Larry Doolittle wrote:
> 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.

Here is an alternate solution using the VPATH directive.  That way, you
can just make a new directory, copy Config.h, Makefile, and busybox.sh
to it, cd to it and run

make VPATH=$REAL_BUSYBOX_DIR busybox

Matt
-------------- next part --------------
Index: Makefile
===================================================================
RCS file: /var/cvs/busybox/Makefile,v
retrieving revision 1.124
diff -u -r1.124 Makefile
--- Makefile	2000/10/27 18:26:18	1.124
+++ Makefile	2000/11/21 03:16:12
@@ -113,7 +113,7 @@
     PREFIX = `pwd`/_install
 endif
 
-OBJECTS   = $(shell ./busybox.sh) busybox.o messages.o usage.o utility.o
+OBJECTS   = $(shell VPATH=$(VPATH) ./busybox.sh) busybox.o messages.o usage.o utility.o
 CFLAGS    += -DBB_VER='"$(VERSION)"'
 CFLAGS    += -DBB_BT='"$(BUILDTIME)"'
 ifdef BB_INIT_SCRIPT
Index: busybox.sh
===================================================================
RCS file: /var/cvs/busybox/busybox.sh,v
retrieving revision 1.7
diff -u -r1.7 busybox.sh
--- busybox.sh	2000/09/25 21:28:07	1.7
+++ busybox.sh	2000/11/21 03:16:12
@@ -2,8 +2,12 @@
 
 # I added in the extra "ls" so only source files that
 # actually exist will show up in the compile list.
+DSTDIR=`pwd`
+if test $VPATH; then
+	cd $VPATH
+fi
 ls -1 ` \
-    gcc -E -dM Config.h | \
+    gcc -E -dM $DSTDIR/Config.h | \
     sed -n -e '/^.*BB_FEATURE.*$/d;s/^#define.*\<BB_\(.*\)\>/\1.c/gp;' \
     | tr '[:upper:]' '[:lower:]' | sort
 ` 2>/dev/null | sed -e 's/\.c$/\.o/g'
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 232 bytes
Desc: not available
Url : http://lists.busybox.net/pipermail/busybox/attachments/20001120/865a30c1/attachment.pgp 


More information about the busybox mailing list