blob: 19c28edf359b2d722c0af3b4dab7d5bed73ed149 [file] [log] [blame]
Eric Andersenc4996011999-10-20 22:08:37 +00001# Makefile for busybox
2#
Eric Andersenbdfd0d72001-10-24 05:00:29 +00003# Copyright (C) 1999,2000,2001 by Erik Andersen <andersee@debian.org>
Erik Andersen9ffdaa62000-02-11 21:55:04 +00004#
Eric Andersenc4996011999-10-20 22:08:37 +00005# This program is free software; you can redistribute it and/or modify
6# it under the terms of the GNU General Public License as published by
7# the Free Software Foundation; either version 2 of the License, or
8# (at your option) any later version.
9#
10# This program is distributed in the hope that it will be useful,
11# but WITHOUT ANY WARRANTY; without even the implied warranty of
12# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13# General Public License for more details.
14#
15# You should have received a copy of the GNU General Public License
16# along with this program; if not, write to the Free Software
17# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18#
19
Erik Andersen7c4b2f32000-02-29 21:49:22 +000020PROG := busybox
Eric Andersend36cdd22001-08-22 04:16:36 +000021VERSION := 0.61.pre
Matt Kraai6ba1a802001-04-12 20:11:55 +000022BUILDTIME := $(shell TZ=UTC date -u "+%Y.%m.%d-%H:%M%z")
Eric Andersenbdfd0d72001-10-24 05:00:29 +000023TOPDIR := ${shell /bin/pwd}
24HOSTCC := gcc
25HOSTCFLAGS:= -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer
26
27
28# What OS are you compiling busybox for? This allows you to include
29# OS specific things, syscall overrides, etc.
30TARGET_OS := linux
Eric Andersencc8ed391999-10-05 16:24:54 +000031
Eric Andersen20ea5c32000-11-29 22:08:35 +000032# With a modern GNU make(1) (highly recommended, that's what all the
33# developers use), all of the following configuration values can be
34# overridden at the command line. For example:
Eric Andersen3ec5c692002-03-20 01:32:25 +000035# make CROSS=powerpc-linux- BB_SRC_DIR=$HOME/busybox PREFIX=/mnt/app
Eric Andersen20ea5c32000-11-29 22:08:35 +000036
Eric Andersen0d5a08e2001-01-22 01:05:04 +000037# If you want to add some simple compiler switches (like -march=i686),
38# especially from the command line, use this instead of CFLAGS directly.
39# For optimization overrides, it's better still to set OPTIMIZATION.
40CFLAGS_EXTRA =
41
Eric Andersen51154ba2000-07-20 21:57:11 +000042# If you want a static binary, turn this on.
43DOSTATIC = false
44
Erik Andersenfac10d72000-02-07 05:29:42 +000045# Set the following to `true' to make a debuggable build.
46# Leave this set to `false' for production use.
Randolph Chung1e1d9d12000-12-07 03:56:10 +000047DODEBUG = false
Eric Andersen21943ce1999-10-13 18:04:51 +000048
Eric Andersen1d255be2000-07-19 17:33:54 +000049# This enables compiling with dmalloc ( http://dmalloc.com/ )
50# which is an excellent public domain mem leak and malloc problem
51# detector. To enable dmalloc, before running busybox you will
52# want to first set up your environment.
Eric Andersen5a406512002-03-20 14:16:31 +000053# eg: `export DMALLOC_OPTIONS=debug=0x34f47d83,inter=100,log=logfile`
54# The debug= value is generated using the following command
55# dmalloc -p log-stats -p log-non-free -p log-bad-space -p log-elapsed-time \
56# -p check-fence -p check-heap -p check-lists -p check-blank \
57# -p check-funcs -p realloc-copy -p allow-free-null
Eric Andersen1d255be2000-07-19 17:33:54 +000058# Do not enable this for production builds...
59DODMALLOC = false
60
Eric Andersen06070532001-04-04 19:32:00 +000061# Electric-fence is another very useful malloc debugging library.
Eric Andersen24073c72001-04-03 22:53:19 +000062# Do not enable this for production builds...
63DOEFENCE = false
64
Eric Andersen8a2e56c2000-09-21 02:23:30 +000065# If you want large file summit support, turn this on.
66# This has no effect if you don't have a kernel with lfs
67# support, and a system with libc-2.1.3 or later.
68# Some of the programs that can benefit from lfs support
69# are dd, gzip, mount, tar, and mkfs_minix.
70# LFS allows you to use the above programs for files
71# larger than 2GB!
72DOLFS = false
73
Eric Andersen3ec5c692002-03-20 01:32:25 +000074# If you have a "pristine" source directory, point BB_SRC_DIR to it.
Eric Andersen09a34e52000-12-01 19:40:18 +000075# Experimental and incomplete; tell the mailing list
Eric Andersen2423b122001-12-08 01:56:15 +000076# <busybox@busybox.net> if you do or don't like it so far.
Eric Andersen3ec5c692002-03-20 01:32:25 +000077BB_SRC_DIR =
Eric Andersen8a2e56c2000-09-21 02:23:30 +000078
Eric Andersenbdfd0d72001-10-24 05:00:29 +000079# If you are running a cross compiler, you may want to set CROSS
80# to something more interesting, like "arm-linux-".
Eric Andersen20ea5c32000-11-29 22:08:35 +000081CROSS =
Eric Andersenbdfd0d72001-10-24 05:00:29 +000082CC = $(CROSS)gcc
83AR = $(CROSS)ar
84AS = $(CROSS)as
85LD = $(CROSS)ld
86NM = $(CROSS)nm
87STRIP = $(CROSS)strip
88CPP = $(CC) -E
89MAKEFILES = $(TOPDIR)/.config
90export VERSION BUILDTIME TOPDIR HOSTCC HOSTCFLAGS CROSS CC AR AS LD NM STRIP CPP
91
Eric Andersen1d255be2000-07-19 17:33:54 +000092
Eric Andersened3ef502001-01-27 08:24:39 +000093# To compile vs uClibc, just use the compiler wrapper built by uClibc...
Eric Andersen54eceff2001-08-20 17:48:17 +000094# Everything should compile and work as expected these days...
Eric Andersen74400cc2001-10-18 04:11:39 +000095#CC = /usr/i386-linux-uclibc/usr/bin/i386-uclibc-gcc
Eric Andersened3ef502001-01-27 08:24:39 +000096
97# To compile vs some other alternative libc, you may need to use/adjust
98# the following lines to meet your needs...
Eric Andersen47cdcdd2001-03-05 17:08:52 +000099#
100# If you are using Red Hat 6.x with the compatible RPMs (for developing under
101# Red Hat 5.x and glibc 2.0) uncomment the following. Be sure to read about
102# using the compatible RPMs (compat-*) at http://www.redhat.com !
103#LIBCDIR=/usr/i386-glibc20-linux
104#
105# The following is used for libc5 (if you install altgcc and libc5-altdev
106# on a Debian system).
Mark Whitley4f76bb62001-02-27 19:53:48 +0000107#LIBCDIR=/usr/i486-linuxlibc1
Eric Andersen47cdcdd2001-03-05 17:08:52 +0000108#
109# For other libraries, you are on your own...
Eric Andersen28c88a92000-06-20 21:03:24 +0000110#LDFLAGS+=-nostdlib
Mark Whitley4f76bb62001-02-27 19:53:48 +0000111#LIBRARIES = $(LIBCDIR)/lib/libc.a -lgcc
Eric Andersen4d4b3b12000-12-12 23:23:32 +0000112#CROSS_CFLAGS+=-nostdinc -I$(LIBCDIR)/include -I$(GCCINCDIR)
113#GCCINCDIR = $(shell gcc -print-search-dirs | sed -ne "s/install: \(.*\)/\1include/gp")
Erik Andersen499f65f2000-05-16 20:07:38 +0000114
Erik Andersen3d427ac2000-05-12 19:38:40 +0000115# use '-Os' optimization if available, else use -O2
Eric Andersenbdfd0d72001-10-24 05:00:29 +0000116OPTIMIZATION := ${shell if $(CC) -Os -S -o /dev/null -xc /dev/null \
117 >/dev/null 2>&1; then echo "-Os"; else echo "-O2" ; fi}
Eric Andersen30fcef42001-11-10 11:23:47 +0000118GCC_STACK_BOUNDRY := ${shell if $(CC) -mpreferred-stack-boundary=2 -S -o /dev/null -xc /dev/null \
119 >/dev/null 2>&1; then echo "-mpreferred-stack-boundary=2"; else echo "" ; fi}
Eric Andersende2a3422001-12-16 09:20:08 +0000120OPTIMIZATIONS=$(OPTIMIZATION) -fomit-frame-pointer $(GCC_STACK_BOUNDRY) #-fstrict-aliasing -march=i386 -mcpu=i386 -malign-functions=0 -malign-jumps=0
Eric Andersen74400cc2001-10-18 04:11:39 +0000121WARNINGS=-Wall -Wstrict-prototypes -Wshadow
Eric Andersen30fcef42001-11-10 11:23:47 +0000122CFLAGS = -I$(TOPDIR)/include
Eric Andersenb183dfa2001-03-19 19:24:06 +0000123ARFLAGS = -r
124
Eric Andersen19f86202001-02-17 00:42:47 +0000125#
126#--------------------------------------------------------
127# If you're going to do a lot of builds with a non-vanilla configuration,
128# it makes sense to adjust parameters above, so you can type "make"
129# by itself, instead of following it by the same half-dozen overrides
130# every time. The stuff below, on the other hand, is probably less
131# prone to casual user adjustment.
132#
133
Mark Whitley76c5e602001-02-02 01:07:17 +0000134ifeq ($(strip $(DOLFS)),true)
Eric Andersen8a2e56c2000-09-21 02:23:30 +0000135 # For large file summit support
Eric Andersen5c721042001-10-02 07:58:23 +0000136 CFLAGS+=-D_FILE_OFFSET_BITS=64 -D__USE_FILE_OFFSET64
Eric Andersen8a2e56c2000-09-21 02:23:30 +0000137endif
Mark Whitley76c5e602001-02-02 01:07:17 +0000138ifeq ($(strip $(DODMALLOC)),true)
Eric Andersen1d255be2000-07-19 17:33:54 +0000139 # For testing mem leaks with dmalloc
140 CFLAGS+=-DDMALLOC
141 LIBRARIES = -ldmalloc
142 # Force debug=true, since this is useless when not debugging...
143 DODEBUG = true
Eric Andersen24073c72001-04-03 22:53:19 +0000144else
145 ifeq ($(strip $(DOEFENCE)),true)
146 LIBRARIES = -lefence
147 # Force debug=true, since this is useless when not debugging...
148 DODEBUG = true
149 endif
Erik Andersen9ffdaa62000-02-11 21:55:04 +0000150endif
Mark Whitley76c5e602001-02-02 01:07:17 +0000151ifeq ($(strip $(DODEBUG)),true)
Eric Andersen9962cd92000-12-11 16:20:40 +0000152 CFLAGS += $(WARNINGS) -g -D_GNU_SOURCE
153 LDFLAGS += -Wl,-warn-common
Eric Andersende2a3422001-12-16 09:20:08 +0000154 STRIPCMD = /bin/true -Not_stripping_since_we_are_debugging
Eric Andersen17d49ef1999-10-06 20:25:32 +0000155else
Eric Andersen30fcef42001-11-10 11:23:47 +0000156 CFLAGS += $(WARNINGS) $(OPTIMIZATIONS) -D_GNU_SOURCE
Eric Andersen9962cd92000-12-11 16:20:40 +0000157 LDFLAGS += -s -Wl,-warn-common
Eric Andersen06656f32001-12-06 14:44:11 +0000158 STRIPCMD = $(STRIP) --remove-section=.note --remove-section=.comment
Eric Andersen2c1faec2000-09-21 22:26:02 +0000159endif
Mark Whitley76c5e602001-02-02 01:07:17 +0000160ifeq ($(strip $(DOSTATIC)),true)
Eric Andersen2c1faec2000-09-21 22:26:02 +0000161 LDFLAGS += --static
Eric Andersen17d49ef1999-10-06 20:25:32 +0000162endif
163
Eric Anderseneded54b1999-11-12 08:03:23 +0000164ifndef $(PREFIX)
Erik Andersenfac10d72000-02-07 05:29:42 +0000165 PREFIX = `pwd`/_install
Eric Andersen17d49ef1999-10-06 20:25:32 +0000166endif
Eric Andersen17d49ef1999-10-06 20:25:32 +0000167
Eric Andersen09a34e52000-12-01 19:40:18 +0000168# Additional complications due to support for pristine source dir.
Eric Andersen19f86202001-02-17 00:42:47 +0000169# Include files in the build directory should take precedence over
Eric Andersen3ec5c692002-03-20 01:32:25 +0000170# the copy in BB_SRC_DIR, both during the compilation phase and the
Eric Andersen09a34e52000-12-01 19:40:18 +0000171# shell script that finds the list of object files.
Eric Andersen09a34e52000-12-01 19:40:18 +0000172# Work in progress by <ldoolitt@recycle.lbl.gov>.
Eric Andersen19f86202001-02-17 00:42:47 +0000173#
Eric Andersen3ec5c692002-03-20 01:32:25 +0000174ifneq ($(strip $(BB_SRC_DIR)),)
175 VPATH = $(BB_SRC_DIR)
Eric Andersen09a34e52000-12-01 19:40:18 +0000176endif
Eric Andersen19f86202001-02-17 00:42:47 +0000177
Eric Andersen04095e52001-04-25 05:39:18 +0000178OBJECTS = $(APPLET_SOURCES:.c=.o) busybox.o usage.o applets.o
Eric Andersen93a8e2e2001-01-31 01:38:05 +0000179CFLAGS += $(CROSS_CFLAGS)
Eric Andersen3ec5c692002-03-20 01:32:25 +0000180ifdef BB_INIT_SCRIPT
181 CFLAGS += -DINIT_SCRIPT='"$(BB_INIT_SCRIPT)"'
Erik Andersend387d011999-12-21 02:55:11 +0000182endif
183
Eric Andersen0d5a08e2001-01-22 01:05:04 +0000184# Put user-supplied flags at the end, where they
185# have a chance of winning.
186CFLAGS += $(CFLAGS_EXTRA)
Eric Andersen624cc772000-09-21 02:04:51 +0000187
Eric Andersenab050f52001-01-27 06:01:43 +0000188.EXPORT_ALL_VARIABLES:
189
Eric Andersenbdfd0d72001-10-24 05:00:29 +0000190all: do-it-all
Eric Andersen00814662001-04-26 23:29:10 +0000191
Eric Andersenbdfd0d72001-10-24 05:00:29 +0000192#
193# Make "config" the default target if there is no configuration file or
194# "depend" the target if there is no top-level dependency information.
195ifeq (.config,$(wildcard .config))
196include .config
197ifeq (.depend,$(wildcard .depend))
198include .depend
199do-it-all: busybox busybox.links doc
200else
201CONFIGURATION = depend
202do-it-all: depend
203endif
204else
205CONFIGURATION = menuconfig
206do-it-all: menuconfig
207endif
Erik Andersen0a704e82000-05-03 03:19:06 +0000208
Eric Andersen3cd27602001-10-24 07:58:02 +0000209
Glenn L McGrath95ebf612001-10-25 14:18:08 +0000210SUBDIRS =applets archival archival/libunarchive console-tools editors \
211 fileutils findutils init miscutils modutils networking procps \
212 pwd_grp shell shellutils sysklogd textutils util-linux libbb
Eric Andersenbdfd0d72001-10-24 05:00:29 +0000213
214bbsubdirs: $(patsubst %, _dir_%, $(SUBDIRS))
215
216$(patsubst %, _dir_%, $(SUBDIRS)) : dummy include/config/MARKER
217 $(MAKE) CFLAGS="$(CFLAGS)" -C $(patsubst _dir_%, %, $@)
218
Eric Andersen45784fe2001-11-10 13:08:02 +0000219busybox: config.h dep-files bbsubdirs
Eric Andersen3ec5c692002-03-20 01:32:25 +0000220 $(CC) $(LDFLAGS) -o $@ applets/busybox.o $(shell find $(SUBDIRS) -name \*.a) $(LIBRARIES)
Eric Andersen06656f32001-12-06 14:44:11 +0000221 $(STRIPCMD) $(PROG)
Eric Andersenbdfd0d72001-10-24 05:00:29 +0000222
223busybox.links: applets/busybox.mkll
224 - $(SHELL) $^ >$@
225
226install: applets/install.sh busybox busybox.links
227 $(SHELL) $< $(PREFIX)
228
229install-hardlinks: applets/install.sh busybox busybox.links
230 $(SHELL) $< $(PREFIX) --hardlinks
231
232
233# Documentation Targets
Eric Andersen67536ff2000-07-06 22:53:22 +0000234doc: olddoc
Eric Andersen53310252000-07-04 19:42:23 +0000235
236# Old Docs...
John Beppu94e50542001-04-05 19:42:03 +0000237olddoc: docs/busybox.pod docs/BusyBox.txt docs/BusyBox.1 docs/BusyBox.html
238
Eric Andersen1552ff72001-10-31 11:07:12 +0000239docs/busybox.pod : docs/busybox_header.pod include/usage.h docs/busybox_footer.pod
John Beppu94e50542001-04-05 19:42:03 +0000240 - ( cat docs/busybox_header.pod; \
Eric Andersen1552ff72001-10-31 11:07:12 +0000241 docs/autodocifier.pl include/usage.h; \
John Beppu94e50542001-04-05 19:42:03 +0000242 cat docs/busybox_footer.pod ) > docs/busybox.pod
Eric Andersen53310252000-07-04 19:42:23 +0000243
Eric Andersen67536ff2000-07-06 22:53:22 +0000244docs/BusyBox.txt: docs/busybox.pod
Eric Andersen53310252000-07-04 19:42:23 +0000245 @echo
246 @echo BusyBox Documentation
247 @echo
Eric Andersen29be79c2000-12-01 22:57:44 +0000248 -mkdir -p docs
Eric Andersen19f86202001-02-17 00:42:47 +0000249 -pod2text $< > $@
Eric Andersen53310252000-07-04 19:42:23 +0000250
Eric Andersen67536ff2000-07-06 22:53:22 +0000251docs/BusyBox.1: docs/busybox.pod
Eric Andersen09a34e52000-12-01 19:40:18 +0000252 - mkdir -p docs
Eric Andersen29be79c2000-12-01 22:57:44 +0000253 - pod2man --center=BusyBox --release="version $(VERSION)" \
Eric Andersen19f86202001-02-17 00:42:47 +0000254 $< > $@
Eric Andersen53310252000-07-04 19:42:23 +0000255
Eric Andersen2423b122001-12-08 01:56:15 +0000256docs/BusyBox.html: docs/busybox.net/BusyBox.html
Eric Andersen1cf81662001-02-17 15:55:15 +0000257 - mkdir -p docs
Eric Andersene2f6e122000-12-01 19:55:04 +0000258 -@ rm -f docs/BusyBox.html
Eric Andersen2423b122001-12-08 01:56:15 +0000259 -@ ln -s busybox.net/BusyBox.html docs/BusyBox.html
Eric Andersen53310252000-07-04 19:42:23 +0000260
Eric Andersen2423b122001-12-08 01:56:15 +0000261docs/busybox.net/BusyBox.html: docs/busybox.pod
262 -@ mkdir -p docs/busybox.net
Eric Andersen19f86202001-02-17 00:42:47 +0000263 - pod2html --noindex $< > \
Eric Andersen2423b122001-12-08 01:56:15 +0000264 docs/busybox.net/BusyBox.html
Eric Andersen36763742001-04-24 21:46:07 +0000265 -@ rm -f pod2htm*
Erik Andersen0a704e82000-05-03 03:19:06 +0000266
Eric Andersen67536ff2000-07-06 22:53:22 +0000267
268# New docs based on DOCBOOK SGML
Eric Andersen488aac22000-09-24 02:42:48 +0000269newdoc: docs/busybox.txt docs/busybox.pdf docs/busybox/busyboxdocumentation.html
Eric Andersen67536ff2000-07-06 22:53:22 +0000270
271docs/busybox.txt: docs/busybox.sgml
272 @echo
273 @echo BusyBox Documentation
274 @echo
Eric Andersen09a34e52000-12-01 19:40:18 +0000275 - mkdir -p docs
Eric Andersen868c0572000-12-02 00:44:48 +0000276 (cd docs; sgmltools -b txt busybox.sgml)
Eric Andersen67536ff2000-07-06 22:53:22 +0000277
278docs/busybox.dvi: docs/busybox.sgml
Eric Andersen09a34e52000-12-01 19:40:18 +0000279 - mkdir -p docs
Eric Andersen868c0572000-12-02 00:44:48 +0000280 (cd docs; sgmltools -b dvi busybox.sgml)
Eric Andersen67536ff2000-07-06 22:53:22 +0000281
Eric Andersena2c83d82000-07-07 20:52:56 +0000282docs/busybox.ps: docs/busybox.sgml
Eric Andersen09a34e52000-12-01 19:40:18 +0000283 - mkdir -p docs
Eric Andersen868c0572000-12-02 00:44:48 +0000284 (cd docs; sgmltools -b ps busybox.sgml)
Eric Andersen67536ff2000-07-06 22:53:22 +0000285
Eric Andersena2c83d82000-07-07 20:52:56 +0000286docs/busybox.pdf: docs/busybox.ps
Eric Andersen09a34e52000-12-01 19:40:18 +0000287 - mkdir -p docs
Eric Andersen868c0572000-12-02 00:44:48 +0000288 (cd docs; ps2pdf busybox.ps)
Eric Andersen67536ff2000-07-06 22:53:22 +0000289
Eric Andersen488aac22000-09-24 02:42:48 +0000290docs/busybox/busyboxdocumentation.html: docs/busybox.sgml
Eric Andersen09a34e52000-12-01 19:40:18 +0000291 - mkdir -p docs
Eric Andersen2423b122001-12-08 01:56:15 +0000292 (cd docs/busybox.net; sgmltools -b html ../busybox.sgml)
Eric Andersen67536ff2000-07-06 22:53:22 +0000293
Eric Andersenbdfd0d72001-10-24 05:00:29 +0000294# The nifty new buildsystem stuff
295scripts/mkdep: scripts/mkdep.c
296 $(HOSTCC) $(HOSTCFLAGS) -o scripts/mkdep scripts/mkdep.c
Eric Andersen67536ff2000-07-06 22:53:22 +0000297
Eric Andersenbdfd0d72001-10-24 05:00:29 +0000298scripts/split-include: scripts/split-include.c
299 $(HOSTCC) $(HOSTCFLAGS) -o scripts/split-include scripts/split-include.c
Erik Andersen1d1d9502000-04-21 01:26:49 +0000300
Eric Andersen3cd27602001-10-24 07:58:02 +0000301dep-files: scripts/mkdep
Eric Andersen45784fe2001-11-10 13:08:02 +0000302 @if [ ! -f .depend ] ; then \
Eric Andersen3cd27602001-10-24 07:58:02 +0000303 rm -f .depend .hdepend; \
304 mkdir -p $(TOPDIR)/include/config; \
305 scripts/mkdep -I $(TOPDIR)/include -- \
306 `find $(TOPDIR) -name \*.c -print` >> .depend; \
307 scripts/mkdep -I $(TOPDIR)/include -- \
308 `find $(TOPDIR) -name \*.h -print` >> .hdepend; \
309 $(MAKE) $(patsubst %,_sfdep_%,$(SUBDIRS)) _FASTDEP_ALL_SUB_DIRS="$(SUBDIRS)" ; \
310 fi;
Eric Andersen1667fb41999-11-27 20:34:28 +0000311
Eric Andersen3cd27602001-10-24 07:58:02 +0000312
313depend dep: config.h dep-files
Eric Andersenbdfd0d72001-10-24 05:00:29 +0000314 @ echo -e "\n\nNow run 'make' to build BusyBox\n\n"
315
Eric Andersen3ec5c692002-03-20 01:32:25 +0000316BB_SHELL := ${shell if [ -x "$$BASH" ]; then echo $$BASH; \
Eric Andersenbdfd0d72001-10-24 05:00:29 +0000317 else if [ -x /bin/bash ]; then echo /bin/bash; \
318 else echo sh; fi ; fi}
319
320include/config/MARKER: scripts/split-include include/config.h
321 scripts/split-include include/config.h include/config
322 @ touch include/config/MARKER
323
Eric Andersen3cd27602001-10-24 07:58:02 +0000324config.h:
325 @if [ ! -f include/config.h ] ; then \
326 make oldconfig; \
327 fi;
328
Eric Andersenbdfd0d72001-10-24 05:00:29 +0000329menuconfig:
Eric Andersen3cd27602001-10-24 07:58:02 +0000330 mkdir -p $(TOPDIR)/include/config
Eric Andersenbdfd0d72001-10-24 05:00:29 +0000331 $(MAKE) -C scripts/lxdialog all
Eric Andersen3ec5c692002-03-20 01:32:25 +0000332 $(BB_SHELL) scripts/Menuconfig sysdeps/$(TARGET_OS)/config.in
Eric Andersenbdfd0d72001-10-24 05:00:29 +0000333
334config:
Eric Andersen3cd27602001-10-24 07:58:02 +0000335 mkdir -p $(TOPDIR)/include/config
Eric Andersen3ec5c692002-03-20 01:32:25 +0000336 $(BB_SHELL) scripts/Configure sysdeps/$(TARGET_OS)/config.in
Eric Andersenbdfd0d72001-10-24 05:00:29 +0000337
338oldconfig:
Eric Andersen3cd27602001-10-24 07:58:02 +0000339 mkdir -p $(TOPDIR)/include/config
Eric Andersen3ec5c692002-03-20 01:32:25 +0000340 $(BB_SHELL) scripts/Configure -d sysdeps/$(TARGET_OS)/config.in
Eric Andersenbdfd0d72001-10-24 05:00:29 +0000341
342
343ifdef CONFIGURATION
344..$(CONFIGURATION):
345 @echo
346 @echo "You have a bad or nonexistent" .$(CONFIGURATION) ": running 'make" $(CONFIGURATION)"'"
347 @echo
348 $(MAKE) $(CONFIGURATION)
349 @echo
350 @echo "Successful. Try re-making (ignore the error that follows)"
351 @echo
352 exit 1
353
354dummy:
355
Eric Andersen0b7d70c2001-08-02 20:56:16 +0000356else
Eric Andersenbdfd0d72001-10-24 05:00:29 +0000357
358dummy:
359
Eric Andersen0b7d70c2001-08-02 20:56:16 +0000360endif
Eric Andersen19f86202001-02-17 00:42:47 +0000361
Eric Andersenbdfd0d72001-10-24 05:00:29 +0000362include Rules.mak
Eric Andersen19f86202001-02-17 00:42:47 +0000363
Eric Andersenbdfd0d72001-10-24 05:00:29 +0000364# Testing...
Erik Andersen9ffdaa62000-02-11 21:55:04 +0000365test tests:
Mark Whitleyd2117e92001-03-10 00:51:29 +0000366 # old way of doing it
367 #cd tests && $(MAKE) all
368 # new way of doing it
369 cd tests && ./tester.sh
Erik Andersen9ffdaa62000-02-11 21:55:04 +0000370
Eric Andersenbdfd0d72001-10-24 05:00:29 +0000371# Cleanup
Eric Andersencc8ed391999-10-05 16:24:54 +0000372clean:
Eric Andersenbdfd0d72001-10-24 05:00:29 +0000373 - $(MAKE) -C tests clean
374 - $(MAKE) -C scripts/lxdialog clean
Eric Andersen67536ff2000-07-06 22:53:22 +0000375 - rm -f docs/BusyBox.txt docs/BusyBox.1 docs/BusyBox.html \
Eric Andersen2423b122001-12-08 01:56:15 +0000376 docs/busybox.net/BusyBox.html
Eric Andersen53310252000-07-04 19:42:23 +0000377 - rm -f docs/busybox.txt docs/busybox.dvi docs/busybox.ps \
Eric Andersen2423b122001-12-08 01:56:15 +0000378 docs/busybox.pdf docs/busybox.net/busybox.html \
Eric Andersenbdfd0d72001-10-24 05:00:29 +0000379 docs/busybox _install pod2htm* *.gdb *.elf *~ core
Eric Andersen3ec5c692002-03-20 01:32:25 +0000380 - rm -f busybox busybox.links libbb/loop.h .config.old .hdepend
Eric Andersenbdfd0d72001-10-24 05:00:29 +0000381 - rm -f scripts/split-include scripts/mkdep .*config.log
382 - rm -rf include/config include/config.h
383 - find -name .\*.flags -o -name .depend -exec rm -f {} \;
Eric Andersena183f052001-02-20 06:22:54 +0000384 - find -name \*.o -exec rm -f {} \;
Eric Andersenbdfd0d72001-10-24 05:00:29 +0000385 - find -name \*.a -exec rm -f {} \;
Eric Andersencc8ed391999-10-05 16:24:54 +0000386
387distclean: clean
Eric Andersenbdfd0d72001-10-24 05:00:29 +0000388 - rm -f busybox
Erik Andersen9ffdaa62000-02-11 21:55:04 +0000389 - cd tests && $(MAKE) distclean
Eric Andersencc8ed391999-10-05 16:24:54 +0000390
Erik Andersen0a704e82000-05-03 03:19:06 +0000391dist release: distclean doc
Erik Andersenfac10d72000-02-07 05:29:42 +0000392 cd ..; \
393 rm -rf busybox-$(VERSION); \
394 cp -a busybox busybox-$(VERSION); \
395 \
396 find busybox-$(VERSION)/ -type d \
397 -name CVS \
398 -print \
Eric Andersen53b55ac2001-03-16 07:43:53 +0000399 -exec rm -rf {} \; ; \
Erik Andersenfac10d72000-02-07 05:29:42 +0000400 \
401 find busybox-$(VERSION)/ -type f \
Eric Andersenb0b732b2000-07-06 23:17:16 +0000402 -name .\#* \
403 -print \
Eric Andersen53b55ac2001-03-16 07:43:53 +0000404 -exec rm -f {} \; ; \
Eric Andersenb0b732b2000-07-06 23:17:16 +0000405 \
Erik Andersenfac10d72000-02-07 05:29:42 +0000406 tar -cvzf busybox-$(VERSION).tar.gz busybox-$(VERSION)/;
Mark Whitleydd23b8b2000-07-10 23:00:47 +0000407
Eric Andersenbdfd0d72001-10-24 05:00:29 +0000408
409
Matt Kraai4e05da82001-11-19 19:47:56 +0000410.PHONY: tags check
Mark Whitleydd23b8b2000-07-10 23:00:47 +0000411tags:
412 ctags -R .
Matt Kraai4e05da82001-11-19 19:47:56 +0000413
414check: busybox
415 cd testsuite && ./runtest