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