summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorEric Andersen2000-12-01 19:40:18 +0000
committerEric Andersen2000-12-01 19:40:18 +0000
commit09a34e536896ecbe3e81618c7a45f9f1998bd8aa (patch)
tree74b13a3fdea9b99606d04316abb344c5197fc8f1 /Makefile
parent02f3b2e0c8ba8f8943efc745f1c1777383199278 (diff)
downloadbusybox-09a34e536896ecbe3e81618c7a45f9f1998bd8aa.zip
busybox-09a34e536896ecbe3e81618c7a45f9f1998bd8aa.tar.gz
More updates for the Makefile to do BB_SRC_DIR. This is
primarily a patch from Larry Doolittle, but with updates from me to handle docs and link creation properly...
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile63
1 files changed, 48 insertions, 15 deletions
diff --git a/Makefile b/Makefile
index 8bd9c0e..d43547e 100644
--- a/Makefile
+++ b/Makefile
@@ -55,6 +55,8 @@ DODMALLOC = false
DOLFS = false
# If you have a "pristine" source directory, point BB_SRC_DIR to it.
+# Experimental and incomplete; tell the mailing list
+# <busybox@opensource.lineo.com> if you do or don't like it so far.
BB_SRC_DIR = .
# If you are running a cross compiler, you may want to set this
@@ -80,8 +82,6 @@ OPTIMIZATION = $(shell if $(CC) -Os -S -o /dev/null -xc /dev/null >/dev/null 2>&
WARNINGS = -Wall
-VPATH += :$(BB_SRC_DIR)
-
ifeq ($(DOLFS),true)
# For large file summit support
CFLAGS+=-D_FILE_OFFSET_BITS=64
@@ -122,7 +122,23 @@ ifndef $(PREFIX)
PREFIX = `pwd`/_install
endif
-OBJECTS = $(shell cd $(BB_SRC_DIR); ./busybox.sh) busybox.o messages.o usage.o utility.o
+# Additional complications due to support for pristine source dir.
+# Config.h in the build directory should take precedence over the
+# copy in BB_SRC_DIR, both during the compilation phase and the
+# shell script that finds the list of object files.
+#
+# Work in progress by <ldoolitt@recycle.lbl.gov>.
+# If it gets in your way, set DISABLE_VPATH=yes
+ifeq ($(DISABLE_VPATH),yes)
+ CONFIG_H = Config.h
+else
+ VPATH = .:$(BB_SRC_DIR)
+ CONFIG_LIST = $(addsuffix /Config.h,$(subst :, ,$(VPATH)))
+ CONFIG_H = $(word 1,$(shell ls -f -1 $(CONFIG_LIST) 2>/dev/null))
+ CFLAGS += -I- $(patsubst %,-I%,$(subst :, ,$(VPATH)))
+endif
+
+OBJECTS = $(shell $(BB_SRC_DIR)/busybox.sh $(CONFIG_H) $(BB_SRC_DIR)) busybox.o messages.o usage.o utility.o
CFLAGS += -DBB_VER='"$(VERSION)"'
CFLAGS += -DBB_BT='"$(BUILDTIME)"'
ifdef BB_INIT_SCRIPT
@@ -141,17 +157,23 @@ docs/BusyBox.txt: docs/busybox.pod
@echo
@echo BusyBox Documentation
@echo
- - pod2text docs/busybox.pod > docs/BusyBox.txt
+ - mkdir -p docs
+ - (cd $(BB_SRC_DIR); pod2text docs/busybox.pod) > docs/BusyBox.txt
docs/BusyBox.1: docs/busybox.pod
- - pod2man --center=BusyBox --release="version $(VERSION)" docs/busybox.pod > docs/BusyBox.1
+ - mkdir -p docs
+ - (cd $(BB_SRC_DIR); pod2man --center=BusyBox \
+ --release="version $(VERSION)" \
+ docs/busybox.pod ) > docs/BusyBox.1
docs/BusyBox.html: docs/busybox.lineo.com/BusyBox.html
- rm -f docs/BusyBox.html
- - ln -s busybox.lineo.com/BusyBox.html docs/BusyBox.html
+ - ln -s docs/busybox.lineo.com/BusyBox.html docs/BusyBox.html
docs/busybox.lineo.com/BusyBox.html: docs/busybox.pod
- - pod2html --noindex docs/busybox.pod > docs/busybox.lineo.com/BusyBox.html
+ - mkdir -p docs/busybox.lineo.com
+ - (cd $(BB_SRC_DIR); pod2html --noindex docs/busybox.pod ) \
+ > docs/busybox.lineo.com/BusyBox.html
- rm -f pod2html*
@@ -162,18 +184,23 @@ docs/busybox.txt: docs/busybox.sgml
@echo
@echo BusyBox Documentation
@echo
- (cd docs; sgmltools -b txt busybox.sgml)
+ - mkdir -p docs
+ (cd docs; sgmltools -b txt $(BB_SRC_DIR)/busybox.sgml)
docs/busybox.dvi: docs/busybox.sgml
- (cd docs; sgmltools -b dvi busybox.sgml)
+ - mkdir -p docs
+ (cd docs; sgmltools -b dvi $(BB_SRC_DIR)/busybox.sgml)
docs/busybox.ps: docs/busybox.sgml
- (cd docs; sgmltools -b ps busybox.sgml)
+ - mkdir -p docs
+ (cd docs; sgmltools -b ps $(BB_SRC_DIR)/busybox.sgml)
docs/busybox.pdf: docs/busybox.ps
- (cd docs; ps2pdf busybox.ps)
+ - mkdir -p docs
+ (cd docs; ps2pdf $(BB_SRC_DIR)/busybox.ps)
docs/busybox/busyboxdocumentation.html: docs/busybox.sgml
+ - mkdir -p docs
(cd docs/busybox.lineo.com; sgmltools -b html ../busybox.sgml)
@@ -183,15 +210,15 @@ busybox: $(OBJECTS)
$(STRIP)
busybox.links: Config.h
- - ./busybox.mkll | sort >$@
+ -(cd $(BB_SRC_DIR); ./busybox.mkll ) | sort >$@
nfsmount.o cmdedit.o: %.o: %.h
$(OBJECTS): %.o: %.c Config.h busybox.h Makefile
utility.o: loop.h
-loop.h:
- @$(BB_SRC_DIR)/mk_loop_h.sh
+loop.h: mk_loop_h.sh
+ @ sh $<
test tests:
cd tests && $(MAKE) all
@@ -203,7 +230,7 @@ clean:
- rm -f docs/busybox.txt docs/busybox.dvi docs/busybox.ps \
docs/busybox.pdf docs/busybox.lineo.com/busybox.html
- rm -rf docs/busybox _install
- - rm -f busybox.links *~ *.o core
+ - rm -f busybox.links loop.h *~ *.o core
distclean: clean
- rm -f busybox
@@ -215,6 +242,12 @@ install: busybox busybox.links
install-hardlinks: busybox busybox.links
./install.sh $(PREFIX) --hardlinks
+debug_pristine:
+ @ echo VPATH=\"$(VPATH)\"
+ @ echo CONFIG_LIST=\"$(CONFIG_LIST)\"
+ @ echo CONFIG_H=\"$(CONFIG_H)\"
+ @ echo OBJECTS=\"$(OBJECTS)\"
+
dist release: distclean doc
cd ..; \
rm -rf busybox-$(VERSION); \