[patch] fix building out-of-tree, update docs for svn-access and build instructions

Bernhard Fischer rep.nop at aon.at
Thu Sep 29 11:48:44 UTC 2005


Hi,

I will check the attached patch in tomorrow evening if nobody objects.

thanks,
Bernhard
-------------- next part --------------
- fix building out-of-tree;
  to test, checkout the source (let's assume /scratch/src/busybox), then
  mkdir /tmp/bb ; cd /tmp/bb
  make top_srcdir=/scratch/src/busybox O="$(pwd)" -f /scratch/src/busybox/Makefile allyesconfig ; make check
- update the docs to mention svn instead of cvs and provide an example
  for building out-of-tree.

diff -X excl -rduNp busybox.oorig/Makefile busybox/Makefile
--- busybox.oorig/Makefile	2005-09-29 10:17:48.000000000 +0200
+++ busybox/Makefile	2005-09-29 11:36:04.000000000 +0200
@@ -65,26 +65,30 @@ $(if $(wildcard $(KBUILD_OUTPUT)),, \
 
 .PHONY: $(MAKECMDGOALS)
 
-$(filter-out _all,$(MAKECMDGOALS)) _all: $(KBUILD_OUTPUT)/Rules.mak $(KBUILD_OUTPUT)/Makefile
+$(filter-out _all,$(MAKECMDGOALS)) _all: $(KBUILD_OUTPUT)/Rules.mak $(KBUILD_OUTPUT)/Makefile $(KBUILD_OUTPUT)/scripts/config/Makefile
 	$(MAKE) -C $(KBUILD_OUTPUT) \
-	top_srcdir=$(CURDIR) \
-	top_builddir=$(KBUILD_OUTPUT) \
-	KBUILD_SRC=$(CURDIR) \
+	top_srcdir=$(top_srcdir) \
+	top_builddir=$(top_builddir) \
+	KBUILD_SRC=$(top_srcdir) \
 	-f $(CURDIR)/Makefile $@
 
 $(KBUILD_OUTPUT)/Rules.mak:
 	@echo > $@
-	@echo top_srcdir=$(CURDIR) >> $@
+	@echo top_srcdir=$(top_srcdir) >> $@
 	@echo top_builddir=$(KBUILD_OUTPUT) >> $@
 	@echo include $(top_srcdir)/Rules.mak >> $@
 
 $(KBUILD_OUTPUT)/Makefile:
 	@echo > $@
-	@echo top_srcdir=$(CURDIR) >> $@
+	@echo top_srcdir=$(top_srcdir) >> $@
 	@echo top_builddir=$(KBUILD_OUTPUT) >> $@
 	@echo KBUILD_SRC='$$(top_srcdir)' >> $@
 	@echo include '$$(KBUILD_SRC)'/Makefile >> $@
 
+$(KBUILD_OUTPUT)/scripts/config/Makefile: $(top_srcdir)/scripts/config/Makefile
+	@test -d "$(@D)" || mkdir -p $(@D)
+	@if [ -L $@ ]; then ln -f -s $< $@; else [ -r $@ ] || ln -s $< $@; fi
+
 # Leave processing to above invocation of make
 skip-makefile := 1
 endif # ifneq ($(KBUILD_OUTPUT),)
@@ -217,7 +221,7 @@ ifeq ($(strip $(CONFIG_BBCONFIG)),y)
 DEP_INCLUDES += include/bbconfigopts.h
 
 include/bbconfigopts.h: .config
-	scripts/config/mkconfigs > $@
+	$(top_srcdir)/scripts/config/mkconfigs > $@
 endif
 
 depend dep $(top_builddir)/.depend: .depend
@@ -228,6 +232,7 @@ depend dep $(top_builddir)/.depend: .dep
 	mv $@.tmp $@
 
 include/config.h: .config
+	@[ -d include ] || mkdir include
 	@if [ ! -x $(top_builddir)/scripts/config/conf ] ; then \
 	    $(MAKE) -C scripts/config conf; \
 	fi;
@@ -252,13 +257,13 @@ all: menuconfig
 # configuration
 # ---------------------------------------------------------------------------
 
-scripts/config/conf: scripts/config/Makefile $(top_srcdir)/Rules.mak
+scripts/config/conf: $(top_srcdir)/Rules.mak
 	$(MAKE) -C scripts/config conf
 	- at if [ ! -f .config ] ; then \
 		cp $(CONFIG_DEFCONFIG) .config; \
 	fi
 
-scripts/config/mconf: scripts/config/Makefile $(top_srcdir)/Rules.mak
+scripts/config/mconf: $(top_srcdir)/Rules.mak
 	$(MAKE) -C scripts/config ncurses conf mconf
 	- at if [ ! -f .config ] ; then \
 		cp $(CONFIG_DEFCONFIG) .config; \
diff -X excl -rduNp busybox.oorig/e2fsprogs/Makefile.in busybox/e2fsprogs/Makefile.in
--- busybox.oorig/e2fsprogs/Makefile.in	2005-09-29 10:17:48.000000000 +0200
+++ busybox/e2fsprogs/Makefile.in	2005-09-29 12:31:50.000000000 +0200
@@ -7,8 +7,9 @@
 E2FSPROGS_AR:=e2fsprogs.a
 
 E2FSPROGS_DIR:=$(top_builddir)/e2fsprogs
+E2FSPROGS_INC:=$(top_srcdir)/e2fsprogs
 
-E2FSPROGS_CFLAGS := -I$(E2FSPROGS_DIR) -include $(E2FSPROGS_DIR)/e2fsbb.h
+E2FSPROGS_CFLAGS := -I$(E2FSPROGS_INC) -include $(E2FSPROGS_INC)/e2fsbb.h
 
 BLKID_SRC   := cache.c dev.c devname.c devno.c blkid_getsize.c \
 	       probe.c read.c resolve.c save.c tag.c resolve.c
@@ -55,5 +56,6 @@ libraries-y+=$(E2FSPROGS_DIR)/$(E2FSPROG
 $(E2FSPROGS_DIR)/$(E2FSPROGS_AR): $(patsubst %,$(E2FSPROGS_DIR)/%, $(E2FSPROGS-y))
 	$(AR) $(ARFLAGS) $@ $(patsubst %,$(E2FSPROGS_DIR)/%, $(E2FSPROGS-y))
 
-$(E2FSPROGS_DIR)/%.o: $(E2FSPROGS_DIR)/%.c
+$(E2FSPROGS_DIR)/%.o: $(subst $(top_builddir),$(top_srcdir),$(E2FSPROGS_DIR)/%.c)
+	@[ -d "$(@D)" ] || mkdir -p $(@D)
 	$(CC) $(CFLAGS) $(EXTRA_CFLAGS) $(E2FSPROGS_CFLAGS) -c -o $@ $<
--- busybox.oorig/README	2005-09-26 15:54:28.000000000 +0200
+++ busybox/README	2005-09-29 13:22:47.000000000 +0200
@@ -1,4 +1,5 @@
 Please see the LICENSE file for details on copying and usage.
+Please refer to the INSTALL file for instructions on how to build.
 
 BusyBox combines tiny versions of many common UNIX utilities into a single
 small executable. It provides minimalist replacements for most of the utilities
@@ -15,17 +16,8 @@ BusyBox provides a fairly complete POSIX
 system.
 
 BusyBox is extremely configurable.  This allows you to include only the
-components you need, thereby reducing binary size. Run 'make config' or
-'make menuconfig' to select the functionality that you wish to enable.
-
-After the build is complete, a busybox.links file is generated.  This is
-used by 'make install' to create symlinks to the BusyBox binary for all
-compiled in functions.  By default, 'make install' will place the symlink
-forest into `pwd`/_install unless you have defined the PREFIX environment
-variable (i.e., 'make PREFIX=/tmp/foo install')
-
-If you wish to install hard links, rather than symlinks, you can use
-'make PREFIX=/tmp/foo install-hardlinks' instead.
+components you need, thereby reducing binary size. See the file INSTALL
+for details.
 
 ----------------
 
@@ -110,14 +102,14 @@ be downloaded from
 
 CVS:
 
-BusyBox now has its own publicly browsable CVS tree at:
-    http://busybox.net/cgi-bin/cvsweb/busybox/
+BusyBox now has its own publicly browsable SVN tree at:
+    http://busybox.net/cgi-bin/viewcvs.cgi/trunk/busybox/
 
-Anonymous CVS access is available.  For instructions, check out:
-    http://busybox.net/cvs_anon.html
+Anonymous SVN access is available.  For instructions, check out:
+    http://busybox.net/subversion.html
 
-For those that are actively contributing there is even CVS write access:
-    http://busybox.net/cvs_write.html
+For those that are actively contributing there is even SVN write access:
+    http://busybox.net/developer.html
 
 ----------------
 
--- busybox.oorig/INSTALL	2005-09-26 15:54:28.000000000 +0200
+++ busybox/INSTALL	2005-09-29 13:19:07.000000000 +0200
@@ -1,3 +1,15 @@
+Building:
+=========
+
+You will usually build in the source-tree.
+
+Alternatively you can build out-of-tree to have the object files separated
+from the source. This allows for building several different configurations
+from the same set of sources.
+
+A) Building in the source-tree:
+-------------------------------
+
 1) Run 'make config' or 'make menuconfig' and select the
    functionality that you wish to enable.
 
@@ -12,3 +24,27 @@
     install busybox and all the needed links.  Some people
     will prefer to install using hardlinks and will instead
     want to run 'make install-hardlinks'....
+
+B) Building out-of-tree:
+------------------------
+
+1) make the directory to hold the object files and chdir to it:
+   'mkdir /tmp/bb ; cd /tmp/bb'
+   Then prepare the config giving the full path to the source in top_srcdir:
+   make top_srcdir=/path/busybox -f /path/busybox/Makefile O=$(pwd) allyesconfig
+   
+   Proceed with step #A2 above.
+
+
+Installation:
+=============
+
+After the build is complete, a busybox.links file is generated.  This is
+used by 'make install' to create symlinks to the BusyBox binary for all
+compiled in functions.  By default, 'make install' will place the symlink
+forest into `pwd`/_install unless you have defined the PREFIX environment
+variable (i.e., 'make PREFIX=/tmp/foo install')
+
+If you wish to install hard links, rather than symlinks, you can use
+'make PREFIX=/tmp/foo install-hardlinks' instead.
+


More information about the busybox mailing list