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