diff options
| author | andersen <andersen@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2002-12-05 08:41:41 +0000 |
|---|---|---|
| committer | andersen <andersen@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2002-12-05 08:41:41 +0000 |
| commit | e40a650628ce6b03e67c4c6d96ea396e7bd2afb3 (patch) | |
| tree | 72904548bb54dcaf78017d3b35296765437e0bd5 /Makefile | |
| parent | 49ec1a2dc6dfba670b3659286524fd5baf12e6fe (diff) | |
| download | busybox-w32-e40a650628ce6b03e67c4c6d96ea396e7bd2afb3.tar.gz busybox-w32-e40a650628ce6b03e67c4c6d96ea396e7bd2afb3.tar.bz2 busybox-w32-e40a650628ce6b03e67c4c6d96ea396e7bd2afb3.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
git-svn-id: svn://busybox.net/trunk/busybox@6102 69ca8d6d-28ef-0310-b511-8ec308f3f277
Diffstat (limited to 'Makefile')
| -rw-r--r-- | Makefile | 163 |
1 files changed, 76 insertions, 87 deletions
| @@ -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 | ||
| 20 | TOPDIR:= $(shell /bin/pwd)/ | 20 | #-------------------------------------------------------------- |
| 21 | include $(TOPDIR).config | 21 | # You shouldn't need to mess with anything beyond this point... |
| 22 | include $(TOPDIR)Rules.mak | 22 | #-------------------------------------------------------------- |
| 23 | SUBDIRS:=applets archival archival/libunarchive console-tools debianutils \ | 23 | noconfig_targets := menuconfig config oldconfig randconfig \ |
| 24 | defconfig allyesconfig allnoconfig clean distclean \ | ||
| 25 | release tags | ||
| 26 | TOPDIR=./ | ||
| 27 | include Rules.mak | ||
| 28 | |||
| 29 | DIRS:=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 | ||
| 28 | all: do-it-all | 34 | ifdef include_config |
| 29 | 35 | ||
| 30 | # | 36 | all: 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. | ||
| 33 | ifeq (.config,$(wildcard .config)) | ||
| 34 | include .config | ||
| 35 | ifeq (.depend,$(wildcard .depend)) | ||
| 36 | include .depend | ||
| 37 | do-it-all: busybox busybox.links #doc | ||
| 38 | include $(patsubst %,%/Makefile.in, $(SUBDIRS)) | ||
| 39 | else | ||
| 40 | CONFIGURATION = depend | ||
| 41 | do-it-all: depend | ||
| 42 | endif | ||
| 43 | else | ||
| 44 | CONFIGURATION = menuconfig | ||
| 45 | do-it-all: menuconfig | ||
| 46 | endif | ||
| 47 | 37 | ||
| 38 | # In this section, we need .config | ||
| 39 | -include .config.cmd | ||
| 40 | include $(patsubst %,%/Makefile.in, $(DIRS)) | ||
| 48 | 41 | ||
| 49 | busybox: depend $(libraries-y) | 42 | busybox: 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 | 121 | scripts/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 | 124 | scripts/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 | |||
| 147 | depend dep: $(TOPDIR)include/config.h $(TOPDIR).depend | ||
| 148 | 136 | ||
| 149 | BB_SHELL := ${shell if [ -x "$$BASH" ]; then echo $$BASH; \ | 137 | depend dep: include/config.h .depend |
| 150 | else if [ -x /bin/bash ]; then echo /bin/bash; \ | ||
| 151 | else echo sh; fi ; fi} | ||
| 152 | 138 | ||
| 153 | include/config/MARKER: depend $(TOPDIR)scripts/split-include | 139 | include/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: | 143 | include/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 | ||
| 167 | menuconfig: $(TOPDIR).config | 152 | finished2: |
| 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 | ||
| 172 | config: $(TOPDIR).config | 157 | else # ifdef include_config |
| 173 | mkdir -p $(TOPDIR)include/config | ||
| 174 | $(BB_SHELL) scripts/Configure sysdeps/$(TARGET_OS)/config.in | ||
| 175 | 158 | ||
| 176 | oldconfig: $(TOPDIR).config | 159 | all: menuconfig |
| 177 | mkdir -p $(TOPDIR)include/config | ||
| 178 | $(BB_SHELL) scripts/Configure -d sysdeps/$(TARGET_OS)/config.in | ||
| 179 | 160 | ||
| 161 | ifeq ($(filter-out $(noconfig_targets),$(MAKECMDGOALS)),) | ||
| 162 | # Targets which don't need .config | ||
| 180 | 163 | ||
| 181 | ifdef 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 | ||
| 192 | dummy: | 167 | scripts/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 | ||
| 194 | else | 173 | menuconfig: scripts/config/mconf |
| 174 | @./scripts/config/mconf sysdeps/$(TARGET_OS)/Config.in | ||
| 195 | 175 | ||
| 196 | dummy: | 176 | config: scripts/config/conf |
| 177 | @./scripts/config/conf sysdeps/$(TARGET_OS)/Config.in | ||
| 197 | 178 | ||
| 198 | endif | 179 | oldconfig: scripts/config/conf |
| 180 | @./scripts/config/conf -o sysdeps/$(TARGET_OS)/Config.in | ||
| 199 | 181 | ||
| 182 | randconfig: scripts/config/conf | ||
| 183 | @./scripts/config/conf -r sysdeps/$(TARGET_OS)/Config.in | ||
| 200 | 184 | ||
| 201 | %.o: %.c | 185 | allyesconfig: scripts/config/conf |
| 202 | $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -c -o $@ $< | 186 | @./scripts/config/conf -y sysdeps/$(TARGET_OS)/Config.in |
| 187 | |||
| 188 | allnoconfig: scripts/config/conf | ||
| 189 | @./scripts/config/conf -n sysdeps/$(TARGET_OS)/Config.in | ||
| 203 | 190 | ||
| 191 | defconfig: scripts/config/conf | ||
| 192 | @./scripts/config/conf -d sysdeps/$(TARGET_OS)/Config.in | ||
| 204 | 193 | ||
| 205 | # Testing... | 194 | test tests: busybox |
| 206 | test 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 | 199 | check: busybox |
| 200 | cd testsuite && ./runtest | ||
| 201 | |||
| 213 | clean: | 202 | clean: |
| 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 | ||
| 229 | distclean: clean | 218 | distclean: clean |
| 230 | - rm -f busybox | 219 | rm -f .config .config.old .config.cmd |
| 231 | - cd tests && $(MAKE) distclean | ||
| 232 | 220 | ||
| 233 | dist release: distclean doc | 221 | release: 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 | ||
| 238 | tags: | ||
| 239 | ctags -R . | ||
| 250 | 240 | ||
| 251 | 241 | ||
| 252 | .PHONY: tags check depend | 242 | endif # ifeq ($(filter-out $(noconfig_targets),$(MAKECMDGOALS)),) |
| 243 | endif # ifdef include_config | ||
| 253 | 244 | ||
| 254 | tags: | 245 | .PHONY: dummy subdirs release distclean clean config oldconfig \ |
| 255 | ctags -R . | 246 | menuconfig tags check test tests depend |
| 256 | 247 | ||
| 257 | check: busybox | ||
| 258 | cd testsuite && ./runtest | ||
| 259 | 248 | ||
