2b999f088d39c5f1d68d8e415ebbe847f9302566
[oweals/busybox.git] / Makefile
1
2 VERSION=0.29alpha1
3 BUILDTIME=$(shell date "+%Y%m%d-%H%M")
4 DODEBUG=true
5
6 #This will choke on a non-debian system
7 ARCH=`uname -m | sed -e 's/i.86/i386/' | sed -e 's/sparc.*/sparc/'`
8
9
10 # -D_GNU_SOURCE is needed because environ is used in init.c
11 ifeq ($(DODEBUG),true)
12     CFLAGS=-Wall -g -D_GNU_SOURCE
13     STRIP=
14 else
15     CFLAGS=-Wall -O2 -fomit-frame-pointer -fno-builtin -D_GNU_SOURCE
16     STRIP= strip --remove-section=.note --remove-section=.comment busybox
17 endif
18
19 ifndef $(prefix)
20     prefix=`pwd`
21 endif
22 BINDIR=$(prefix)
23
24 LDFLAGS= -s
25 LIBRARIES=-lc
26 OBJECTS=$(shell ./busybox.sh) utility.o
27 CFLAGS+= -DBB_VER='"$(VERSION)"'
28 CFLAGS+= -DBB_BT='"$(BUILDTIME)"'
29
30 all: busybox links
31 #all: busybox
32
33 busybox: $(OBJECTS)
34         $(CC) $(CFLAGS) $(LDFLAGS) -o busybox $(OBJECTS) $(LIBRARIES)
35         $(STRIP)
36
37 links:
38         - ./busybox.mkll | sort >busybox.links
39         
40 clean:
41         - rm -f busybox busybox.links *~ *.o 
42
43 distclean: clean
44         - rm -f busybox
45
46 force:
47
48 $(OBJECTS):  busybox.def.h internal.h Makefile
49
50 install:    busybox
51         install.sh $(BINDIR)
52