1 | # Makefile for busybox
|
---|
2 | #
|
---|
3 | # Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
|
---|
4 | #
|
---|
5 | # Licensed under GPLv2, see the file LICENSE in this tarball for details.
|
---|
6 | #
|
---|
7 |
|
---|
8 | # You shouldn't have to edit anything in this file for configuration
|
---|
9 | # purposes, try "make help" or read http://busybox.net/FAQ.html.
|
---|
10 |
|
---|
11 | .PHONY: dummy subdirs release distclean clean config oldconfig menuconfig \
|
---|
12 | tags check test depend dep buildtree hosttools _all checkhelp \
|
---|
13 | sizes bloatcheck baseline objsizes
|
---|
14 |
|
---|
15 | noconfig_targets := menuconfig config oldconfig randconfig hosttools \
|
---|
16 | defconfig allyesconfig allnoconfig allbareconfig \
|
---|
17 | clean distclean help \
|
---|
18 | release tags
|
---|
19 |
|
---|
20 | nocheck_targets := clean distclean help release tags
|
---|
21 |
|
---|
22 | # the toplevel sourcedir
|
---|
23 | ifndef top_srcdir
|
---|
24 | top_srcdir=$(CURDIR)
|
---|
25 | endif
|
---|
26 | # toplevel directory of the object-tree
|
---|
27 | ifndef top_builddir
|
---|
28 | top_builddir=$(CURDIR)
|
---|
29 | endif
|
---|
30 |
|
---|
31 | export srctree=$(top_srcdir)
|
---|
32 | vpath %/Config.in $(srctree)
|
---|
33 |
|
---|
34 | DIRS:=applets archival archival/libunarchive coreutils console-tools \
|
---|
35 | debianutils editors findutils init miscutils modutils networking \
|
---|
36 | networking/libiproute networking/udhcp procps loginutils shell \
|
---|
37 | sysklogd util-linux e2fsprogs libpwdgrp coreutils/libcoreutils libbb
|
---|
38 |
|
---|
39 | SRC_DIRS:=$(patsubst %,$(top_srcdir)/%,$(DIRS))
|
---|
40 |
|
---|
41 | # That's our default target when none is given on the command line
|
---|
42 | _all:
|
---|
43 |
|
---|
44 | CONFIG_CONFIG_IN = $(top_srcdir)/Config.in
|
---|
45 |
|
---|
46 | ifeq ($(BUILD_SRC),)
|
---|
47 | ifdef O
|
---|
48 | ifeq ("$(origin O)", "command line")
|
---|
49 | BUILD_OUTPUT := $(O)
|
---|
50 | top_builddir := $(O)
|
---|
51 | endif
|
---|
52 | else
|
---|
53 | # If no alternate output-dir was specified, we build in cwd
|
---|
54 | # We are using BUILD_OUTPUT nevertheless to make sure that we create
|
---|
55 | # Rules.mak and the toplevel Makefile, in case they don't exist.
|
---|
56 | BUILD_OUTPUT := $(top_builddir)
|
---|
57 | endif
|
---|
58 |
|
---|
59 | # see if we are in verbose mode
|
---|
60 | BUILD_VERBOSE :=
|
---|
61 | ifdef V
|
---|
62 | ifeq ("$(origin V)", "command line")
|
---|
63 | BUILD_VERBOSE := $(V)
|
---|
64 | endif
|
---|
65 | endif
|
---|
66 | ifdef VERBOSE
|
---|
67 | ifeq ("$(origin VERBOSE)", "command line")
|
---|
68 | BUILD_VERBOSE := $(VERBOSE)
|
---|
69 | endif
|
---|
70 | endif
|
---|
71 |
|
---|
72 | ifneq ($(strip $(BUILD_VERBOSE)),)
|
---|
73 | export BUILD_VERBOSE
|
---|
74 | CHECK_VERBOSE := -v
|
---|
75 | # ARFLAGS+=v
|
---|
76 | endif
|
---|
77 |
|
---|
78 | ifneq ($(strip $(HAVE_DOT_CONFIG)),y)
|
---|
79 | # pull in settings early
|
---|
80 | -include $(top_srcdir)/Rules.mak
|
---|
81 | endif
|
---|
82 |
|
---|
83 | # All object directories.
|
---|
84 | OBJ_DIRS := $(DIRS)
|
---|
85 | all_tree := $(patsubst %,$(top_builddir)/%,$(OBJ_DIRS) scripts scripts/config include)
|
---|
86 | all_tree: $(all_tree)
|
---|
87 | $(all_tree):
|
---|
88 | @mkdir -p "$@"
|
---|
89 |
|
---|
90 | ifneq ($(BUILD_OUTPUT),)
|
---|
91 | # Invoke a second make in the output directory, passing relevant variables
|
---|
92 | # Check that the output directory actually exists
|
---|
93 | saved-output := $(BUILD_OUTPUT)
|
---|
94 | BUILD_OUTPUT := $(shell cd $(BUILD_OUTPUT) && /bin/pwd)
|
---|
95 | $(if $(wildcard $(BUILD_OUTPUT)),, \
|
---|
96 | $(error output directory "$(saved-output)" does not exist))
|
---|
97 |
|
---|
98 | .PHONY: $(MAKECMDGOALS)
|
---|
99 |
|
---|
100 | $(filter-out _all,$(MAKECMDGOALS)) _all: $(BUILD_OUTPUT)/Rules.mak $(BUILD_OUTPUT)/Makefile all_tree
|
---|
101 | $(Q)$(MAKE) -C $(BUILD_OUTPUT) \
|
---|
102 | top_srcdir=$(top_srcdir) \
|
---|
103 | top_builddir=$(top_builddir) \
|
---|
104 | BUILD_SRC=$(top_srcdir) \
|
---|
105 | -f $(CURDIR)/Makefile $@
|
---|
106 |
|
---|
107 | $(BUILD_OUTPUT)/Rules.mak:
|
---|
108 | @echo > $@
|
---|
109 | @echo top_srcdir=$(top_srcdir) >> $@
|
---|
110 | @echo top_builddir=$(BUILD_OUTPUT) >> $@
|
---|
111 | @echo include $(top_srcdir)/Rules.mak >> $@
|
---|
112 |
|
---|
113 | $(BUILD_OUTPUT)/Makefile:
|
---|
114 | @echo > $@
|
---|
115 | @echo top_srcdir=$(top_srcdir) >> $@
|
---|
116 | @echo top_builddir=$(BUILD_OUTPUT) >> $@
|
---|
117 | @echo BUILD_SRC='$$(top_srcdir)' >> $@
|
---|
118 | @echo include '$$(BUILD_SRC)'/Makefile >> $@
|
---|
119 |
|
---|
120 | # Leave processing to above invocation of make
|
---|
121 | skip-makefile := 1
|
---|
122 | endif # ifneq ($(BUILD_OUTPUT),)
|
---|
123 | endif # ifeq ($(BUILD_SRC),)
|
---|
124 |
|
---|
125 | ifeq ($(skip-makefile),)
|
---|
126 |
|
---|
127 | # We only need a copy of the Makefile for the config targets and reuse
|
---|
128 | # the rest from the source directory, i.e. we do not cp ALL_MAKEFILES.
|
---|
129 | scripts/config/Makefile: $(top_srcdir)/scripts/config/Makefile
|
---|
130 | cp $< $@
|
---|
131 |
|
---|
132 | _all: all
|
---|
133 |
|
---|
134 | help:
|
---|
135 | @echo 'Cleaning:'
|
---|
136 | @echo ' clean - delete temporary files created by build'
|
---|
137 | @echo ' distclean - delete all non-source files (including .config)'
|
---|
138 | @echo
|
---|
139 | @echo 'Build:'
|
---|
140 | @echo ' all - Executable and documentation'
|
---|
141 | @echo ' busybox - the swiss-army executable'
|
---|
142 | @echo ' doc - docs/BusyBox.{txt,html,1}'
|
---|
143 | @echo ' html - create html-based cross-reference'
|
---|
144 | @echo
|
---|
145 | @echo 'Configuration:'
|
---|
146 | @echo ' allnoconfig - disable all symbols in .config'
|
---|
147 | @echo ' allyesconfig - enable all symbols in .config (see defconfig)'
|
---|
148 | @echo ' allbareconfig - enable all applets without any sub-features'
|
---|
149 | @echo ' config - text based configurator (of last resort)'
|
---|
150 | @echo ' defconfig - set .config to largest generic configuration'
|
---|
151 | @echo ' menuconfig - interactive curses-based configurator'
|
---|
152 | @echo ' oldconfig - resolve any unresolved symbols in .config'
|
---|
153 | @echo ' hosttools - build sed for the host.'
|
---|
154 | @echo ' You can use these commands if the commands on the host'
|
---|
155 | @echo ' is unusable. Afterwards use it like:'
|
---|
156 | @echo ' make SED="$(top_builddir)/sed"'
|
---|
157 | @echo
|
---|
158 | @echo 'Installation:'
|
---|
159 | @echo ' install - install busybox into $(PREFIX)'
|
---|
160 | @echo ' uninstall'
|
---|
161 | @echo
|
---|
162 | @echo 'Development:'
|
---|
163 | @echo ' baseline - create busybox_old for bloatcheck.'
|
---|
164 | @echo ' bloatcheck - show size difference between old and new versions'
|
---|
165 | @echo ' check - run the test suite for all applets'
|
---|
166 | @echo ' checkhelp - check for missing help-entries in Config.in'
|
---|
167 | @echo ' randconfig - generate a random configuration'
|
---|
168 | @echo ' release - create a distribution tarball'
|
---|
169 | @echo ' sizes - show size of all enabled busybox symbols'
|
---|
170 | @echo ' objsizes - show size of each .o object built'
|
---|
171 | @echo
|
---|
172 |
|
---|
173 |
|
---|
174 | include $(top_srcdir)/Rules.mak
|
---|
175 |
|
---|
176 | ifneq ($(strip $(HAVE_DOT_CONFIG)),y)
|
---|
177 |
|
---|
178 | # Default target if none was requested explicitly
|
---|
179 | all: menuconfig
|
---|
180 |
|
---|
181 | # warn if no configuration exists and we are asked to build a non-config target
|
---|
182 | .config:
|
---|
183 | @echo ""
|
---|
184 | @echo "No $(top_builddir)/$@ found!"
|
---|
185 | @echo "Please refer to 'make help', section Configuration."
|
---|
186 | @echo ""
|
---|
187 | @exit 1
|
---|
188 |
|
---|
189 | # configuration
|
---|
190 | # ---------------------------------------------------------------------------
|
---|
191 |
|
---|
192 | scripts/config/conf: scripts/config/Makefile
|
---|
193 | $(Q)$(MAKE) -C scripts/config conf
|
---|
194 | -@if [ ! -f .config ] ; then \
|
---|
195 | touch .config; \
|
---|
196 | fi
|
---|
197 |
|
---|
198 | scripts/config/mconf: scripts/config/Makefile
|
---|
199 | $(Q)$(MAKE) -C scripts/config ncurses conf mconf
|
---|
200 | -@if [ ! -f .config ] ; then \
|
---|
201 | touch .config; \
|
---|
202 | fi
|
---|
203 |
|
---|
204 | menuconfig: scripts/config/mconf
|
---|
205 | @[ -f .config ] || $(MAKE) $(MAKEFLAGS) defconfig
|
---|
206 | @./scripts/config/mconf $(CONFIG_CONFIG_IN)
|
---|
207 |
|
---|
208 | config: scripts/config/conf
|
---|
209 | @./scripts/config/conf $(CONFIG_CONFIG_IN)
|
---|
210 |
|
---|
211 | oldconfig: scripts/config/conf
|
---|
212 | @./scripts/config/conf -o $(CONFIG_CONFIG_IN)
|
---|
213 |
|
---|
214 | randconfig: scripts/config/conf
|
---|
215 | @./scripts/config/conf -r $(CONFIG_CONFIG_IN)
|
---|
216 |
|
---|
217 | allyesconfig: scripts/config/conf
|
---|
218 | @./scripts/config/conf -y $(CONFIG_CONFIG_IN) > /dev/null
|
---|
219 | @$(SED) -i -r -e "s/^(USING_CROSS_COMPILER)=.*/# \1 is not set/" .config
|
---|
220 | @./scripts/config/conf -o $(CONFIG_CONFIG_IN) > /dev/null
|
---|
221 |
|
---|
222 | allnoconfig: scripts/config/conf
|
---|
223 | @./scripts/config/conf -n $(CONFIG_CONFIG_IN) > /dev/null
|
---|
224 |
|
---|
225 | # defconfig is allyesconfig minus any features that are specialized enough
|
---|
226 | # or cause enough behavior change that the user really should switch them on
|
---|
227 | # manually if that's what they want. Sort of "maximum sane config".
|
---|
228 |
|
---|
229 | defconfig: scripts/config/conf
|
---|
230 | @./scripts/config/conf -y $(CONFIG_CONFIG_IN) > /dev/null
|
---|
231 | @$(SED) -i -r -e "s/^(USING_CROSS_COMPILER|CONFIG_(DEBUG.*|STATIC|SELINUX|BUILD_(AT_ONCE|LIBBUSYBOX)|FEATURE_(DEVFS|FULL_LIBBUSYBOX|SHARED_BUSYBOX|MTAB_SUPPORT|CLEAN_UP|UDHCP_DEBUG)|INSTALL_NO_USR))=.*/# \1 is not set/" .config
|
---|
232 | @./scripts/config/conf -o $(CONFIG_CONFIG_IN) > /dev/null
|
---|
233 |
|
---|
234 |
|
---|
235 | allbareconfig: scripts/config/conf
|
---|
236 | @./scripts/config/conf -y $(CONFIG_CONFIG_IN) > /dev/null
|
---|
237 | @$(SED) -i -r -e "s/^(USING_CROSS_COMPILER|CONFIG_(DEBUG|STATIC|SELINUX|DEVFSD|NC_GAPING_SECURITY_HOLE|BUILD_AT_ONCE)).*/# \1 is not set/" .config
|
---|
238 | @$(SED) -i -e "/FEATURE/s/=.*//;/^[^#]/s/.*FEATURE.*/# \0 is not set/;" .config
|
---|
239 | @echo "CONFIG_FEATURE_BUFFERS_GO_ON_STACK=y" >> .config
|
---|
240 | @yes n | ./scripts/config/conf -o $(CONFIG_CONFIG_IN) > /dev/null
|
---|
241 |
|
---|
242 | hosttools:
|
---|
243 | $(Q)cp .config .config.bak || noold=yea
|
---|
244 | $(Q)$(MAKE) CC="$(HOSTCC)" CFLAGS="$(HOSTCFLAGS) $(INCS)" allnoconfig
|
---|
245 | $(Q)mv .config .config.in
|
---|
246 | $(Q)(grep -v CONFIG_SED .config.in ; \
|
---|
247 | echo "CONFIG_SED=y" ; ) > .config
|
---|
248 | $(Q)$(MAKE) CC="$(HOSTCC)" CFLAGS="$(HOSTCFLAGS) $(INCS)" oldconfig include/bb_config.h
|
---|
249 | $(Q)$(MAKE) CC="$(HOSTCC)" CFLAGS="$(HOSTCFLAGS) $(INCS)" busybox
|
---|
250 | $(Q)[ -f .config.bak ] && mv .config.bak .config || rm .config
|
---|
251 | mv busybox sed
|
---|
252 | @echo "Now do: $(MAKE) SED=$(top_builddir)/sed <target>"
|
---|
253 |
|
---|
254 | else # ifneq ($(strip $(HAVE_DOT_CONFIG)),y)
|
---|
255 |
|
---|
256 | all: busybox busybox.links doc
|
---|
257 |
|
---|
258 | # In this section, we need .config
|
---|
259 | -include $(top_builddir)/.config.cmd
|
---|
260 | include $(patsubst %,%/Makefile.in, $(SRC_DIRS))
|
---|
261 |
|
---|
262 | endif # ifneq ($(strip $(HAVE_DOT_CONFIG)),y)
|
---|
263 |
|
---|
264 | -include $(top_builddir)/.config
|
---|
265 | -include $(top_builddir)/.depend
|
---|
266 |
|
---|
267 |
|
---|
268 | ifeq ($(strip $(CONFIG_BUILD_AT_ONCE)),y)
|
---|
269 | libraries-y:=
|
---|
270 | # Which parts of the internal libs are requested?
|
---|
271 | # Per default we only want what was actually selected.
|
---|
272 | # -a denotes all while -y denotes the selected ones.
|
---|
273 | ifeq ($(strip $(CONFIG_FEATURE_FULL_LIBBUSYBOX)),y)
|
---|
274 | LIBRARY_DEFINE:=$(LIBRARY_DEFINE-a)
|
---|
275 | LIBRARY_SRC :=$(LIBRARY_SRC-a)
|
---|
276 | else # CONFIG_FEATURE_FULL_LIBBUSYBOX
|
---|
277 | LIBRARY_DEFINE:=$(LIBRARY_DEFINE-y)
|
---|
278 | LIBRARY_SRC :=$(LIBRARY_SRC-y)
|
---|
279 | endif # CONFIG_FEATURE_FULL_LIBBUSYBOX
|
---|
280 | APPLET_SRC:=$(APPLET_SRC-y)
|
---|
281 | APPLETS_DEFINE:=$(APPLETS_DEFINE-y)
|
---|
282 | else # CONFIG_BUILD_AT_ONCE
|
---|
283 | # no --combine, build archives out of the individual .o
|
---|
284 | # This was the old way the binary was built.
|
---|
285 | libbusybox-obj:=archival/libunarchive/libunarchive.a \
|
---|
286 | networking/libiproute/libiproute.a \
|
---|
287 | libpwdgrp/libpwdgrp.a \
|
---|
288 | coreutils/libcoreutils/libcoreutils.a \
|
---|
289 | libbb/libbb.a
|
---|
290 | libbusybox-obj:=$(patsubst %,$(top_builddir)/%,$(libbusybox-obj))
|
---|
291 |
|
---|
292 | ifeq ($(strip $(CONFIG_FEATURE_SHARED_BUSYBOX)),y)
|
---|
293 | # linking against libbusybox, so don't build the .a already contained in the .so
|
---|
294 | libraries-y:=$(filter-out $(libbusybox-obj),$(libraries-y))
|
---|
295 | endif # CONFIG_FEATURE_SHARED_BUSYBOX
|
---|
296 | endif # CONFIG_BUILD_AT_ONCE
|
---|
297 |
|
---|
298 |
|
---|
299 | ifeq ($(strip $(CONFIG_BUILD_LIBBUSYBOX)),y)
|
---|
300 | LD_LIBBUSYBOX:=libbusybox.so
|
---|
301 | LIBBUSYBOX_SONAME:=$(LD_LIBBUSYBOX).$(MAJOR_VERSION).$(MINOR_VERSION).$(SUBLEVEL_VERSION)
|
---|
302 | DO_INSTALL_LIBS:=$(LD_LIBBUSYBOX) \
|
---|
303 | $(LD_LIBBUSYBOX).$(MAJOR_VERSION) \
|
---|
304 | $(LD_LIBBUSYBOX).$(MAJOR_VERSION).$(MINOR_VERSION)
|
---|
305 | endif # CONFIG_BUILD_LIBBUSYBOX
|
---|
306 |
|
---|
307 | ifeq ($(strip $(CONFIG_BUILD_AT_ONCE)),y)
|
---|
308 | ifneq ($(strip $(CONFIG_FEATURE_SHARED_BUSYBOX)),y)
|
---|
309 | # --combine but not linking against libbusybox, so compile all
|
---|
310 | BUSYBOX_SRC := $(LIBRARY_SRC)
|
---|
311 | BUSYBOX_DEFINE:= $(LIBRARY_DEFINE)
|
---|
312 | endif # !CONFIG_FEATURE_SHARED_BUSYBOX
|
---|
313 | $(LIBBUSYBOX_SONAME): $(LIBRARY_SRC)
|
---|
314 | else # CONFIG_BUILD_AT_ONCE
|
---|
315 | $(LIBBUSYBOX_SONAME): $(libbusybox-obj)
|
---|
316 | endif # CONFIG_BUILD_AT_ONCE
|
---|
317 |
|
---|
318 | ifeq ($(strip $(CONFIG_FEATURE_SHARED_BUSYBOX)),y)
|
---|
319 | LDBUSYBOX:=-L$(top_builddir) -lbusybox
|
---|
320 | endif
|
---|
321 |
|
---|
322 | ifeq ($(strip $(CONFIG_BUILD_LIBBUSYBOX)),y)
|
---|
323 | $(LIBBUSYBOX_SONAME):
|
---|
324 | ifndef MAJOR_VERSION
|
---|
325 | $(error MAJOR_VERSION needed for $@ is not defined)
|
---|
326 | endif
|
---|
327 | $(do_link.so) \
|
---|
328 | -Wl,-soname=$(LD_LIBBUSYBOX).$(MAJOR_VERSION) \
|
---|
329 | -Wl,-z,combreloc
|
---|
330 | @rm -f $(DO_INSTALL_LIBS)
|
---|
331 | @for i in $(DO_INSTALL_LIBS); do ln -s $(@) $$i ; done
|
---|
332 | $(do_strip)
|
---|
333 |
|
---|
334 | endif # ifeq ($(strip $(CONFIG_BUILD_LIBBUSYBOX)),y)
|
---|
335 |
|
---|
336 | busybox_unstripped: .depend $(LIBBUSYBOX_SONAME) $(BUSYBOX_SRC) $(APPLET_SRC) $(libraries-y)
|
---|
337 | $(do_link)
|
---|
338 |
|
---|
339 | busybox: busybox_unstripped
|
---|
340 | $(Q)cp busybox_unstripped busybox
|
---|
341 | $(do_strip)
|
---|
342 |
|
---|
343 | %.bflt: %_unstripped
|
---|
344 | $(do_elf2flt)
|
---|
345 |
|
---|
346 | busybox.links: $(top_srcdir)/applets/busybox.mkll include/bb_config.h $(top_srcdir)/include/applets.h
|
---|
347 | $(Q)-$(SHELL) $^ >$@
|
---|
348 |
|
---|
349 | install: $(top_srcdir)/applets/install.sh busybox busybox.links
|
---|
350 | $(Q)DO_INSTALL_LIBS="$(strip $(LIBBUSYBOX_SONAME) $(DO_INSTALL_LIBS))" \
|
---|
351 | $(SHELL) $< $(PREFIX) $(INSTALL_OPTS)
|
---|
352 | ifeq ($(strip $(CONFIG_FEATURE_SUID)),y)
|
---|
353 | @echo
|
---|
354 | @echo
|
---|
355 | @echo --------------------------------------------------
|
---|
356 | @echo You will probably need to make your busybox binary
|
---|
357 | @echo setuid root to ensure all configured applets will
|
---|
358 | @echo work properly.
|
---|
359 | @echo --------------------------------------------------
|
---|
360 | @echo
|
---|
361 | endif
|
---|
362 |
|
---|
363 | uninstall: busybox.links
|
---|
364 | rm -f $(PREFIX)/bin/busybox
|
---|
365 | for i in `cat busybox.links` ; do rm -f $(PREFIX)$$i; done
|
---|
366 | ifneq ($(strip $(DO_INSTALL_LIBS)),n)
|
---|
367 | for i in $(LIBBUSYBOX_SONAME) $(DO_INSTALL_LIBS); do \
|
---|
368 | rm -f $(PREFIX)$$i; \
|
---|
369 | done
|
---|
370 | endif
|
---|
371 |
|
---|
372 | check test: busybox
|
---|
373 | bindir=$(top_builddir) srcdir=$(top_srcdir)/testsuite SED="$(SED)" \
|
---|
374 | $(SHELL) $(top_srcdir)/testsuite/runtest $(CHECK_VERBOSE)
|
---|
375 |
|
---|
376 | checkhelp:
|
---|
377 | $(Q)$(top_srcdir)/scripts/checkhelp.awk \
|
---|
378 | $(wildcard $(patsubst %,%/Config.in,$(SRC_DIRS) ./))
|
---|
379 |
|
---|
380 | sizes: busybox_unstripped
|
---|
381 | $(NM) --size-sort $(<)
|
---|
382 |
|
---|
383 | bloatcheck: busybox_old busybox_unstripped
|
---|
384 | @$(top_srcdir)/scripts/bloat-o-meter busybox_old busybox_unstripped
|
---|
385 |
|
---|
386 | baseline: busybox_unstripped
|
---|
387 | @mv busybox_unstripped busybox_old
|
---|
388 |
|
---|
389 | objsizes: busybox_unstripped
|
---|
390 | $(SHELL) $(top_srcdir)/scripts/objsizes
|
---|
391 |
|
---|
392 | # Documentation Targets
|
---|
393 | doc: docs/busybox.pod docs/BusyBox.txt docs/BusyBox.1 docs/BusyBox.html
|
---|
394 |
|
---|
395 | docs/busybox.pod : $(top_srcdir)/docs/busybox_header.pod $(top_srcdir)/include/usage.h $(top_srcdir)/docs/busybox_footer.pod $(top_srcdir)/docs/autodocifier.pl
|
---|
396 | $(disp_doc)
|
---|
397 | $(Q)-mkdir -p docs
|
---|
398 | $(Q)-( cat $(top_srcdir)/docs/busybox_header.pod ; \
|
---|
399 | $(top_srcdir)/docs/autodocifier.pl $(top_srcdir)/include/usage.h ; \
|
---|
400 | cat $(top_srcdir)/docs/busybox_footer.pod ; ) > docs/busybox.pod
|
---|
401 |
|
---|
402 | docs/BusyBox.txt: docs/busybox.pod
|
---|
403 | $(disp_doc)
|
---|
404 | $(Q)-mkdir -p docs
|
---|
405 | $(Q)-pod2text $< > $@
|
---|
406 |
|
---|
407 | docs/BusyBox.1: docs/busybox.pod
|
---|
408 | $(disp_doc)
|
---|
409 | $(Q)-mkdir -p docs
|
---|
410 | $(Q)-pod2man --center=BusyBox --release="version $(VERSION)" \
|
---|
411 | $< > $@
|
---|
412 |
|
---|
413 | docs/BusyBox.html: docs/busybox.net/BusyBox.html
|
---|
414 | $(disp_doc)
|
---|
415 | $(Q)-mkdir -p docs
|
---|
416 | $(Q)-rm -f docs/BusyBox.html
|
---|
417 | $(Q)-cp docs/busybox.net/BusyBox.html docs/BusyBox.html
|
---|
418 |
|
---|
419 | docs/busybox.net/BusyBox.html: docs/busybox.pod
|
---|
420 | $(Q)-mkdir -p docs/busybox.net
|
---|
421 | $(Q)-pod2html --noindex $< > \
|
---|
422 | docs/busybox.net/BusyBox.html
|
---|
423 | $(Q)-rm -f pod2htm*
|
---|
424 |
|
---|
425 | # The nifty new dependency stuff
|
---|
426 | scripts/bb_mkdep: $(top_srcdir)/scripts/bb_mkdep.c
|
---|
427 | $(do_link.h)
|
---|
428 |
|
---|
429 | DEP_INCLUDES := include/bb_config.h
|
---|
430 |
|
---|
431 | ifeq ($(strip $(CONFIG_BBCONFIG)),y)
|
---|
432 | DEP_INCLUDES += include/bbconfigopts.h
|
---|
433 |
|
---|
434 | include/bbconfigopts.h: .config $(top_srcdir)/scripts/config/mkconfigs
|
---|
435 | $(disp_gen)
|
---|
436 | $(Q)$(top_srcdir)/scripts/config/mkconfigs > $@
|
---|
437 | endif
|
---|
438 |
|
---|
439 | ifeq ($(strip $(CONFIG_FEATURE_COMPRESS_USAGE)),y)
|
---|
440 | USAGE_BIN:=scripts/usage
|
---|
441 | $(USAGE_BIN): $(top_srcdir)/scripts/usage.c .config \
|
---|
442 | $(top_srcdir)/include/usage.h
|
---|
443 | $(do_link.h)
|
---|
444 |
|
---|
445 | DEP_INCLUDES += include/usage_compressed.h
|
---|
446 |
|
---|
447 | include/usage_compressed.h: .config $(USAGE_BIN) \
|
---|
448 | $(top_srcdir)/scripts/usage_compressed
|
---|
449 | $(Q)SED="$(SED)" $(SHELL) $(top_srcdir)/scripts/usage_compressed \
|
---|
450 | "$(top_builddir)/scripts" > $@
|
---|
451 | endif # CONFIG_FEATURE_COMPRESS_USAGE
|
---|
452 |
|
---|
453 | # workaround alleged bug in make-3.80, make-3.81
|
---|
454 | .NOTPARALLEL: .depend
|
---|
455 |
|
---|
456 | depend dep: .depend
|
---|
457 | .depend: scripts/bb_mkdep $(USAGE_BIN) $(DEP_INCLUDES)
|
---|
458 | $(disp_gen)
|
---|
459 | $(Q)rm -f .depend
|
---|
460 | $(Q)mkdir -p include/config
|
---|
461 | $(Q)scripts/bb_mkdep -I $(top_srcdir)/include $(top_srcdir) > $@.tmp
|
---|
462 | $(Q)mv $@.tmp $@
|
---|
463 |
|
---|
464 | include/bb_config.h: .config
|
---|
465 | @if [ ! -x $(top_builddir)/scripts/config/conf ] ; then \
|
---|
466 | $(MAKE) -C scripts/config conf; \
|
---|
467 | fi;
|
---|
468 | @$(top_builddir)/scripts/config/conf -o $(CONFIG_CONFIG_IN)
|
---|
469 |
|
---|
470 | clean:
|
---|
471 | - $(MAKE) -C scripts/config $@
|
---|
472 | - rm -f docs/busybox.dvi docs/busybox.ps \
|
---|
473 | docs/busybox.pod docs/busybox.net/busybox.html \
|
---|
474 | docs/busybox pod2htm* *.gdb *.elf *~ core .*config.log \
|
---|
475 | docs/BusyBox.txt docs/BusyBox.1 docs/BusyBox.html \
|
---|
476 | docs/busybox.net/BusyBox.html busybox.links \
|
---|
477 | libbusybox.so* \
|
---|
478 | .config.old busybox busybox_unstripped \
|
---|
479 | include/usage_compressed.h scripts/usage
|
---|
480 | - rm -r -f _install testsuite/links
|
---|
481 | - find . -name .\*.flags -o -name \*.o -o -name \*.om -o -name \*.syn \
|
---|
482 | -o -name \*.os -o -name \*.osm -o -name \*.a | xargs rm -f
|
---|
483 |
|
---|
484 | distclean: clean
|
---|
485 | rm -f scripts/bb_mkdep scripts/usage
|
---|
486 | rm -r -f include/config include/config.h $(DEP_INCLUDES)
|
---|
487 | find . -name .depend'*' -print0 | xargs -0 rm -f
|
---|
488 | rm -f .hdepend
|
---|
489 | rm -f .config .config.old .config.cmd
|
---|
490 |
|
---|
491 | release: distclean #doc
|
---|
492 | cd ..; \
|
---|
493 | rm -r -f $(PROG)-$(VERSION); \
|
---|
494 | cp -a busybox $(PROG)-$(VERSION); \
|
---|
495 | \
|
---|
496 | find $(PROG)-$(VERSION)/ -type d \
|
---|
497 | -name .svn \
|
---|
498 | -print \
|
---|
499 | -exec rm -r -f {} \; ; \
|
---|
500 | \
|
---|
501 | find $(PROG)-$(VERSION)/ -type f \
|
---|
502 | -name .\#* \
|
---|
503 | -print \
|
---|
504 | -exec rm -f {} \; ; \
|
---|
505 | \
|
---|
506 | tar -cvzf $(PROG)-$(VERSION).tar.gz $(PROG)-$(VERSION)/;
|
---|
507 |
|
---|
508 | tags:
|
---|
509 | ctags -R .
|
---|
510 |
|
---|
511 | # documentation, cross-reference
|
---|
512 | # Modern distributions already ship synopsis packages (e.g. debian)
|
---|
513 | # If you have an old distribution go to http://synopsis.fresco.org/
|
---|
514 | syn_tgt := $(wildcard $(patsubst %,%/*.c,$(SRC_DIRS)))
|
---|
515 | syn := $(patsubst %.c, %.syn, $(syn_tgt))
|
---|
516 |
|
---|
517 | %.syn: %.c
|
---|
518 | synopsis -p C -l Comments.SSDFilter,Comments.Previous $(INCS) -Wp,verbose,debug,preprocess,cppflags="'$(CFLAGS) $(EXTRA_CFLAGS) $(LDFLAGS) $(PROG_CFLAGS) $(PROG_LDFLAGS) $(CFLAGS_COMBINE) $(APPLETS_DEFINE) $(BUSYBOX_DEFINE)'" -o $@ $<
|
---|
519 | html: $(syn)
|
---|
520 | synopsis -f HTML -Wf,title="'BusyBox Documentation'" -o $@ $^
|
---|
521 |
|
---|
522 |
|
---|
523 | endif # ifeq ($(skip-makefile),)
|
---|
524 |
|
---|