Eric Andersen | c499601 | 1999-10-20 22:08:37 +0000 | [diff] [blame] | 1 | # Makefile for busybox |
| 2 | # |
Eric Andersen | bdfd0d7 | 2001-10-24 05:00:29 +0000 | [diff] [blame] | 3 | # Copyright (C) 1999,2000,2001 by Erik Andersen <andersee@debian.org> |
Erik Andersen | 9ffdaa6 | 2000-02-11 21:55:04 +0000 | [diff] [blame] | 4 | # |
Eric Andersen | c499601 | 1999-10-20 22:08:37 +0000 | [diff] [blame] | 5 | # 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 Andersen | 7c4b2f3 | 2000-02-29 21:49:22 +0000 | [diff] [blame] | 20 | PROG := busybox |
Eric Andersen | d36cdd2 | 2001-08-22 04:16:36 +0000 | [diff] [blame] | 21 | VERSION := 0.61.pre |
Matt Kraai | 6ba1a80 | 2001-04-12 20:11:55 +0000 | [diff] [blame] | 22 | BUILDTIME := $(shell TZ=UTC date -u "+%Y.%m.%d-%H:%M%z") |
Eric Andersen | bdfd0d7 | 2001-10-24 05:00:29 +0000 | [diff] [blame] | 23 | TOPDIR := ${shell /bin/pwd} |
| 24 | HOSTCC := gcc |
| 25 | HOSTCFLAGS:= -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. |
| 30 | TARGET_OS := linux |
Eric Andersen | cc8ed39 | 1999-10-05 16:24:54 +0000 | [diff] [blame] | 31 | |
Eric Andersen | 20ea5c3 | 2000-11-29 22:08:35 +0000 | [diff] [blame] | 32 | # 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 Andersen | bdfd0d7 | 2001-10-24 05:00:29 +0000 | [diff] [blame] | 35 | # make CROSS=powerpc-linux- CONFIG_SRC_DIR=$HOME/busybox PREFIX=/mnt/app |
Eric Andersen | 20ea5c3 | 2000-11-29 22:08:35 +0000 | [diff] [blame] | 36 | |
Eric Andersen | 0d5a08e | 2001-01-22 01:05:04 +0000 | [diff] [blame] | 37 | # 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. |
| 40 | CFLAGS_EXTRA = |
| 41 | |
Eric Andersen | 51154ba | 2000-07-20 21:57:11 +0000 | [diff] [blame] | 42 | # If you want a static binary, turn this on. |
| 43 | DOSTATIC = false |
| 44 | |
Erik Andersen | fac10d7 | 2000-02-07 05:29:42 +0000 | [diff] [blame] | 45 | # Set the following to `true' to make a debuggable build. |
| 46 | # Leave this set to `false' for production use. |
Randolph Chung | 1e1d9d1 | 2000-12-07 03:56:10 +0000 | [diff] [blame] | 47 | DODEBUG = false |
Eric Andersen | 21943ce | 1999-10-13 18:04:51 +0000 | [diff] [blame] | 48 | |
Eric Andersen | 1d255be | 2000-07-19 17:33:54 +0000 | [diff] [blame] | 49 | # 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. |
| 53 | # eg: `export DMALLOC_OPTIONS=debug=0x14f47d83,inter=100,log=logfile` |
| 54 | # Do not enable this for production builds... |
| 55 | DODMALLOC = false |
| 56 | |
Eric Andersen | 0607053 | 2001-04-04 19:32:00 +0000 | [diff] [blame] | 57 | # Electric-fence is another very useful malloc debugging library. |
Eric Andersen | 24073c7 | 2001-04-03 22:53:19 +0000 | [diff] [blame] | 58 | # Do not enable this for production builds... |
| 59 | DOEFENCE = false |
| 60 | |
Eric Andersen | 8a2e56c | 2000-09-21 02:23:30 +0000 | [diff] [blame] | 61 | # If you want large file summit support, turn this on. |
| 62 | # This has no effect if you don't have a kernel with lfs |
| 63 | # support, and a system with libc-2.1.3 or later. |
| 64 | # Some of the programs that can benefit from lfs support |
| 65 | # are dd, gzip, mount, tar, and mkfs_minix. |
| 66 | # LFS allows you to use the above programs for files |
| 67 | # larger than 2GB! |
| 68 | DOLFS = false |
| 69 | |
Eric Andersen | bdfd0d7 | 2001-10-24 05:00:29 +0000 | [diff] [blame] | 70 | # If you have a "pristine" source directory, point CONFIG_SRC_DIR to it. |
Eric Andersen | 09a34e5 | 2000-12-01 19:40:18 +0000 | [diff] [blame] | 71 | # Experimental and incomplete; tell the mailing list |
| 72 | # <busybox@opensource.lineo.com> if you do or don't like it so far. |
Eric Andersen | bdfd0d7 | 2001-10-24 05:00:29 +0000 | [diff] [blame] | 73 | CONFIG_SRC_DIR = |
Eric Andersen | 8a2e56c | 2000-09-21 02:23:30 +0000 | [diff] [blame] | 74 | |
Eric Andersen | bdfd0d7 | 2001-10-24 05:00:29 +0000 | [diff] [blame] | 75 | # If you are running a cross compiler, you may want to set CROSS |
| 76 | # to something more interesting, like "arm-linux-". |
Eric Andersen | 20ea5c3 | 2000-11-29 22:08:35 +0000 | [diff] [blame] | 77 | CROSS = |
Eric Andersen | bdfd0d7 | 2001-10-24 05:00:29 +0000 | [diff] [blame] | 78 | CC = $(CROSS)gcc |
| 79 | AR = $(CROSS)ar |
| 80 | AS = $(CROSS)as |
| 81 | LD = $(CROSS)ld |
| 82 | NM = $(CROSS)nm |
| 83 | STRIP = $(CROSS)strip |
| 84 | CPP = $(CC) -E |
| 85 | MAKEFILES = $(TOPDIR)/.config |
| 86 | export VERSION BUILDTIME TOPDIR HOSTCC HOSTCFLAGS CROSS CC AR AS LD NM STRIP CPP |
| 87 | |
Eric Andersen | 1d255be | 2000-07-19 17:33:54 +0000 | [diff] [blame] | 88 | |
Eric Andersen | ed3ef50 | 2001-01-27 08:24:39 +0000 | [diff] [blame] | 89 | # To compile vs uClibc, just use the compiler wrapper built by uClibc... |
Eric Andersen | 54eceff | 2001-08-20 17:48:17 +0000 | [diff] [blame] | 90 | # Everything should compile and work as expected these days... |
Eric Andersen | 74400cc | 2001-10-18 04:11:39 +0000 | [diff] [blame] | 91 | #CC = /usr/i386-linux-uclibc/usr/bin/i386-uclibc-gcc |
Eric Andersen | ed3ef50 | 2001-01-27 08:24:39 +0000 | [diff] [blame] | 92 | |
| 93 | # To compile vs some other alternative libc, you may need to use/adjust |
| 94 | # the following lines to meet your needs... |
Eric Andersen | 47cdcdd | 2001-03-05 17:08:52 +0000 | [diff] [blame] | 95 | # |
| 96 | # If you are using Red Hat 6.x with the compatible RPMs (for developing under |
| 97 | # Red Hat 5.x and glibc 2.0) uncomment the following. Be sure to read about |
| 98 | # using the compatible RPMs (compat-*) at http://www.redhat.com ! |
| 99 | #LIBCDIR=/usr/i386-glibc20-linux |
| 100 | # |
| 101 | # The following is used for libc5 (if you install altgcc and libc5-altdev |
| 102 | # on a Debian system). |
Mark Whitley | 4f76bb6 | 2001-02-27 19:53:48 +0000 | [diff] [blame] | 103 | #LIBCDIR=/usr/i486-linuxlibc1 |
Eric Andersen | 47cdcdd | 2001-03-05 17:08:52 +0000 | [diff] [blame] | 104 | # |
| 105 | # For other libraries, you are on your own... |
Eric Andersen | 28c88a9 | 2000-06-20 21:03:24 +0000 | [diff] [blame] | 106 | #LDFLAGS+=-nostdlib |
Mark Whitley | 4f76bb6 | 2001-02-27 19:53:48 +0000 | [diff] [blame] | 107 | #LIBRARIES = $(LIBCDIR)/lib/libc.a -lgcc |
Eric Andersen | 4d4b3b1 | 2000-12-12 23:23:32 +0000 | [diff] [blame] | 108 | #CROSS_CFLAGS+=-nostdinc -I$(LIBCDIR)/include -I$(GCCINCDIR) |
| 109 | #GCCINCDIR = $(shell gcc -print-search-dirs | sed -ne "s/install: \(.*\)/\1include/gp") |
Erik Andersen | 499f65f | 2000-05-16 20:07:38 +0000 | [diff] [blame] | 110 | |
Erik Andersen | 3d427ac | 2000-05-12 19:38:40 +0000 | [diff] [blame] | 111 | # use '-Os' optimization if available, else use -O2 |
Eric Andersen | bdfd0d7 | 2001-10-24 05:00:29 +0000 | [diff] [blame] | 112 | OPTIMIZATION := ${shell if $(CC) -Os -S -o /dev/null -xc /dev/null \ |
| 113 | >/dev/null 2>&1; then echo "-Os"; else echo "-O2" ; fi} |
Eric Andersen | 30fcef4 | 2001-11-10 11:23:47 +0000 | [diff] [blame] | 114 | GCC_STACK_BOUNDRY := ${shell if $(CC) -mpreferred-stack-boundary=2 -S -o /dev/null -xc /dev/null \ |
| 115 | >/dev/null 2>&1; then echo "-mpreferred-stack-boundary=2"; else echo "" ; fi} |
| 116 | OPTIMIZATIONS=$(OPTIMIZATION) -fomit-frame-pointer $(GCC_STACK_BOUNDRY) |
Eric Andersen | 74400cc | 2001-10-18 04:11:39 +0000 | [diff] [blame] | 117 | WARNINGS=-Wall -Wstrict-prototypes -Wshadow |
Eric Andersen | 30fcef4 | 2001-11-10 11:23:47 +0000 | [diff] [blame] | 118 | CFLAGS = -I$(TOPDIR)/include |
Eric Andersen | b183dfa | 2001-03-19 19:24:06 +0000 | [diff] [blame] | 119 | ARFLAGS = -r |
| 120 | |
Eric Andersen | 19f8620 | 2001-02-17 00:42:47 +0000 | [diff] [blame] | 121 | # |
| 122 | #-------------------------------------------------------- |
| 123 | # If you're going to do a lot of builds with a non-vanilla configuration, |
| 124 | # it makes sense to adjust parameters above, so you can type "make" |
| 125 | # by itself, instead of following it by the same half-dozen overrides |
| 126 | # every time. The stuff below, on the other hand, is probably less |
| 127 | # prone to casual user adjustment. |
| 128 | # |
| 129 | |
Mark Whitley | 76c5e60 | 2001-02-02 01:07:17 +0000 | [diff] [blame] | 130 | ifeq ($(strip $(DOLFS)),true) |
Eric Andersen | 8a2e56c | 2000-09-21 02:23:30 +0000 | [diff] [blame] | 131 | # For large file summit support |
Eric Andersen | 5c72104 | 2001-10-02 07:58:23 +0000 | [diff] [blame] | 132 | CFLAGS+=-D_FILE_OFFSET_BITS=64 -D__USE_FILE_OFFSET64 |
Eric Andersen | 8a2e56c | 2000-09-21 02:23:30 +0000 | [diff] [blame] | 133 | endif |
Mark Whitley | 76c5e60 | 2001-02-02 01:07:17 +0000 | [diff] [blame] | 134 | ifeq ($(strip $(DODMALLOC)),true) |
Eric Andersen | 1d255be | 2000-07-19 17:33:54 +0000 | [diff] [blame] | 135 | # For testing mem leaks with dmalloc |
| 136 | CFLAGS+=-DDMALLOC |
| 137 | LIBRARIES = -ldmalloc |
| 138 | # Force debug=true, since this is useless when not debugging... |
| 139 | DODEBUG = true |
Eric Andersen | 24073c7 | 2001-04-03 22:53:19 +0000 | [diff] [blame] | 140 | else |
| 141 | ifeq ($(strip $(DOEFENCE)),true) |
| 142 | LIBRARIES = -lefence |
| 143 | # Force debug=true, since this is useless when not debugging... |
| 144 | DODEBUG = true |
| 145 | endif |
Erik Andersen | 9ffdaa6 | 2000-02-11 21:55:04 +0000 | [diff] [blame] | 146 | endif |
Mark Whitley | 76c5e60 | 2001-02-02 01:07:17 +0000 | [diff] [blame] | 147 | ifeq ($(strip $(DODEBUG)),true) |
Eric Andersen | 9962cd9 | 2000-12-11 16:20:40 +0000 | [diff] [blame] | 148 | CFLAGS += $(WARNINGS) -g -D_GNU_SOURCE |
| 149 | LDFLAGS += -Wl,-warn-common |
Eric Andersen | bdfd0d7 | 2001-10-24 05:00:29 +0000 | [diff] [blame] | 150 | STRIPCMD = |
Eric Andersen | 17d49ef | 1999-10-06 20:25:32 +0000 | [diff] [blame] | 151 | else |
Eric Andersen | 30fcef4 | 2001-11-10 11:23:47 +0000 | [diff] [blame] | 152 | CFLAGS += $(WARNINGS) $(OPTIMIZATIONS) -D_GNU_SOURCE |
Eric Andersen | 9962cd9 | 2000-12-11 16:20:40 +0000 | [diff] [blame] | 153 | LDFLAGS += -s -Wl,-warn-common |
Eric Andersen | bdfd0d7 | 2001-10-24 05:00:29 +0000 | [diff] [blame] | 154 | STRIPCMD = $(STRIP) --remove-section=.note --remove-section=.comment $(PROG) |
Eric Andersen | 2c1faec | 2000-09-21 22:26:02 +0000 | [diff] [blame] | 155 | endif |
Mark Whitley | 76c5e60 | 2001-02-02 01:07:17 +0000 | [diff] [blame] | 156 | ifeq ($(strip $(DOSTATIC)),true) |
Eric Andersen | 2c1faec | 2000-09-21 22:26:02 +0000 | [diff] [blame] | 157 | LDFLAGS += --static |
Eric Andersen | 17d49ef | 1999-10-06 20:25:32 +0000 | [diff] [blame] | 158 | endif |
| 159 | |
Eric Andersen | eded54b | 1999-11-12 08:03:23 +0000 | [diff] [blame] | 160 | ifndef $(PREFIX) |
Erik Andersen | fac10d7 | 2000-02-07 05:29:42 +0000 | [diff] [blame] | 161 | PREFIX = `pwd`/_install |
Eric Andersen | 17d49ef | 1999-10-06 20:25:32 +0000 | [diff] [blame] | 162 | endif |
Eric Andersen | 17d49ef | 1999-10-06 20:25:32 +0000 | [diff] [blame] | 163 | |
Eric Andersen | 09a34e5 | 2000-12-01 19:40:18 +0000 | [diff] [blame] | 164 | # Additional complications due to support for pristine source dir. |
Eric Andersen | 19f8620 | 2001-02-17 00:42:47 +0000 | [diff] [blame] | 165 | # Include files in the build directory should take precedence over |
Eric Andersen | bdfd0d7 | 2001-10-24 05:00:29 +0000 | [diff] [blame] | 166 | # the copy in CONFIG_SRC_DIR, both during the compilation phase and the |
Eric Andersen | 09a34e5 | 2000-12-01 19:40:18 +0000 | [diff] [blame] | 167 | # shell script that finds the list of object files. |
Eric Andersen | 09a34e5 | 2000-12-01 19:40:18 +0000 | [diff] [blame] | 168 | # Work in progress by <ldoolitt@recycle.lbl.gov>. |
Eric Andersen | 19f8620 | 2001-02-17 00:42:47 +0000 | [diff] [blame] | 169 | # |
Eric Andersen | bdfd0d7 | 2001-10-24 05:00:29 +0000 | [diff] [blame] | 170 | ifneq ($(strip $(CONFIG_SRC_DIR)),) |
| 171 | VPATH = $(CONFIG_SRC_DIR) |
Eric Andersen | 09a34e5 | 2000-12-01 19:40:18 +0000 | [diff] [blame] | 172 | endif |
Eric Andersen | 19f8620 | 2001-02-17 00:42:47 +0000 | [diff] [blame] | 173 | |
Eric Andersen | 04095e5 | 2001-04-25 05:39:18 +0000 | [diff] [blame] | 174 | OBJECTS = $(APPLET_SOURCES:.c=.o) busybox.o usage.o applets.o |
Eric Andersen | 93a8e2e | 2001-01-31 01:38:05 +0000 | [diff] [blame] | 175 | CFLAGS += $(CROSS_CFLAGS) |
Eric Andersen | bdfd0d7 | 2001-10-24 05:00:29 +0000 | [diff] [blame] | 176 | ifdef CONFIG_INIT_SCRIPT |
| 177 | CFLAGS += -DINIT_SCRIPT='"$(CONFIG_INIT_SCRIPT)"' |
Erik Andersen | d387d01 | 1999-12-21 02:55:11 +0000 | [diff] [blame] | 178 | endif |
| 179 | |
Eric Andersen | 0d5a08e | 2001-01-22 01:05:04 +0000 | [diff] [blame] | 180 | # Put user-supplied flags at the end, where they |
| 181 | # have a chance of winning. |
| 182 | CFLAGS += $(CFLAGS_EXTRA) |
Eric Andersen | 624cc77 | 2000-09-21 02:04:51 +0000 | [diff] [blame] | 183 | |
Eric Andersen | ab050f5 | 2001-01-27 06:01:43 +0000 | [diff] [blame] | 184 | .EXPORT_ALL_VARIABLES: |
| 185 | |
Eric Andersen | bdfd0d7 | 2001-10-24 05:00:29 +0000 | [diff] [blame] | 186 | all: do-it-all |
Eric Andersen | 0081466 | 2001-04-26 23:29:10 +0000 | [diff] [blame] | 187 | |
Eric Andersen | bdfd0d7 | 2001-10-24 05:00:29 +0000 | [diff] [blame] | 188 | # |
| 189 | # Make "config" the default target if there is no configuration file or |
| 190 | # "depend" the target if there is no top-level dependency information. |
| 191 | ifeq (.config,$(wildcard .config)) |
| 192 | include .config |
| 193 | ifeq (.depend,$(wildcard .depend)) |
| 194 | include .depend |
| 195 | do-it-all: busybox busybox.links doc |
| 196 | else |
| 197 | CONFIGURATION = depend |
| 198 | do-it-all: depend |
| 199 | endif |
| 200 | else |
| 201 | CONFIGURATION = menuconfig |
| 202 | do-it-all: menuconfig |
| 203 | endif |
Erik Andersen | 0a704e8 | 2000-05-03 03:19:06 +0000 | [diff] [blame] | 204 | |
Eric Andersen | 3cd2760 | 2001-10-24 07:58:02 +0000 | [diff] [blame] | 205 | |
Glenn L McGrath | 95ebf61 | 2001-10-25 14:18:08 +0000 | [diff] [blame] | 206 | SUBDIRS =applets archival archival/libunarchive console-tools editors \ |
| 207 | fileutils findutils init miscutils modutils networking procps \ |
| 208 | pwd_grp shell shellutils sysklogd textutils util-linux libbb |
Eric Andersen | bdfd0d7 | 2001-10-24 05:00:29 +0000 | [diff] [blame] | 209 | |
| 210 | bbsubdirs: $(patsubst %, _dir_%, $(SUBDIRS)) |
| 211 | |
| 212 | $(patsubst %, _dir_%, $(SUBDIRS)) : dummy include/config/MARKER |
| 213 | $(MAKE) CFLAGS="$(CFLAGS)" -C $(patsubst _dir_%, %, $@) |
| 214 | |
Eric Andersen | 45784fe | 2001-11-10 13:08:02 +0000 | [diff] [blame] | 215 | busybox: config.h dep-files bbsubdirs |
Eric Andersen | 5abdaa9 | 2001-11-06 18:45:56 +0000 | [diff] [blame] | 216 | $(CC) $(LDFLAGS) -o $@ applets/busybox.o $(shell find $(SUBDIRS) -name \*.a) $(LIBCONFIG_LIB) $(LIBRARIES) |
Eric Andersen | bdfd0d7 | 2001-10-24 05:00:29 +0000 | [diff] [blame] | 217 | $(STRIPCMD) |
| 218 | |
| 219 | busybox.links: applets/busybox.mkll |
| 220 | - $(SHELL) $^ >$@ |
| 221 | |
| 222 | install: applets/install.sh busybox busybox.links |
| 223 | $(SHELL) $< $(PREFIX) |
| 224 | |
| 225 | install-hardlinks: applets/install.sh busybox busybox.links |
| 226 | $(SHELL) $< $(PREFIX) --hardlinks |
| 227 | |
| 228 | |
| 229 | # Documentation Targets |
Eric Andersen | 67536ff | 2000-07-06 22:53:22 +0000 | [diff] [blame] | 230 | doc: olddoc |
Eric Andersen | 5331025 | 2000-07-04 19:42:23 +0000 | [diff] [blame] | 231 | |
| 232 | # Old Docs... |
John Beppu | 94e5054 | 2001-04-05 19:42:03 +0000 | [diff] [blame] | 233 | olddoc: docs/busybox.pod docs/BusyBox.txt docs/BusyBox.1 docs/BusyBox.html |
| 234 | |
Eric Andersen | 1552ff7 | 2001-10-31 11:07:12 +0000 | [diff] [blame] | 235 | docs/busybox.pod : docs/busybox_header.pod include/usage.h docs/busybox_footer.pod |
John Beppu | 94e5054 | 2001-04-05 19:42:03 +0000 | [diff] [blame] | 236 | - ( cat docs/busybox_header.pod; \ |
Eric Andersen | 1552ff7 | 2001-10-31 11:07:12 +0000 | [diff] [blame] | 237 | docs/autodocifier.pl include/usage.h; \ |
John Beppu | 94e5054 | 2001-04-05 19:42:03 +0000 | [diff] [blame] | 238 | cat docs/busybox_footer.pod ) > docs/busybox.pod |
Eric Andersen | 5331025 | 2000-07-04 19:42:23 +0000 | [diff] [blame] | 239 | |
Eric Andersen | 67536ff | 2000-07-06 22:53:22 +0000 | [diff] [blame] | 240 | docs/BusyBox.txt: docs/busybox.pod |
Eric Andersen | 5331025 | 2000-07-04 19:42:23 +0000 | [diff] [blame] | 241 | @echo |
| 242 | @echo BusyBox Documentation |
| 243 | @echo |
Eric Andersen | 29be79c | 2000-12-01 22:57:44 +0000 | [diff] [blame] | 244 | -mkdir -p docs |
Eric Andersen | 19f8620 | 2001-02-17 00:42:47 +0000 | [diff] [blame] | 245 | -pod2text $< > $@ |
Eric Andersen | 5331025 | 2000-07-04 19:42:23 +0000 | [diff] [blame] | 246 | |
Eric Andersen | 67536ff | 2000-07-06 22:53:22 +0000 | [diff] [blame] | 247 | docs/BusyBox.1: docs/busybox.pod |
Eric Andersen | 09a34e5 | 2000-12-01 19:40:18 +0000 | [diff] [blame] | 248 | - mkdir -p docs |
Eric Andersen | 29be79c | 2000-12-01 22:57:44 +0000 | [diff] [blame] | 249 | - pod2man --center=BusyBox --release="version $(VERSION)" \ |
Eric Andersen | 19f8620 | 2001-02-17 00:42:47 +0000 | [diff] [blame] | 250 | $< > $@ |
Eric Andersen | 5331025 | 2000-07-04 19:42:23 +0000 | [diff] [blame] | 251 | |
Eric Andersen | 67536ff | 2000-07-06 22:53:22 +0000 | [diff] [blame] | 252 | docs/BusyBox.html: docs/busybox.lineo.com/BusyBox.html |
Eric Andersen | 1cf8166 | 2001-02-17 15:55:15 +0000 | [diff] [blame] | 253 | - mkdir -p docs |
Eric Andersen | e2f6e12 | 2000-12-01 19:55:04 +0000 | [diff] [blame] | 254 | -@ rm -f docs/BusyBox.html |
Eric Andersen | b8b8d81 | 2000-12-01 20:26:30 +0000 | [diff] [blame] | 255 | -@ ln -s busybox.lineo.com/BusyBox.html docs/BusyBox.html |
Eric Andersen | 5331025 | 2000-07-04 19:42:23 +0000 | [diff] [blame] | 256 | |
Eric Andersen | 67536ff | 2000-07-06 22:53:22 +0000 | [diff] [blame] | 257 | docs/busybox.lineo.com/BusyBox.html: docs/busybox.pod |
Eric Andersen | e2f6e12 | 2000-12-01 19:55:04 +0000 | [diff] [blame] | 258 | -@ mkdir -p docs/busybox.lineo.com |
Eric Andersen | 19f8620 | 2001-02-17 00:42:47 +0000 | [diff] [blame] | 259 | - pod2html --noindex $< > \ |
Eric Andersen | 29be79c | 2000-12-01 22:57:44 +0000 | [diff] [blame] | 260 | docs/busybox.lineo.com/BusyBox.html |
Eric Andersen | 3676374 | 2001-04-24 21:46:07 +0000 | [diff] [blame] | 261 | -@ rm -f pod2htm* |
Erik Andersen | 0a704e8 | 2000-05-03 03:19:06 +0000 | [diff] [blame] | 262 | |
Eric Andersen | 67536ff | 2000-07-06 22:53:22 +0000 | [diff] [blame] | 263 | |
| 264 | # New docs based on DOCBOOK SGML |
Eric Andersen | 488aac2 | 2000-09-24 02:42:48 +0000 | [diff] [blame] | 265 | newdoc: docs/busybox.txt docs/busybox.pdf docs/busybox/busyboxdocumentation.html |
Eric Andersen | 67536ff | 2000-07-06 22:53:22 +0000 | [diff] [blame] | 266 | |
| 267 | docs/busybox.txt: docs/busybox.sgml |
| 268 | @echo |
| 269 | @echo BusyBox Documentation |
| 270 | @echo |
Eric Andersen | 09a34e5 | 2000-12-01 19:40:18 +0000 | [diff] [blame] | 271 | - mkdir -p docs |
Eric Andersen | 868c057 | 2000-12-02 00:44:48 +0000 | [diff] [blame] | 272 | (cd docs; sgmltools -b txt busybox.sgml) |
Eric Andersen | 67536ff | 2000-07-06 22:53:22 +0000 | [diff] [blame] | 273 | |
| 274 | docs/busybox.dvi: docs/busybox.sgml |
Eric Andersen | 09a34e5 | 2000-12-01 19:40:18 +0000 | [diff] [blame] | 275 | - mkdir -p docs |
Eric Andersen | 868c057 | 2000-12-02 00:44:48 +0000 | [diff] [blame] | 276 | (cd docs; sgmltools -b dvi busybox.sgml) |
Eric Andersen | 67536ff | 2000-07-06 22:53:22 +0000 | [diff] [blame] | 277 | |
Eric Andersen | a2c83d8 | 2000-07-07 20:52:56 +0000 | [diff] [blame] | 278 | docs/busybox.ps: docs/busybox.sgml |
Eric Andersen | 09a34e5 | 2000-12-01 19:40:18 +0000 | [diff] [blame] | 279 | - mkdir -p docs |
Eric Andersen | 868c057 | 2000-12-02 00:44:48 +0000 | [diff] [blame] | 280 | (cd docs; sgmltools -b ps busybox.sgml) |
Eric Andersen | 67536ff | 2000-07-06 22:53:22 +0000 | [diff] [blame] | 281 | |
Eric Andersen | a2c83d8 | 2000-07-07 20:52:56 +0000 | [diff] [blame] | 282 | docs/busybox.pdf: docs/busybox.ps |
Eric Andersen | 09a34e5 | 2000-12-01 19:40:18 +0000 | [diff] [blame] | 283 | - mkdir -p docs |
Eric Andersen | 868c057 | 2000-12-02 00:44:48 +0000 | [diff] [blame] | 284 | (cd docs; ps2pdf busybox.ps) |
Eric Andersen | 67536ff | 2000-07-06 22:53:22 +0000 | [diff] [blame] | 285 | |
Eric Andersen | 488aac2 | 2000-09-24 02:42:48 +0000 | [diff] [blame] | 286 | docs/busybox/busyboxdocumentation.html: docs/busybox.sgml |
Eric Andersen | 09a34e5 | 2000-12-01 19:40:18 +0000 | [diff] [blame] | 287 | - mkdir -p docs |
Eric Andersen | 67536ff | 2000-07-06 22:53:22 +0000 | [diff] [blame] | 288 | (cd docs/busybox.lineo.com; sgmltools -b html ../busybox.sgml) |
| 289 | |
Eric Andersen | bdfd0d7 | 2001-10-24 05:00:29 +0000 | [diff] [blame] | 290 | # The nifty new buildsystem stuff |
| 291 | scripts/mkdep: scripts/mkdep.c |
| 292 | $(HOSTCC) $(HOSTCFLAGS) -o scripts/mkdep scripts/mkdep.c |
Eric Andersen | 67536ff | 2000-07-06 22:53:22 +0000 | [diff] [blame] | 293 | |
Eric Andersen | bdfd0d7 | 2001-10-24 05:00:29 +0000 | [diff] [blame] | 294 | scripts/split-include: scripts/split-include.c |
| 295 | $(HOSTCC) $(HOSTCFLAGS) -o scripts/split-include scripts/split-include.c |
Erik Andersen | 1d1d950 | 2000-04-21 01:26:49 +0000 | [diff] [blame] | 296 | |
Eric Andersen | 3cd2760 | 2001-10-24 07:58:02 +0000 | [diff] [blame] | 297 | dep-files: scripts/mkdep |
Eric Andersen | 45784fe | 2001-11-10 13:08:02 +0000 | [diff] [blame] | 298 | @if [ ! -f .depend ] ; then \ |
Eric Andersen | 3cd2760 | 2001-10-24 07:58:02 +0000 | [diff] [blame] | 299 | rm -f .depend .hdepend; \ |
| 300 | mkdir -p $(TOPDIR)/include/config; \ |
| 301 | scripts/mkdep -I $(TOPDIR)/include -- \ |
| 302 | `find $(TOPDIR) -name \*.c -print` >> .depend; \ |
| 303 | scripts/mkdep -I $(TOPDIR)/include -- \ |
| 304 | `find $(TOPDIR) -name \*.h -print` >> .hdepend; \ |
| 305 | $(MAKE) $(patsubst %,_sfdep_%,$(SUBDIRS)) _FASTDEP_ALL_SUB_DIRS="$(SUBDIRS)" ; \ |
| 306 | fi; |
Eric Andersen | 1667fb4 | 1999-11-27 20:34:28 +0000 | [diff] [blame] | 307 | |
Eric Andersen | 3cd2760 | 2001-10-24 07:58:02 +0000 | [diff] [blame] | 308 | |
| 309 | depend dep: config.h dep-files |
Eric Andersen | bdfd0d7 | 2001-10-24 05:00:29 +0000 | [diff] [blame] | 310 | @ echo -e "\n\nNow run 'make' to build BusyBox\n\n" |
| 311 | |
| 312 | CONFIG_SHELL := ${shell if [ -x "$$BASH" ]; then echo $$BASH; \ |
| 313 | else if [ -x /bin/bash ]; then echo /bin/bash; \ |
| 314 | else echo sh; fi ; fi} |
| 315 | |
| 316 | include/config/MARKER: scripts/split-include include/config.h |
| 317 | scripts/split-include include/config.h include/config |
| 318 | @ touch include/config/MARKER |
| 319 | |
Eric Andersen | 3cd2760 | 2001-10-24 07:58:02 +0000 | [diff] [blame] | 320 | config.h: |
| 321 | @if [ ! -f include/config.h ] ; then \ |
| 322 | make oldconfig; \ |
| 323 | fi; |
| 324 | |
Eric Andersen | bdfd0d7 | 2001-10-24 05:00:29 +0000 | [diff] [blame] | 325 | menuconfig: |
Eric Andersen | 3cd2760 | 2001-10-24 07:58:02 +0000 | [diff] [blame] | 326 | mkdir -p $(TOPDIR)/include/config |
Eric Andersen | bdfd0d7 | 2001-10-24 05:00:29 +0000 | [diff] [blame] | 327 | $(MAKE) -C scripts/lxdialog all |
| 328 | $(CONFIG_SHELL) scripts/Menuconfig sysdeps/$(TARGET_OS)/config.in |
| 329 | |
| 330 | config: |
Eric Andersen | 3cd2760 | 2001-10-24 07:58:02 +0000 | [diff] [blame] | 331 | mkdir -p $(TOPDIR)/include/config |
Eric Andersen | bdfd0d7 | 2001-10-24 05:00:29 +0000 | [diff] [blame] | 332 | $(CONFIG_SHELL) scripts/Configure sysdeps/$(TARGET_OS)/config.in |
| 333 | |
| 334 | oldconfig: |
Eric Andersen | 3cd2760 | 2001-10-24 07:58:02 +0000 | [diff] [blame] | 335 | mkdir -p $(TOPDIR)/include/config |
Eric Andersen | bdfd0d7 | 2001-10-24 05:00:29 +0000 | [diff] [blame] | 336 | $(CONFIG_SHELL) scripts/Configure -d sysdeps/$(TARGET_OS)/config.in |
| 337 | |
| 338 | |
| 339 | ifdef CONFIGURATION |
| 340 | ..$(CONFIGURATION): |
| 341 | @echo |
| 342 | @echo "You have a bad or nonexistent" .$(CONFIGURATION) ": running 'make" $(CONFIGURATION)"'" |
| 343 | @echo |
| 344 | $(MAKE) $(CONFIGURATION) |
| 345 | @echo |
| 346 | @echo "Successful. Try re-making (ignore the error that follows)" |
| 347 | @echo |
| 348 | exit 1 |
| 349 | |
| 350 | dummy: |
| 351 | |
Eric Andersen | 0b7d70c | 2001-08-02 20:56:16 +0000 | [diff] [blame] | 352 | else |
Eric Andersen | bdfd0d7 | 2001-10-24 05:00:29 +0000 | [diff] [blame] | 353 | |
| 354 | dummy: |
| 355 | |
Eric Andersen | 0b7d70c | 2001-08-02 20:56:16 +0000 | [diff] [blame] | 356 | endif |
Eric Andersen | 19f8620 | 2001-02-17 00:42:47 +0000 | [diff] [blame] | 357 | |
Eric Andersen | bdfd0d7 | 2001-10-24 05:00:29 +0000 | [diff] [blame] | 358 | include Rules.mak |
Eric Andersen | 19f8620 | 2001-02-17 00:42:47 +0000 | [diff] [blame] | 359 | |
Eric Andersen | bdfd0d7 | 2001-10-24 05:00:29 +0000 | [diff] [blame] | 360 | # Testing... |
Erik Andersen | 9ffdaa6 | 2000-02-11 21:55:04 +0000 | [diff] [blame] | 361 | test tests: |
Mark Whitley | d2117e9 | 2001-03-10 00:51:29 +0000 | [diff] [blame] | 362 | # old way of doing it |
| 363 | #cd tests && $(MAKE) all |
| 364 | # new way of doing it |
| 365 | cd tests && ./tester.sh |
Erik Andersen | 9ffdaa6 | 2000-02-11 21:55:04 +0000 | [diff] [blame] | 366 | |
Eric Andersen | bdfd0d7 | 2001-10-24 05:00:29 +0000 | [diff] [blame] | 367 | # Cleanup |
Eric Andersen | cc8ed39 | 1999-10-05 16:24:54 +0000 | [diff] [blame] | 368 | clean: |
Eric Andersen | bdfd0d7 | 2001-10-24 05:00:29 +0000 | [diff] [blame] | 369 | - $(MAKE) -C tests clean |
| 370 | - $(MAKE) -C scripts/lxdialog clean |
Eric Andersen | 67536ff | 2000-07-06 22:53:22 +0000 | [diff] [blame] | 371 | - rm -f docs/BusyBox.txt docs/BusyBox.1 docs/BusyBox.html \ |
| 372 | docs/busybox.lineo.com/BusyBox.html |
Eric Andersen | 5331025 | 2000-07-04 19:42:23 +0000 | [diff] [blame] | 373 | - rm -f docs/busybox.txt docs/busybox.dvi docs/busybox.ps \ |
Eric Andersen | bdfd0d7 | 2001-10-24 05:00:29 +0000 | [diff] [blame] | 374 | docs/busybox.pdf docs/busybox.lineo.com/busybox.html \ |
| 375 | docs/busybox _install pod2htm* *.gdb *.elf *~ core |
| 376 | - rm -f busybox.links libbb/loop.h .config.old .hdepend |
| 377 | - rm -f scripts/split-include scripts/mkdep .*config.log |
| 378 | - rm -rf include/config include/config.h |
| 379 | - find -name .\*.flags -o -name .depend -exec rm -f {} \; |
Eric Andersen | a183f05 | 2001-02-20 06:22:54 +0000 | [diff] [blame] | 380 | - find -name \*.o -exec rm -f {} \; |
Eric Andersen | bdfd0d7 | 2001-10-24 05:00:29 +0000 | [diff] [blame] | 381 | - find -name \*.a -exec rm -f {} \; |
Eric Andersen | cc8ed39 | 1999-10-05 16:24:54 +0000 | [diff] [blame] | 382 | |
| 383 | distclean: clean |
Eric Andersen | bdfd0d7 | 2001-10-24 05:00:29 +0000 | [diff] [blame] | 384 | - rm -f busybox |
Erik Andersen | 9ffdaa6 | 2000-02-11 21:55:04 +0000 | [diff] [blame] | 385 | - cd tests && $(MAKE) distclean |
Eric Andersen | cc8ed39 | 1999-10-05 16:24:54 +0000 | [diff] [blame] | 386 | |
Erik Andersen | 0a704e8 | 2000-05-03 03:19:06 +0000 | [diff] [blame] | 387 | dist release: distclean doc |
Erik Andersen | fac10d7 | 2000-02-07 05:29:42 +0000 | [diff] [blame] | 388 | cd ..; \ |
| 389 | rm -rf busybox-$(VERSION); \ |
| 390 | cp -a busybox busybox-$(VERSION); \ |
| 391 | \ |
| 392 | find busybox-$(VERSION)/ -type d \ |
| 393 | -name CVS \ |
| 394 | -print \ |
Eric Andersen | 53b55ac | 2001-03-16 07:43:53 +0000 | [diff] [blame] | 395 | -exec rm -rf {} \; ; \ |
Erik Andersen | fac10d7 | 2000-02-07 05:29:42 +0000 | [diff] [blame] | 396 | \ |
| 397 | find busybox-$(VERSION)/ -type f \ |
Eric Andersen | b0b732b | 2000-07-06 23:17:16 +0000 | [diff] [blame] | 398 | -name .\#* \ |
| 399 | -print \ |
Eric Andersen | 53b55ac | 2001-03-16 07:43:53 +0000 | [diff] [blame] | 400 | -exec rm -f {} \; ; \ |
Eric Andersen | b0b732b | 2000-07-06 23:17:16 +0000 | [diff] [blame] | 401 | \ |
Erik Andersen | fac10d7 | 2000-02-07 05:29:42 +0000 | [diff] [blame] | 402 | tar -cvzf busybox-$(VERSION).tar.gz busybox-$(VERSION)/; |
Mark Whitley | dd23b8b | 2000-07-10 23:00:47 +0000 | [diff] [blame] | 403 | |
Eric Andersen | bdfd0d7 | 2001-10-24 05:00:29 +0000 | [diff] [blame] | 404 | |
| 405 | |
Matt Kraai | 4e05da8 | 2001-11-19 19:47:56 +0000 | [diff] [blame^] | 406 | .PHONY: tags check |
Mark Whitley | dd23b8b | 2000-07-10 23:00:47 +0000 | [diff] [blame] | 407 | tags: |
| 408 | ctags -R . |
Matt Kraai | 4e05da8 | 2001-11-19 19:47:56 +0000 | [diff] [blame^] | 409 | |
| 410 | check: busybox |
| 411 | cd testsuite && ./runtest |