blob: 53a7d8ea8d86cc3e62154d373f889bba15e256ec [file] [log] [blame]
Eric Andersenc4996011999-10-20 22:08:37 +00001# 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 Andersencc8ed391999-10-05 16:24:54 +000018
Eric Andersenf8d650c1999-10-19 23:27:54 +000019PROG=busybox
Eric Andersenadd01581999-11-09 03:10:26 +000020VERSION=0.34
Eric Andersencc8ed391999-10-05 16:24:54 +000021BUILDTIME=$(shell date "+%Y%m%d-%H%M")
Eric Andersen21943ce1999-10-13 18:04:51 +000022
23# Comment out the following to make a debuggable build
24# Leave this off for production use.
Eric Andersenadd01581999-11-09 03:10:26 +000025DODEBUG=false
Eric Andersena7093171999-10-23 05:42:08 +000026# 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...
29DOSTATIC=false
Eric Andersencc8ed391999-10-05 16:24:54 +000030
31#This will choke on a non-debian system
32ARCH=`uname -m | sed -e 's/i.86/i386/' | sed -e 's/sparc.*/sparc/'`
33
34
Eric Andersencc8ed391999-10-05 16:24:54 +000035# -D_GNU_SOURCE is needed because environ is used in init.c
Eric Andersen17d49ef1999-10-06 20:25:32 +000036ifeq ($(DODEBUG),true)
Eric Andersen2f6c04f1999-11-01 23:59:44 +000037 CFLAGS=-Wall -g -D_GNU_SOURCE -DDEBUG_INIT
Eric Andersen17d49ef1999-10-06 20:25:32 +000038 STRIP=
Eric Andersen8341a151999-10-08 17:14:14 +000039 LDFLAGS=
Eric Andersen17d49ef1999-10-06 20:25:32 +000040else
Eric Andersencb6e2561999-10-16 15:48:40 +000041 CFLAGS=-Wall -Os -fomit-frame-pointer -fno-builtin -D_GNU_SOURCE
Eric Andersen8341a151999-10-08 17:14:14 +000042 LDFLAGS= -s
Eric Andersence8f3b91999-10-20 07:03:36 +000043 STRIP= strip --remove-section=.note --remove-section=.comment $(PROG)
Eric Andersena7093171999-10-23 05:42:08 +000044 #Only staticly link when _not_ debugging
45 ifeq ($(DOSTATIC),true)
46 LDFLAGS+= --static
47 endif
48
Eric Andersen17d49ef1999-10-06 20:25:32 +000049endif
50
51ifndef $(prefix)
52 prefix=`pwd`
53endif
54BINDIR=$(prefix)
55
Eric Andersena07f0b01999-10-22 19:49:09 +000056LIBRARIES=
Eric Andersen596e5461999-10-07 08:30:23 +000057OBJECTS=$(shell ./busybox.sh)
Eric Andersencc8ed391999-10-05 16:24:54 +000058CFLAGS+= -DBB_VER='"$(VERSION)"'
59CFLAGS+= -DBB_BT='"$(BUILDTIME)"'
60
Eric Andersen17d49ef1999-10-06 20:25:32 +000061all: busybox links
Eric Andersencc8ed391999-10-05 16:24:54 +000062
63busybox: $(OBJECTS)
Eric Andersenf8d650c1999-10-19 23:27:54 +000064 $(CC) $(LDFLAGS) -o $(PROG) $(OBJECTS) $(LIBRARIES)
Eric Andersence8f3b91999-10-20 07:03:36 +000065 $(STRIP)
Eric Andersencc8ed391999-10-05 16:24:54 +000066
67links:
68 - ./busybox.mkll | sort >busybox.links
69
70clean:
Eric Andersenf8d650c1999-10-19 23:27:54 +000071 - rm -f $(PROG) busybox.links *~ *.o core
Eric Andersencc8ed391999-10-05 16:24:54 +000072
73distclean: clean
Eric Andersenf8d650c1999-10-19 23:27:54 +000074 - rm -f $(PROG)
Eric Andersencc8ed391999-10-05 16:24:54 +000075
76force:
Eric Andersen2b69c401999-10-05 22:58:32 +000077
Eric Andersen9d3aba71999-10-06 09:04:55 +000078$(OBJECTS): busybox.def.h internal.h Makefile
Eric Andersen17d49ef1999-10-06 20:25:32 +000079
Eric Andersenf8d650c1999-10-19 23:27:54 +000080install: $(PROG)
Eric Andersen17d49ef1999-10-06 20:25:32 +000081 install.sh $(BINDIR)
82