Eric Andersen | c499601 | 1999-10-20 22:08:37 +0000 | [diff] [blame^] | 1 | # Makefile for busybox |
| 2 | # |
| 3 | # This program is free software; you can redistribute it and/or modify |
| 4 | # it under the terms of the GNU General Public License as published by |
| 5 | # the Free Software Foundation; either version 2 of the License, or |
| 6 | # (at your option) any later version. |
| 7 | # |
| 8 | # This program is distributed in the hope that it will be useful, |
| 9 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 10 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 11 | # General Public License for more details. |
| 12 | # |
| 13 | # You should have received a copy of the GNU General Public License |
| 14 | # along with this program; if not, write to the Free Software |
| 15 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 16 | # |
| 17 | |
Eric Andersen | cc8ed39 | 1999-10-05 16:24:54 +0000 | [diff] [blame] | 18 | |
Eric Andersen | f8d650c | 1999-10-19 23:27:54 +0000 | [diff] [blame] | 19 | PROG=busybox |
Eric Andersen | c499601 | 1999-10-20 22:08:37 +0000 | [diff] [blame^] | 20 | VERSION=0.30 |
Eric Andersen | cc8ed39 | 1999-10-05 16:24:54 +0000 | [diff] [blame] | 21 | BUILDTIME=$(shell date "+%Y%m%d-%H%M") |
Eric Andersen | 21943ce | 1999-10-13 18:04:51 +0000 | [diff] [blame] | 22 | |
| 23 | # Comment out the following to make a debuggable build |
| 24 | # Leave this off for production use. |
Eric Andersen | d23f9ba | 1999-10-20 19:18:15 +0000 | [diff] [blame] | 25 | #DODEBUG=true |
Eric Andersen | cc8ed39 | 1999-10-05 16:24:54 +0000 | [diff] [blame] | 26 | |
| 27 | #This will choke on a non-debian system |
| 28 | ARCH=`uname -m | sed -e 's/i.86/i386/' | sed -e 's/sparc.*/sparc/'` |
| 29 | |
| 30 | |
Eric Andersen | cc8ed39 | 1999-10-05 16:24:54 +0000 | [diff] [blame] | 31 | # -D_GNU_SOURCE is needed because environ is used in init.c |
Eric Andersen | 17d49ef | 1999-10-06 20:25:32 +0000 | [diff] [blame] | 32 | ifeq ($(DODEBUG),true) |
| 33 | CFLAGS=-Wall -g -D_GNU_SOURCE |
| 34 | STRIP= |
Eric Andersen | 8341a15 | 1999-10-08 17:14:14 +0000 | [diff] [blame] | 35 | LDFLAGS= |
Eric Andersen | 17d49ef | 1999-10-06 20:25:32 +0000 | [diff] [blame] | 36 | else |
Eric Andersen | cb6e256 | 1999-10-16 15:48:40 +0000 | [diff] [blame] | 37 | CFLAGS=-Wall -Os -fomit-frame-pointer -fno-builtin -D_GNU_SOURCE |
Eric Andersen | 8341a15 | 1999-10-08 17:14:14 +0000 | [diff] [blame] | 38 | LDFLAGS= -s |
Eric Andersen | ce8f3b9 | 1999-10-20 07:03:36 +0000 | [diff] [blame] | 39 | STRIP= strip --remove-section=.note --remove-section=.comment $(PROG) |
Eric Andersen | 17d49ef | 1999-10-06 20:25:32 +0000 | [diff] [blame] | 40 | endif |
| 41 | |
| 42 | ifndef $(prefix) |
| 43 | prefix=`pwd` |
| 44 | endif |
| 45 | BINDIR=$(prefix) |
| 46 | |
Eric Andersen | cc8ed39 | 1999-10-05 16:24:54 +0000 | [diff] [blame] | 47 | LIBRARIES=-lc |
Eric Andersen | 596e546 | 1999-10-07 08:30:23 +0000 | [diff] [blame] | 48 | OBJECTS=$(shell ./busybox.sh) |
Eric Andersen | cc8ed39 | 1999-10-05 16:24:54 +0000 | [diff] [blame] | 49 | CFLAGS+= -DBB_VER='"$(VERSION)"' |
| 50 | CFLAGS+= -DBB_BT='"$(BUILDTIME)"' |
| 51 | |
Eric Andersen | 17d49ef | 1999-10-06 20:25:32 +0000 | [diff] [blame] | 52 | all: busybox links |
Eric Andersen | cc8ed39 | 1999-10-05 16:24:54 +0000 | [diff] [blame] | 53 | |
| 54 | busybox: $(OBJECTS) |
Eric Andersen | f8d650c | 1999-10-19 23:27:54 +0000 | [diff] [blame] | 55 | $(CC) $(LDFLAGS) -o $(PROG) $(OBJECTS) $(LIBRARIES) |
Eric Andersen | ce8f3b9 | 1999-10-20 07:03:36 +0000 | [diff] [blame] | 56 | $(STRIP) |
Eric Andersen | cc8ed39 | 1999-10-05 16:24:54 +0000 | [diff] [blame] | 57 | |
| 58 | links: |
| 59 | - ./busybox.mkll | sort >busybox.links |
| 60 | |
| 61 | clean: |
Eric Andersen | f8d650c | 1999-10-19 23:27:54 +0000 | [diff] [blame] | 62 | - rm -f $(PROG) busybox.links *~ *.o core |
Eric Andersen | cc8ed39 | 1999-10-05 16:24:54 +0000 | [diff] [blame] | 63 | |
| 64 | distclean: clean |
Eric Andersen | f8d650c | 1999-10-19 23:27:54 +0000 | [diff] [blame] | 65 | - rm -f $(PROG) |
Eric Andersen | cc8ed39 | 1999-10-05 16:24:54 +0000 | [diff] [blame] | 66 | |
| 67 | force: |
Eric Andersen | 2b69c40 | 1999-10-05 22:58:32 +0000 | [diff] [blame] | 68 | |
Eric Andersen | 9d3aba7 | 1999-10-06 09:04:55 +0000 | [diff] [blame] | 69 | $(OBJECTS): busybox.def.h internal.h Makefile |
Eric Andersen | 17d49ef | 1999-10-06 20:25:32 +0000 | [diff] [blame] | 70 | |
Eric Andersen | f8d650c | 1999-10-19 23:27:54 +0000 | [diff] [blame] | 71 | install: $(PROG) |
Eric Andersen | 17d49ef | 1999-10-06 20:25:32 +0000 | [diff] [blame] | 72 | install.sh $(BINDIR) |
| 73 | |