3 # Copyright (C) 1999-2000 Erik Andersen <andersee@debian.org>
4 # Copyright (C) 2000 Karl M. Hegbloom <karlheg@debian.org>
6 # This program is free software; you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation; either version 2 of the License, or
9 # (at your option) any later version.
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 # General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with this program; if not, write to the Free Software
18 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 BUILDTIME := $(shell TZ=UTC date --utc "+%Y.%m.%d-%H:%M%z")
25 # Set the following to `true' to make a debuggable build.
26 # Leave this set to `false' for production use.
27 # eg: `make DODEBUG=true tests'
30 # If you want a static binary, turn this on.
33 # This will choke on a non-debian system
34 ARCH =`uname -m | sed -e 's/i.86/i386/' | sed -e 's/sparc.*/sparc/'`
38 GCCMAJVERSION = $(shell $(CC) --version | sed -n "s/^[^0-9]*\([0-9]\)\.\([0-9].*\)[\.].*/\1/p")
39 GCCMINVERSION = $(shell $(CC) --version | sed -n "s/^[^0-9]*\([0-9]\)\.\([0-9].*\)[\.].*/\2/p")
42 GCCSUPPORTSOPTSIZE = $(shell \
43 if ( test $(GCCMAJVERSION) -eq 2 ) ; then \
44 if ( test $(GCCMINVERSION) -ge 66 ) ; then \
50 if ( test $(GCCMAJVERSION) -gt 2 ) ; then \
58 ifeq ($(GCCSUPPORTSOPTSIZE), true)
64 # Allow alternative stripping tools to be used...
70 # -D_GNU_SOURCE is needed because environ is used in init.c
71 ifeq ($(DODEBUG),true)
72 CFLAGS += -Wall -g -D_GNU_SOURCE
76 CFLAGS += -Wall $(OPTIMIZATION) -fomit-frame-pointer -fno-builtin -D_GNU_SOURCE
78 STRIP = $(STRIPTOOL) --remove-section=.note --remove-section=.comment $(PROG)
79 #Only staticly link when _not_ debugging
80 ifeq ($(DOSTATIC),true)
86 PREFIX = `pwd`/_install
90 OBJECTS = $(shell ./busybox.sh) busybox.o messages.o utility.o
91 CFLAGS += -DBB_VER='"$(VERSION)"'
92 CFLAGS += -DBB_BT='"$(BUILDTIME)"'
94 CFLAGS += -DINIT_SCRIPT='"$(BB_INIT_SCRIPT)"'
97 all: busybox busybox.links docs
101 $(CC) $(LDFLAGS) -o $@ $^ $(LIBRARIES)
104 busybox.links: busybox.def.h
105 - ./busybox.mkll | sort >$@
107 docs: docs/busybox.pod
108 cd docs && $(MAKE) clean all
110 regexp.o nfsmount.o: %.o: %.h
111 $(OBJECTS): %.o: busybox.def.h internal.h %.c
115 cd tests && $(MAKE) all
119 - rm -f busybox.links *~ *.o core
121 - cd tests && $(MAKE) clean
126 - cd tests && $(MAKE) distclean
129 install: busybox busybox.links
130 ./install.sh $(PREFIX)
133 dist release: distclean
134 cd docs && $(MAKE) clean all
136 rm -rf busybox-$(VERSION); \
137 cp -a busybox busybox-$(VERSION); \
139 find busybox-$(VERSION)/ -type d \
144 find busybox-$(VERSION)/ -type f \
149 tar -cvzf busybox-$(VERSION).tar.gz busybox-$(VERSION)/;