From 4d63525f76fd783c8ef436996c1b6f1e29dc2945 Mon Sep 17 00:00:00 2001 From: Bernhard Reutner-Fischer Date: Fri, 7 Oct 2005 10:53:15 +0000 Subject: [PATCH] - fix bug #94: 'make install' does not respect PREFIX nor CROSS when using O= - other minor cosmetic tweaks while at it --- Makefile | 48 +++++++++++++++++++++++++++--------------------- 1 file changed, 27 insertions(+), 21 deletions(-) diff --git a/Makefile b/Makefile index e38e3e253..cfa5e52de 100644 --- a/Makefile +++ b/Makefile @@ -35,16 +35,6 @@ SRC_DIRS:=$(patsubst %,$(top_srcdir)/%,$(DIRS)) .PHONY: _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_DEFCONFIG = $(top_srcdir)/sysdeps/$(TARGET_OS)/defconfig @@ -53,6 +43,7 @@ ifeq ($(KBUILD_SRC),) ifdef O ifeq ("$(origin O)", "command line") KBUILD_OUTPUT := $(O) + top_builddir := $(O) endif else # If no alternate output-dir was specified, we build in cwd @@ -61,26 +52,30 @@ else KBUILD_OUTPUT := $(top_builddir) 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),) # 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) KBUILD_OUTPUT := $(shell cd $(KBUILD_OUTPUT) && /bin/pwd) $(if $(wildcard $(KBUILD_OUTPUT)),, \ $(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) $(filter-out _all,$(MAKECMDGOALS)) _all: $(KBUILD_OUTPUT)/Rules.mak $(KBUILD_OUTPUT)/Makefile all_tree -#all: $(MAKE) -C $(KBUILD_OUTPUT) \ top_srcdir=$(top_srcdir) \ top_builddir=$(top_builddir) \ KBUILD_SRC=$(top_srcdir) \ + PREFIX=$(PREFIX) \ + CROSS=$(CROSS) \ -f $(CURDIR)/Makefile $@ $(KBUILD_OUTPUT)/Rules.mak: @@ -103,6 +98,11 @@ endif # ifeq ($(KBUILD_SRC),) 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 help: @@ -136,10 +136,21 @@ help: @echo +include $(top_srcdir)/Rules.mak + ifneq ($(strip $(HAVE_DOT_CONFIG)),y) +# Default target if none was requested explicitly 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 # --------------------------------------------------------------------------- @@ -301,11 +312,6 @@ include/bb_config.h: include/config.h < $< >> $@ @echo "#endif" >> $@ -finished2: - $(SECHO) - $(SECHO) Finished installing... - $(SECHO) - clean: - $(MAKE) -C scripts/config $@ - rm -f docs/busybox.dvi docs/busybox.ps \