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.
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.
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
21 BUILDTIME=$(shell date "+%Y%m%d-%H%M")
23 # Comment out the following to make a debuggable build
24 # Leave this off for production use.
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,
31 #This will choke on a non-debian system
32 ARCH=`uname -m | sed -e 's/i.86/i386/' | sed -e 's/sparc.*/sparc/'`
34 GCCMAJVERSION=$(shell $(CC) --version | sed -n "s/^\([^\.]*\).*/\1/p" )
35 GCCMINVERSION=$(shell $(CC) --version | sed -n "s/^[^\.]*\.\([^\.]*\)[\.].*/\1/p" )
37 GCCSUPPORTSOPTSIZE=$(shell \
38 if ( test $(GCCMAJVERSION) -eq 2 ) ; then \
39 if ( test $(GCCMINVERSION) -ge 91 ) ; then \
45 if ( test $(GCCMAJVERSION) -gt 2 ) ; then \
53 ifeq ($(GCCSUPPORTSOPTSIZE), true)
59 # -D_GNU_SOURCE is needed because environ is used in init.c
60 ifeq ($(DODEBUG),true)
61 CFLAGS+=-Wall -g -D_GNU_SOURCE -DDEBUG_INIT
65 CFLAGS+=-Wall $(OPTIMIZATION) -fomit-frame-pointer -fno-builtin -D_GNU_SOURCE
67 STRIP= strip --remove-section=.note --remove-section=.comment $(PROG)
68 #Only staticly link when _not_ debugging
69 ifeq ($(DOSTATIC),true)
80 OBJECTS=$(shell ./busybox.sh)
81 CFLAGS+= -DBB_VER='"$(VERSION)"'
82 CFLAGS+= -DBB_BT='"$(BUILDTIME)"'
83 ifdef BB_INIT_RC_EXIT_CMD
84 CFLAGS += -DBB_INIT_CMD_IF_RC_SCRIPT_EXITS=${BB_INIT_RC_EXIT_CMD}
88 CFLAGS += -DBB_INIT_SCRIPT=${BB_INIT_SCRIPT}
91 all: busybox busybox.links
94 $(CC) $(LDFLAGS) -o $(PROG) $(OBJECTS) $(LIBRARIES)
98 - ./busybox.mkll | sort >$@
101 - rm -f $(PROG) busybox.links *~ *.o core
107 $(OBJECTS): busybox.def.h internal.h Makefile
109 install: busybox busybox.links
110 ./install.sh $(PREFIX)
115 (cd .. ; rm -rf busybox-$(VERSION) ; cp -a busybox busybox-$(VERSION); rm -rf busybox-$(VERSION)/CVS busybox-$(VERSION)/.cvsignore ; tar -cvzf busybox-$(VERSION).tar.gz busybox-$(VERSION))