aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBernhard Reutner-Fischer <rep.dot.nop@gmail.com>2005-10-07 10:53:15 +0000
committerBernhard Reutner-Fischer <rep.dot.nop@gmail.com>2005-10-07 10:53:15 +0000
commit4d63525f76fd783c8ef436996c1b6f1e29dc2945 (patch)
treebd592580fa16e8377f16623a2741073184ec15ba
parentcee605c5253f2ae506ac1ee9e09bec0c2bba30aa (diff)
downloadbusybox-w32-4d63525f76fd783c8ef436996c1b6f1e29dc2945.tar.gz
busybox-w32-4d63525f76fd783c8ef436996c1b6f1e29dc2945.tar.bz2
busybox-w32-4d63525f76fd783c8ef436996c1b6f1e29dc2945.zip
- fix bug #94: 'make install' does not respect PREFIX nor CROSS when using O=
- other minor cosmetic tweaks while at it
-rw-r--r--Makefile48
1 files 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))
35.PHONY: _all 35.PHONY: _all
36_all: 36_all:
37 37
38# All object directories.
39OBJ_DIRS = scripts/config include $(DIRS)
40$(OBJ_DIRS):
41 mkdir -p "$(patsubst %,$(top_builddir)/%,$@)"
42
43scripts/config/Makefile: $(top_srcdir)/scripts/config/Makefile
44 cp -v $< $@
45
46include $(top_srcdir)/Rules.mak
47
48CONFIG_CONFIG_IN = $(top_srcdir)/sysdeps/$(TARGET_OS)/Config.in 38CONFIG_CONFIG_IN = $(top_srcdir)/sysdeps/$(TARGET_OS)/Config.in
49CONFIG_DEFCONFIG = $(top_srcdir)/sysdeps/$(TARGET_OS)/defconfig 39CONFIG_DEFCONFIG = $(top_srcdir)/sysdeps/$(TARGET_OS)/defconfig
50 40
@@ -53,6 +43,7 @@ ifeq ($(KBUILD_SRC),)
53ifdef O 43ifdef O
54 ifeq ("$(origin O)", "command line") 44 ifeq ("$(origin O)", "command line")
55 KBUILD_OUTPUT := $(O) 45 KBUILD_OUTPUT := $(O)
46 top_builddir := $(O)
56 endif 47 endif
57else 48else
58# If no alternate output-dir was specified, we build in cwd 49# If no alternate output-dir was specified, we build in cwd
@@ -61,26 +52,30 @@ else
61 KBUILD_OUTPUT := $(top_builddir) 52 KBUILD_OUTPUT := $(top_builddir)
62endif 53endif
63 54
55# All object directories.
56OBJ_DIRS := $(DIRS)
57all_tree := $(patsubst %,$(top_builddir)/%,$(OBJ_DIRS) scripts scripts/config include)
58all_tree: $(all_tree)
59$(all_tree):
60 @mkdir -p "$@"
61
64ifneq ($(KBUILD_OUTPUT),) 62ifneq ($(KBUILD_OUTPUT),)
65# Invoke a second make in the output directory, passing relevant variables 63# Invoke a second make in the output directory, passing relevant variables
66# check that the output directory actually exists 64# Check that the output directory actually exists
67saved-output := $(KBUILD_OUTPUT) 65saved-output := $(KBUILD_OUTPUT)
68KBUILD_OUTPUT := $(shell cd $(KBUILD_OUTPUT) && /bin/pwd) 66KBUILD_OUTPUT := $(shell cd $(KBUILD_OUTPUT) && /bin/pwd)
69$(if $(wildcard $(KBUILD_OUTPUT)),, \ 67$(if $(wildcard $(KBUILD_OUTPUT)),, \
70 $(error output directory "$(saved-output)" does not exist)) 68 $(error output directory "$(saved-output)" does not exist))
71 69
72# We only need a copy of the Makefile for the config targets and reuse
73# the rest from the source directory, i.e. we do not cp ALL_MAKEFILES.
74all_tree: $(OBJ_DIRS) $(KBUILD_OUTPUT)/Rules.mak $(KBUILD_OUTPUT)/Makefile scripts/config/Makefile
75
76.PHONY: $(MAKECMDGOALS) 70.PHONY: $(MAKECMDGOALS)
77 71
78$(filter-out _all,$(MAKECMDGOALS)) _all: $(KBUILD_OUTPUT)/Rules.mak $(KBUILD_OUTPUT)/Makefile all_tree 72$(filter-out _all,$(MAKECMDGOALS)) _all: $(KBUILD_OUTPUT)/Rules.mak $(KBUILD_OUTPUT)/Makefile all_tree
79#all:
80 $(MAKE) -C $(KBUILD_OUTPUT) \ 73 $(MAKE) -C $(KBUILD_OUTPUT) \
81 top_srcdir=$(top_srcdir) \ 74 top_srcdir=$(top_srcdir) \
82 top_builddir=$(top_builddir) \ 75 top_builddir=$(top_builddir) \
83 KBUILD_SRC=$(top_srcdir) \ 76 KBUILD_SRC=$(top_srcdir) \
77 PREFIX=$(PREFIX) \
78 CROSS=$(CROSS) \
84 -f $(CURDIR)/Makefile $@ 79 -f $(CURDIR)/Makefile $@
85 80
86$(KBUILD_OUTPUT)/Rules.mak: 81$(KBUILD_OUTPUT)/Rules.mak:
@@ -103,6 +98,11 @@ endif # ifeq ($(KBUILD_SRC),)
103 98
104ifeq ($(skip-makefile),) 99ifeq ($(skip-makefile),)
105 100
101# We only need a copy of the Makefile for the config targets and reuse
102# the rest from the source directory, i.e. we do not cp ALL_MAKEFILES.
103scripts/config/Makefile: $(top_srcdir)/scripts/config/Makefile
104 cp $< $@
105
106_all: all 106_all: all
107 107
108help: 108help:
@@ -136,10 +136,21 @@ help:
136 @echo 136 @echo
137 137
138 138
139include $(top_srcdir)/Rules.mak
140
139ifneq ($(strip $(HAVE_DOT_CONFIG)),y) 141ifneq ($(strip $(HAVE_DOT_CONFIG)),y)
140 142
143# Default target if none was requested explicitly
141all: menuconfig 144all: menuconfig
142 145
146# warn if no configuration exists and we are asked to build a non-config target
147.config:
148 @echo ""
149 @echo "No $(top_builddir)/$@ found!"
150 @echo "Please refer to 'make help', section Configuration."
151 @echo ""
152 @exit 1
153
143# configuration 154# configuration
144# --------------------------------------------------------------------------- 155# ---------------------------------------------------------------------------
145 156
@@ -301,11 +312,6 @@ include/bb_config.h: include/config.h
301 < $< >> $@ 312 < $< >> $@
302 @echo "#endif" >> $@ 313 @echo "#endif" >> $@
303 314
304finished2:
305 $(SECHO)
306 $(SECHO) Finished installing...
307 $(SECHO)
308
309clean: 315clean:
310 - $(MAKE) -C scripts/config $@ 316 - $(MAKE) -C scripts/config $@
311 - rm -f docs/busybox.dvi docs/busybox.ps \ 317 - rm -f docs/busybox.dvi docs/busybox.ps \