aboutsummaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile109
1 files changed, 62 insertions, 47 deletions
diff --git a/Makefile b/Makefile
index 554dd00f5..490d3935f 100644
--- a/Makefile
+++ b/Makefile
@@ -15,71 +15,74 @@
15# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 15# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16# 16#
17 17
18PROG := busybox
19VERSION := 0.42
20BUILDTIME := $(shell TZ=GMT date "+%Y%m%d-%H%M")
18 21
19PROG=busybox 22# Set the following to `true' to make a debuggable build.
20VERSION=0.42 23# Leave this set to `false' for production use.
21BUILDTIME=$(shell date "+%Y%m%d-%H%M") 24# eg: `make DODEBUG=true'
25DODEBUG = false
22 26
23# Comment out the following to make a debuggable build
24# Leave this off for production use.
25DODEBUG=false
26# If you want a static binary, turn this on. I can't think 27# If you want a static binary, turn this on. I can't think
27# of many situations where anybody would ever want it static, 28# of many situations where anybody would ever want it static,
28# but... 29# but...
29DOSTATIC=false 30DOSTATIC = false
30 31
31#This will choke on a non-debian system 32# This will choke on a non-debian system
32ARCH=`uname -m | sed -e 's/i.86/i386/' | sed -e 's/sparc.*/sparc/'` 33ARCH =`uname -m | sed -e 's/i.86/i386/' | sed -e 's/sparc.*/sparc/'`
33 34
34GCCMAJVERSION=$(shell $(CC) --version | sed -n "s/^\([^\.]*\).*/\1/p" ) 35CC = gcc
35GCCMINVERSION=$(shell $(CC) --version | sed -n "s/^[^\.]*\.\([^\.]*\)[\.].*/\1/p" ) 36
36 37GCCMAJVERSION = $(shell $(CC) --version | sed -n "s/^[^0-9]*\([0-9]\)\.\([0-9].*\)[\.].*/\1/p")
37GCCSUPPORTSOPTSIZE=$(shell \ 38GCCMINVERSION = $(shell $(CC) --version | sed -n "s/^[^0-9]*\([0-9]\)\.\([0-9].*\)[\.].*/\2/p")
38if ( test $(GCCMAJVERSION) -eq 2 ) ; then \ 39
39 if ( test $(GCCMINVERSION) -ge 66 ) ; then \ 40
40 echo "true"; \ 41GCCSUPPORTSOPTSIZE = $(shell \
41 else \ 42if ( test $(GCCMAJVERSION) -eq 2 ) ; then \
42 echo "false"; \ 43 if ( test $(GCCMINVERSION) -ge 66 ) ; then \
43 fi; \ 44 echo "true"; \
44else \ 45 else \
45 if ( test $(GCCMAJVERSION) -gt 2 ) ; then \ 46 echo "false"; \
46 echo "true"; \ 47 fi; \
47 else \ 48else \
48 echo "false"; \ 49 if ( test $(GCCMAJVERSION) -gt 2 ) ; then \
49 fi; \ 50 echo "true"; \
51 else \
52 echo "false"; \
53 fi; \
50fi; ) 54fi; )
51 55
52 56
53ifeq ($(GCCSUPPORTSOPTSIZE), true) 57ifeq ($(GCCSUPPORTSOPTSIZE), true)
54 OPTIMIZATION=-Os 58 OPTIMIZATION = -Os
55else 59else
56 OPTIMIZATION=-O2 60 OPTIMIZATION = -O2
57endif 61endif
58 62
59# -D_GNU_SOURCE is needed because environ is used in init.c 63# -D_GNU_SOURCE is needed because environ is used in init.c
60ifeq ($(DODEBUG),true) 64ifeq ($(DODEBUG),true)
61 CFLAGS+=-Wall -g -D_GNU_SOURCE -DDEBUG_INIT 65 CFLAGS += -Wall -g -D_GNU_SOURCE -DDEBUG_INIT
62 STRIP= 66 STRIP =
63 LDFLAGS= 67 LDFLAGS =
64else 68else
65 CFLAGS+=-Wall $(OPTIMIZATION) -fomit-frame-pointer -fno-builtin -D_GNU_SOURCE 69 CFLAGS += -Wall $(OPTIMIZATION) -fomit-frame-pointer -fno-builtin -D_GNU_SOURCE
66 LDFLAGS= -s 70 LDFLAGS = -s
67 STRIP= strip --remove-section=.note --remove-section=.comment $(PROG) 71 STRIP = strip --remove-section=.note --remove-section=.comment $(PROG)
68 #Only staticly link when _not_ debugging 72 #Only staticly link when _not_ debugging
69 ifeq ($(DOSTATIC),true) 73 ifeq ($(DOSTATIC),true)
70 LDFLAGS+= --static 74 LDFLAGS += --static
71 endif 75 endif
72
73endif 76endif
74 77
75ifndef $(PREFIX) 78ifndef $(PREFIX)
76 PREFIX=`pwd`/_install 79 PREFIX = `pwd`/_install
77endif 80endif
78 81
79LIBRARIES= 82LIBRARIES =
80OBJECTS=$(shell ./busybox.sh) 83OBJECTS = $(shell ./busybox.sh) messages.o utility.o
81CFLAGS+= -DBB_VER='"$(VERSION)"' 84CFLAGS += -DBB_VER='"$(VERSION)"'
82CFLAGS+= -DBB_BT='"$(BUILDTIME)"' 85CFLAGS += -DBB_BT='"$(BUILDTIME)"'
83ifdef BB_INIT_SCRIPT 86ifdef BB_INIT_SCRIPT
84 CFLAGS += -DINIT_SCRIPT=${BB_INIT_SCRIPT} 87 CFLAGS += -DINIT_SCRIPT=${BB_INIT_SCRIPT}
85endif 88endif
@@ -90,7 +93,7 @@ busybox: $(OBJECTS)
90 $(CC) $(LDFLAGS) -o $(PROG) $(OBJECTS) $(LIBRARIES) 93 $(CC) $(LDFLAGS) -o $(PROG) $(OBJECTS) $(LIBRARIES)
91 $(STRIP) 94 $(STRIP)
92 95
93busybox.links: 96busybox.links: busybox.def.h
94 - ./busybox.mkll | sort >$@ 97 - ./busybox.mkll | sort >$@
95 98
96clean: 99clean:
@@ -100,7 +103,7 @@ clean:
100distclean: clean 103distclean: clean
101 - rm -f $(PROG) 104 - rm -f $(PROG)
102 105
103$(OBJECTS): busybox.def.h internal.h Makefile 106$(OBJECTS): %.o: %.c busybox.def.h internal.h Makefile messages.c
104 107
105install: busybox busybox.links 108install: busybox busybox.links
106 ./install.sh $(PREFIX) 109 ./install.sh $(PREFIX)
@@ -108,6 +111,18 @@ install: busybox busybox.links
108dist: release 111dist: release
109 112
110release: distclean 113release: distclean
111 (cd .. ; rm -rf busybox-$(VERSION) ; cp -a busybox busybox-$(VERSION); rm -rf busybox-$(VERSION)/CVS busybox-$(VERSION)/scripts/CVS busybox-$(VERSION)/docs/CVS busybox-$(VERSION)/.cvsignore ; tar -cvzf busybox-$(VERSION).tar.gz busybox-$(VERSION)) 114 cd ..; \
112 115 rm -rf busybox-$(VERSION); \
113 116 cp -a busybox busybox-$(VERSION); \
117 \
118 find busybox-$(VERSION)/ -type d \
119 -name CVS \
120 -print \
121 | xargs rm -rf; \
122 \
123 find busybox-$(VERSION)/ -type f \
124 -name .cvsignore \
125 -print \
126 | xargs rm -f; \
127 \
128 tar -cvzf busybox-$(VERSION).tar.gz busybox-$(VERSION)/;