summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2002-12-05 08:41:41 +0000
committerEric Andersen <andersen@codepoet.org>2002-12-05 08:41:41 +0000
commitc9f20d9fb93c6c316518483fd103f3afab5cf1af (patch)
tree72904548bb54dcaf78017d3b35296765437e0bd5 /Makefile
parentdeca106b6dad70ad0a1312a82d762aa8d8ad52ba (diff)
downloadbusybox-w32-c9f20d9fb93c6c316518483fd103f3afab5cf1af.tar.gz
busybox-w32-c9f20d9fb93c6c316518483fd103f3afab5cf1af.tar.bz2
busybox-w32-c9f20d9fb93c6c316518483fd103f3afab5cf1af.zip
Yet another major rework of the BusyBox config system, using the considerably
modified Kbuild system I put into uClibc. With this, there should be no more need to modify Rules.mak since I've moved all the interesting options into the config system. I think I've got everything updated, but you never know, I may have made some mistakes, so watch closely. -Erik
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile163
1 files changed, 76 insertions, 87 deletions
diff --git a/Makefile b/Makefile
index d61d945a6..69ab48ec3 100644
--- a/Makefile
+++ b/Makefile
@@ -17,34 +17,27 @@
17# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18# 18#
19 19
20TOPDIR:= $(shell /bin/pwd)/ 20#--------------------------------------------------------------
21include $(TOPDIR).config 21# You shouldn't need to mess with anything beyond this point...
22include $(TOPDIR)Rules.mak 22#--------------------------------------------------------------
23SUBDIRS:=applets archival archival/libunarchive console-tools debianutils \ 23noconfig_targets := menuconfig config oldconfig randconfig \
24 defconfig allyesconfig allnoconfig clean distclean \
25 release tags
26TOPDIR=./
27include Rules.mak
28
29DIRS:=applets archival archival/libunarchive console-tools debianutils \
24 editors fileutils findutils init miscutils modutils networking \ 30 editors fileutils findutils init miscutils modutils networking \
25 networking/libiproute networking/udhcp procps loginutils shell \ 31 networking/libiproute networking/udhcp procps loginutils shell \
26 shellutils sysklogd textutils util-linux libbb libpwdgrp 32 shellutils sysklogd textutils util-linux libbb libpwdgrp
27 33
28all: do-it-all 34ifdef include_config
29 35
30# 36all: busybox busybox.links #doc
31# Make "config" the default target if there is no configuration file or
32# "depend" the target if there is no top-level dependency information.
33ifeq (.config,$(wildcard .config))
34include .config
35ifeq (.depend,$(wildcard .depend))
36include .depend
37do-it-all: busybox busybox.links #doc
38include $(patsubst %,%/Makefile.in, $(SUBDIRS))
39else
40CONFIGURATION = depend
41do-it-all: depend
42endif
43else
44CONFIGURATION = menuconfig
45do-it-all: menuconfig
46endif
47 37
38# In this section, we need .config
39-include .config.cmd
40include $(patsubst %,%/Makefile.in, $(DIRS))
48 41
49busybox: depend $(libraries-y) 42busybox: depend $(libraries-y)
50 $(CC) $(LDFLAGS) -o $@ $(libraries-y) $(LIBRARIES) 43 $(CC) $(LDFLAGS) -o $@ $(libraries-y) $(LIBRARIES)
@@ -124,92 +117,88 @@ docs/busybox/busyboxdocumentation.html: docs/busybox.sgml
124 - mkdir -p docs 117 - mkdir -p docs
125 (cd docs/busybox.net; sgmltools -b html ../busybox.sgml) 118 (cd docs/busybox.net; sgmltools -b html ../busybox.sgml)
126 119
127
128
129# The nifty new buildsystem stuff 120# The nifty new buildsystem stuff
130$(TOPDIR)scripts/mkdep: scripts/mkdep.c 121scripts/mkdep: scripts/mkdep.c
131 $(HOSTCC) $(HOSTCFLAGS) -o scripts/mkdep scripts/mkdep.c 122 $(HOSTCC) $(HOSTCFLAGS) -o scripts/mkdep scripts/mkdep.c
132 123
133$(TOPDIR)scripts/split-include: scripts/split-include.c 124scripts/split-include: scripts/split-include.c
134 $(HOSTCC) $(HOSTCFLAGS) -o scripts/split-include scripts/split-include.c 125 $(HOSTCC) $(HOSTCFLAGS) -o scripts/split-include scripts/split-include.c
135 126
136$(TOPDIR).depend: $(TOPDIR)scripts/mkdep 127.depend: scripts/mkdep
137 rm -f .depend .hdepend; 128 rm -f .depend .hdepend;
138 mkdir -p $(TOPDIR)include/config; 129 mkdir -p include/config;
139 $(HOSTCC) $(HOSTCFLAGS) -o scripts/mkdep scripts/mkdep.c 130 $(HOSTCC) $(HOSTCFLAGS) -o scripts/mkdep scripts/mkdep.c
140 scripts/mkdep -I $(TOPDIR)include -- \ 131 scripts/mkdep -I include -- \
141 `find $(TOPDIR) -name \*.c -print` >> .depend; 132 `find . -name \*.c -print` >> .depend;
142 scripts/mkdep -I $(TOPDIR)include -- \ 133 scripts/mkdep -I include -- \
143 `find $(TOPDIR) -name \*.h -print` >> .hdepend; 134 `find . -name \*.h -print` >> .hdepend;
144 $(MAKE) $(patsubst %,_sfdep_%,$(SUBDIRS)) _FASTDEP_ALL_SUB_DIRS="$(SUBDIRS)" ; 135 $(MAKE) $(patsubst %,_sfdep_%,$(DIRS)) _FASTDEP_ALL_SUB_DIRS="$(DIRS)" ;
145 @ echo -e "\n\nNow run 'make' to build BusyBox\n\n"
146
147depend dep: $(TOPDIR)include/config.h $(TOPDIR).depend
148 136
149BB_SHELL := ${shell if [ -x "$$BASH" ]; then echo $$BASH; \ 137depend dep: include/config.h .depend
150 else if [ -x /bin/bash ]; then echo /bin/bash; \
151 else echo sh; fi ; fi}
152 138
153include/config/MARKER: depend $(TOPDIR)scripts/split-include 139include/config/MARKER: depend scripts/split-include
154 scripts/split-include include/config.h include/config 140 scripts/split-include include/config.h include/config
155 @ touch include/config/MARKER 141 @ touch include/config/MARKER
156 142
157$(TOPDIR)include/config.h: 143include/config.h: .config
158 @if [ ! -f $(TOPDIR)include/config.h ] ; then \ 144 @if [ ! -x ./scripts/config/conf ] ; then \
159 make oldconfig; \ 145 make -C scripts/config; \
160 fi; 146 fi;
147 @./scripts/config/conf -o sysdeps/$(TARGET_OS)/Config.in
161 148
162$(TOPDIR).config: 149%.o: %.c
163 @if [ ! -f $(TOPDIR).config ] ; then \ 150 $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -c -o $@ $<
164 cp $(TOPDIR)sysdeps/$(TARGET_OS)/defconfig $(TOPDIR).config; \
165 fi;
166 151
167menuconfig: $(TOPDIR).config 152finished2:
168 mkdir -p $(TOPDIR)include/config 153 @echo
169 $(MAKE) -C scripts/lxdialog all 154 @echo Finished installing...
170 $(BB_SHELL) scripts/Menuconfig sysdeps/$(TARGET_OS)/config.in 155 @echo
171 156
172config: $(TOPDIR).config 157else # ifdef include_config
173 mkdir -p $(TOPDIR)include/config
174 $(BB_SHELL) scripts/Configure sysdeps/$(TARGET_OS)/config.in
175 158
176oldconfig: $(TOPDIR).config 159all: menuconfig
177 mkdir -p $(TOPDIR)include/config
178 $(BB_SHELL) scripts/Configure -d sysdeps/$(TARGET_OS)/config.in
179 160
161ifeq ($(filter-out $(noconfig_targets),$(MAKECMDGOALS)),)
162# Targets which don't need .config
180 163
181ifdef CONFIGURATION 164# configuration
182..$(CONFIGURATION): 165# ---------------------------------------------------------------------------
183 @echo
184 @echo "You have a bad or nonexistent" .$(CONFIGURATION) ": running 'make" $(CONFIGURATION)"'"
185 @echo
186 $(MAKE) $(CONFIGURATION)
187 @echo
188 @echo "Successful. Try re-making (ignore the error that follows)"
189 @echo
190 exit 1
191 166
192dummy: 167scripts/config/conf scripts/config/mconf:
168 make -C scripts/config
169 -@if [ ! -f .config ] ; then \
170 cp sysdeps/$(TARGET_OS)/defconfig .config; \
171 fi
193 172
194else 173menuconfig: scripts/config/mconf
174 @./scripts/config/mconf sysdeps/$(TARGET_OS)/Config.in
195 175
196dummy: 176config: scripts/config/conf
177 @./scripts/config/conf sysdeps/$(TARGET_OS)/Config.in
197 178
198endif 179oldconfig: scripts/config/conf
180 @./scripts/config/conf -o sysdeps/$(TARGET_OS)/Config.in
199 181
182randconfig: scripts/config/conf
183 @./scripts/config/conf -r sysdeps/$(TARGET_OS)/Config.in
200 184
201%.o: %.c 185allyesconfig: scripts/config/conf
202 $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -c -o $@ $< 186 @./scripts/config/conf -y sysdeps/$(TARGET_OS)/Config.in
187
188allnoconfig: scripts/config/conf
189 @./scripts/config/conf -n sysdeps/$(TARGET_OS)/Config.in
203 190
191defconfig: scripts/config/conf
192 @./scripts/config/conf -d sysdeps/$(TARGET_OS)/Config.in
204 193
205# Testing... 194test tests: busybox
206test tests: 195 # Note that 'tests' is depricated. Use 'make check' instead
207 # old way of doing it 196 # To use the nice new testsuite....
208 #cd tests && $(MAKE) all
209 # new way of doing it
210 cd tests && ./tester.sh 197 cd tests && ./tester.sh
211 198
212# Cleanup 199check: busybox
200 cd testsuite && ./runtest
201
213clean: 202clean:
214 - $(MAKE) -C tests clean 203 - $(MAKE) -C tests clean
215 - $(MAKE) -C scripts/lxdialog clean 204 - $(MAKE) -C scripts/lxdialog clean
@@ -227,10 +216,9 @@ clean:
227 - find . -name \*.a -exec rm -f {} \; 216 - find . -name \*.a -exec rm -f {} \;
228 217
229distclean: clean 218distclean: clean
230 - rm -f busybox 219 rm -f .config .config.old .config.cmd
231 - cd tests && $(MAKE) distclean
232 220
233dist release: distclean doc 221release: distclean #doc
234 cd ..; \ 222 cd ..; \
235 rm -rf busybox-$(VERSION); \ 223 rm -rf busybox-$(VERSION); \
236 cp -a busybox busybox-$(VERSION); \ 224 cp -a busybox busybox-$(VERSION); \
@@ -247,13 +235,14 @@ dist release: distclean doc
247 \ 235 \
248 tar -cvzf busybox-$(VERSION).tar.gz busybox-$(VERSION)/; 236 tar -cvzf busybox-$(VERSION).tar.gz busybox-$(VERSION)/;
249 237
238tags:
239 ctags -R .
250 240
251 241
252.PHONY: tags check depend 242endif # ifeq ($(filter-out $(noconfig_targets),$(MAKECMDGOALS)),)
243endif # ifdef include_config
253 244
254tags: 245.PHONY: dummy subdirs release distclean clean config oldconfig \
255 ctags -R . 246 menuconfig tags check test tests depend
256 247
257check: busybox
258 cd testsuite && ./runtest
259 248