blob: 912c439aa20446222d76a5bc1c233e2df367a32f [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 Andersenc4996011999-10-20 22:08:37 +000020VERSION=0.30
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 Andersend23f9ba1999-10-20 19:18:15 +000025#DODEBUG=true
Eric Andersencc8ed391999-10-05 16:24:54 +000026
27#This will choke on a non-debian system
28ARCH=`uname -m | sed -e 's/i.86/i386/' | sed -e 's/sparc.*/sparc/'`
29
30
Eric Andersencc8ed391999-10-05 16:24:54 +000031# -D_GNU_SOURCE is needed because environ is used in init.c
Eric Andersen17d49ef1999-10-06 20:25:32 +000032ifeq ($(DODEBUG),true)
33 CFLAGS=-Wall -g -D_GNU_SOURCE
34 STRIP=
Eric Andersen8341a151999-10-08 17:14:14 +000035 LDFLAGS=
Eric Andersen17d49ef1999-10-06 20:25:32 +000036else
Eric Andersencb6e2561999-10-16 15:48:40 +000037 CFLAGS=-Wall -Os -fomit-frame-pointer -fno-builtin -D_GNU_SOURCE
Eric Andersen8341a151999-10-08 17:14:14 +000038 LDFLAGS= -s
Eric Andersence8f3b91999-10-20 07:03:36 +000039 STRIP= strip --remove-section=.note --remove-section=.comment $(PROG)
Eric Andersen17d49ef1999-10-06 20:25:32 +000040endif
41
42ifndef $(prefix)
43 prefix=`pwd`
44endif
45BINDIR=$(prefix)
46
Eric Andersencc8ed391999-10-05 16:24:54 +000047LIBRARIES=-lc
Eric Andersen596e5461999-10-07 08:30:23 +000048OBJECTS=$(shell ./busybox.sh)
Eric Andersencc8ed391999-10-05 16:24:54 +000049CFLAGS+= -DBB_VER='"$(VERSION)"'
50CFLAGS+= -DBB_BT='"$(BUILDTIME)"'
51
Eric Andersen17d49ef1999-10-06 20:25:32 +000052all: busybox links
Eric Andersencc8ed391999-10-05 16:24:54 +000053
54busybox: $(OBJECTS)
Eric Andersenf8d650c1999-10-19 23:27:54 +000055 $(CC) $(LDFLAGS) -o $(PROG) $(OBJECTS) $(LIBRARIES)
Eric Andersence8f3b91999-10-20 07:03:36 +000056 $(STRIP)
Eric Andersencc8ed391999-10-05 16:24:54 +000057
58links:
59 - ./busybox.mkll | sort >busybox.links
60
61clean:
Eric Andersenf8d650c1999-10-19 23:27:54 +000062 - rm -f $(PROG) busybox.links *~ *.o core
Eric Andersencc8ed391999-10-05 16:24:54 +000063
64distclean: clean
Eric Andersenf8d650c1999-10-19 23:27:54 +000065 - rm -f $(PROG)
Eric Andersencc8ed391999-10-05 16:24:54 +000066
67force:
Eric Andersen2b69c401999-10-05 22:58:32 +000068
Eric Andersen9d3aba71999-10-06 09:04:55 +000069$(OBJECTS): busybox.def.h internal.h Makefile
Eric Andersen17d49ef1999-10-06 20:25:32 +000070
Eric Andersenf8d650c1999-10-19 23:27:54 +000071install: $(PROG)
Eric Andersen17d49ef1999-10-06 20:25:32 +000072 install.sh $(BINDIR)
73