- fix bug #94: 'make install' does not respect PREFIX nor CROSS when using O=

- other minor cosmetic tweaks while at it
This commit is contained in:
Bernhard Reutner-Fischer 2005-10-07 10:53:15 +00:00
parent cee605c525
commit 4d63525f76

View File

@ -35,16 +35,6 @@ SRC_DIRS:=$(patsubst %,$(top_srcdir)/%,$(DIRS))
.PHONY: _all .PHONY: _all
_all: _all:
# All object directories.
OBJ_DIRS = scripts/config include $(DIRS)
$(OBJ_DIRS):
mkdir -p "$(patsubst %,$(top_builddir)/%,$@)"
scripts/config/Makefile: $(top_srcdir)/scripts/config/Makefile
cp -v $< $@
include $(top_srcdir)/Rules.mak
CONFIG_CONFIG_IN = $(top_srcdir)/sysdeps/$(TARGET_OS)/Config.in CONFIG_CONFIG_IN = $(top_srcdir)/sysdeps/$(TARGET_OS)/Config.in
CONFIG_DEFCONFIG = $(top_srcdir)/sysdeps/$(TARGET_OS)/defconfig CONFIG_DEFCONFIG = $(top_srcdir)/sysdeps/$(TARGET_OS)/defconfig
@ -53,6 +43,7 @@ ifeq ($(KBUILD_SRC),)
ifdef O ifdef O
ifeq ("$(origin O)", "command line") ifeq ("$(origin O)", "command line")
KBUILD_OUTPUT := $(O) KBUILD_OUTPUT := $(O)
top_builddir := $(O)
endif endif
else else
# If no alternate output-dir was specified, we build in cwd # If no alternate output-dir was specified, we build in cwd
@ -61,26 +52,30 @@ else
KBUILD_OUTPUT := $(top_builddir) KBUILD_OUTPUT := $(top_builddir)
endif endif
# All object directories.
OBJ_DIRS := $(DIRS)
all_tree := $(patsubst %,$(top_builddir)/%,$(OBJ_DIRS) scripts scripts/config include)
all_tree: $(all_tree)
$(all_tree):
@mkdir -p "$@"
ifneq ($(KBUILD_OUTPUT),) ifneq ($(KBUILD_OUTPUT),)
# Invoke a second make in the output directory, passing relevant variables # Invoke a second make in the output directory, passing relevant variables
# check that the output directory actually exists # Check that the output directory actually exists
saved-output := $(KBUILD_OUTPUT) saved-output := $(KBUILD_OUTPUT)
KBUILD_OUTPUT := $(shell cd $(KBUILD_OUTPUT) && /bin/pwd) KBUILD_OUTPUT := $(shell cd $(KBUILD_OUTPUT) && /bin/pwd)
$(if $(wildcard $(KBUILD_OUTPUT)),, \ $(if $(wildcard $(KBUILD_OUTPUT)),, \
$(error output directory "$(saved-output)" does not exist)) $(error output directory "$(saved-output)" does not exist))
# We only need a copy of the Makefile for the config targets and reuse
# the rest from the source directory, i.e. we do not cp ALL_MAKEFILES.
all_tree: $(OBJ_DIRS) $(KBUILD_OUTPUT)/Rules.mak $(KBUILD_OUTPUT)/Makefile scripts/config/Makefile
.PHONY: $(MAKECMDGOALS) .PHONY: $(MAKECMDGOALS)
$(filter-out _all,$(MAKECMDGOALS)) _all: $(KBUILD_OUTPUT)/Rules.mak $(KBUILD_OUTPUT)/Makefile all_tree $(filter-out _all,$(MAKECMDGOALS)) _all: $(KBUILD_OUTPUT)/Rules.mak $(KBUILD_OUTPUT)/Makefile all_tree
#all:
$(MAKE) -C $(KBUILD_OUTPUT) \ $(MAKE) -C $(KBUILD_OUTPUT) \
top_srcdir=$(top_srcdir) \ top_srcdir=$(top_srcdir) \
top_builddir=$(top_builddir) \ top_builddir=$(top_builddir) \
KBUILD_SRC=$(top_srcdir) \ KBUILD_SRC=$(top_srcdir) \
PREFIX=$(PREFIX) \
CROSS=$(CROSS) \
-f $(CURDIR)/Makefile $@ -f $(CURDIR)/Makefile $@
$(KBUILD_OUTPUT)/Rules.mak: $(KBUILD_OUTPUT)/Rules.mak:
@ -103,6 +98,11 @@ endif # ifeq ($(KBUILD_SRC),)
ifeq ($(skip-makefile),) ifeq ($(skip-makefile),)
# We only need a copy of the Makefile for the config targets and reuse
# the rest from the source directory, i.e. we do not cp ALL_MAKEFILES.
scripts/config/Makefile: $(top_srcdir)/scripts/config/Makefile
cp $< $@
_all: all _all: all
help: help:
@ -136,10 +136,21 @@ help:
@echo @echo
include $(top_srcdir)/Rules.mak
ifneq ($(strip $(HAVE_DOT_CONFIG)),y) ifneq ($(strip $(HAVE_DOT_CONFIG)),y)
# Default target if none was requested explicitly
all: menuconfig all: menuconfig
# warn if no configuration exists and we are asked to build a non-config target
.config:
@echo ""
@echo "No $(top_builddir)/$@ found!"
@echo "Please refer to 'make help', section Configuration."
@echo ""
@exit 1
# configuration # configuration
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
@ -301,11 +312,6 @@ include/bb_config.h: include/config.h
< $< >> $@ < $< >> $@
@echo "#endif" >> $@ @echo "#endif" >> $@
finished2:
$(SECHO)
$(SECHO) Finished installing...
$(SECHO)
clean: clean:
- $(MAKE) -C scripts/config $@ - $(MAKE) -C scripts/config $@
- rm -f docs/busybox.dvi docs/busybox.ps \ - rm -f docs/busybox.dvi docs/busybox.ps \