diff options
author | Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> | 2005-10-07 10:53:15 +0000 |
---|---|---|
committer | Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> | 2005-10-07 10:53:15 +0000 |
commit | 4d63525f76fd783c8ef436996c1b6f1e29dc2945 (patch) | |
tree | bd592580fa16e8377f16623a2741073184ec15ba | |
parent | cee605c5253f2ae506ac1ee9e09bec0c2bba30aa (diff) | |
download | busybox-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-- | Makefile | 48 |
1 files changed, 27 insertions, 21 deletions
@@ -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. | ||
39 | OBJ_DIRS = scripts/config include $(DIRS) | ||
40 | $(OBJ_DIRS): | ||
41 | mkdir -p "$(patsubst %,$(top_builddir)/%,$@)" | ||
42 | |||
43 | scripts/config/Makefile: $(top_srcdir)/scripts/config/Makefile | ||
44 | cp -v $< $@ | ||
45 | |||
46 | include $(top_srcdir)/Rules.mak | ||
47 | |||
48 | CONFIG_CONFIG_IN = $(top_srcdir)/sysdeps/$(TARGET_OS)/Config.in | 38 | CONFIG_CONFIG_IN = $(top_srcdir)/sysdeps/$(TARGET_OS)/Config.in |
49 | CONFIG_DEFCONFIG = $(top_srcdir)/sysdeps/$(TARGET_OS)/defconfig | 39 | CONFIG_DEFCONFIG = $(top_srcdir)/sysdeps/$(TARGET_OS)/defconfig |
50 | 40 | ||
@@ -53,6 +43,7 @@ ifeq ($(KBUILD_SRC),) | |||
53 | ifdef O | 43 | ifdef 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 |
57 | else | 48 | else |
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) |
62 | endif | 53 | endif |
63 | 54 | ||
55 | # All object directories. | ||
56 | OBJ_DIRS := $(DIRS) | ||
57 | all_tree := $(patsubst %,$(top_builddir)/%,$(OBJ_DIRS) scripts scripts/config include) | ||
58 | all_tree: $(all_tree) | ||
59 | $(all_tree): | ||
60 | @mkdir -p "$@" | ||
61 | |||
64 | ifneq ($(KBUILD_OUTPUT),) | 62 | ifneq ($(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 |
67 | saved-output := $(KBUILD_OUTPUT) | 65 | saved-output := $(KBUILD_OUTPUT) |
68 | KBUILD_OUTPUT := $(shell cd $(KBUILD_OUTPUT) && /bin/pwd) | 66 | KBUILD_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. | ||
74 | all_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 | ||
104 | ifeq ($(skip-makefile),) | 99 | ifeq ($(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. | ||
103 | scripts/config/Makefile: $(top_srcdir)/scripts/config/Makefile | ||
104 | cp $< $@ | ||
105 | |||
106 | _all: all | 106 | _all: all |
107 | 107 | ||
108 | help: | 108 | help: |
@@ -136,10 +136,21 @@ help: | |||
136 | @echo | 136 | @echo |
137 | 137 | ||
138 | 138 | ||
139 | include $(top_srcdir)/Rules.mak | ||
140 | |||
139 | ifneq ($(strip $(HAVE_DOT_CONFIG)),y) | 141 | ifneq ($(strip $(HAVE_DOT_CONFIG)),y) |
140 | 142 | ||
143 | # Default target if none was requested explicitly | ||
141 | all: menuconfig | 144 | all: 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 | ||
304 | finished2: | ||
305 | $(SECHO) | ||
306 | $(SECHO) Finished installing... | ||
307 | $(SECHO) | ||
308 | |||
309 | clean: | 315 | clean: |
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 \ |