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 | 2f6c04f | 1999-11-01 23:59:44 +0000 | [diff] [blame^] | 20 | VERSION=0.32 |
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 | 2f6c04f | 1999-11-01 23:59:44 +0000 | [diff] [blame^] | 25 | DODEBUG=false |
Eric Andersen | a709317 | 1999-10-23 05:42:08 +0000 | [diff] [blame] | 26 | # If you want a static binary, turn this on. I can't think |
| 27 | # of many situations where anybody would ever want it static, |
| 28 | # but... |
| 29 | DOSTATIC=false |
Eric Andersen | cc8ed39 | 1999-10-05 16:24:54 +0000 | [diff] [blame] | 30 | |
| 31 | #This will choke on a non-debian system |
| 32 | ARCH=`uname -m | sed -e 's/i.86/i386/' | sed -e 's/sparc.*/sparc/'` |
| 33 | |
| 34 | |
Eric Andersen | cc8ed39 | 1999-10-05 16:24:54 +0000 | [diff] [blame] | 35 | # -D_GNU_SOURCE is needed because environ is used in init.c |
Eric Andersen | 17d49ef | 1999-10-06 20:25:32 +0000 | [diff] [blame] | 36 | ifeq ($(DODEBUG),true) |
Eric Andersen | 2f6c04f | 1999-11-01 23:59:44 +0000 | [diff] [blame^] | 37 | CFLAGS=-Wall -g -D_GNU_SOURCE -DDEBUG_INIT |
Eric Andersen | 17d49ef | 1999-10-06 20:25:32 +0000 | [diff] [blame] | 38 | STRIP= |
Eric Andersen | 8341a15 | 1999-10-08 17:14:14 +0000 | [diff] [blame] | 39 | LDFLAGS= |
Eric Andersen | 17d49ef | 1999-10-06 20:25:32 +0000 | [diff] [blame] | 40 | else |
Eric Andersen | cb6e256 | 1999-10-16 15:48:40 +0000 | [diff] [blame] | 41 | CFLAGS=-Wall -Os -fomit-frame-pointer -fno-builtin -D_GNU_SOURCE |
Eric Andersen | 8341a15 | 1999-10-08 17:14:14 +0000 | [diff] [blame] | 42 | LDFLAGS= -s |
Eric Andersen | ce8f3b9 | 1999-10-20 07:03:36 +0000 | [diff] [blame] | 43 | STRIP= strip --remove-section=.note --remove-section=.comment $(PROG) |
Eric Andersen | a709317 | 1999-10-23 05:42:08 +0000 | [diff] [blame] | 44 | #Only staticly link when _not_ debugging |
| 45 | ifeq ($(DOSTATIC),true) |
| 46 | LDFLAGS+= --static |
| 47 | endif |
| 48 | |
Eric Andersen | 17d49ef | 1999-10-06 20:25:32 +0000 | [diff] [blame] | 49 | endif |
| 50 | |
| 51 | ifndef $(prefix) |
| 52 | prefix=`pwd` |
| 53 | endif |
| 54 | BINDIR=$(prefix) |
| 55 | |
Eric Andersen | a07f0b0 | 1999-10-22 19:49:09 +0000 | [diff] [blame] | 56 | LIBRARIES= |
Eric Andersen | 596e546 | 1999-10-07 08:30:23 +0000 | [diff] [blame] | 57 | OBJECTS=$(shell ./busybox.sh) |
Eric Andersen | cc8ed39 | 1999-10-05 16:24:54 +0000 | [diff] [blame] | 58 | CFLAGS+= -DBB_VER='"$(VERSION)"' |
| 59 | CFLAGS+= -DBB_BT='"$(BUILDTIME)"' |
| 60 | |
Eric Andersen | 17d49ef | 1999-10-06 20:25:32 +0000 | [diff] [blame] | 61 | all: busybox links |
Eric Andersen | cc8ed39 | 1999-10-05 16:24:54 +0000 | [diff] [blame] | 62 | |
| 63 | busybox: $(OBJECTS) |
Eric Andersen | f8d650c | 1999-10-19 23:27:54 +0000 | [diff] [blame] | 64 | $(CC) $(LDFLAGS) -o $(PROG) $(OBJECTS) $(LIBRARIES) |
Eric Andersen | ce8f3b9 | 1999-10-20 07:03:36 +0000 | [diff] [blame] | 65 | $(STRIP) |
Eric Andersen | cc8ed39 | 1999-10-05 16:24:54 +0000 | [diff] [blame] | 66 | |
| 67 | links: |
| 68 | - ./busybox.mkll | sort >busybox.links |
| 69 | |
| 70 | clean: |
Eric Andersen | f8d650c | 1999-10-19 23:27:54 +0000 | [diff] [blame] | 71 | - rm -f $(PROG) busybox.links *~ *.o core |
Eric Andersen | cc8ed39 | 1999-10-05 16:24:54 +0000 | [diff] [blame] | 72 | |
| 73 | distclean: clean |
Eric Andersen | f8d650c | 1999-10-19 23:27:54 +0000 | [diff] [blame] | 74 | - rm -f $(PROG) |
Eric Andersen | cc8ed39 | 1999-10-05 16:24:54 +0000 | [diff] [blame] | 75 | |
| 76 | force: |
Eric Andersen | 2b69c40 | 1999-10-05 22:58:32 +0000 | [diff] [blame] | 77 | |
Eric Andersen | 9d3aba7 | 1999-10-06 09:04:55 +0000 | [diff] [blame] | 78 | $(OBJECTS): busybox.def.h internal.h Makefile |
Eric Andersen | 17d49ef | 1999-10-06 20:25:32 +0000 | [diff] [blame] | 79 | |
Eric Andersen | f8d650c | 1999-10-19 23:27:54 +0000 | [diff] [blame] | 80 | install: $(PROG) |
Eric Andersen | 17d49ef | 1999-10-06 20:25:32 +0000 | [diff] [blame] | 81 | install.sh $(BINDIR) |
| 82 | |