aboutsummaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile47
1 files changed, 33 insertions, 14 deletions
diff --git a/Makefile b/Makefile
index 6543e1f89..10b76ee43 100644
--- a/Makefile
+++ b/Makefile
@@ -1,5 +1,8 @@
1# Makefile for busybox 1# Makefile for busybox
2# 2#
3# Copyright (C) 1999-2000 Erik Andersen <andersee@debian.org>
4# Copyright (C) 2000 Karl M. Hegbloom <karlheg@debian.org>
5#
3# This program is free software; you can redistribute it and/or modify 6# This program is free software; you can redistribute it and/or modify
4# it under the terms of the GNU General Public License as published by 7# it under the terms of the GNU General Public License as published by
5# the Free Software Foundation; either version 2 of the License, or 8# the Free Software Foundation; either version 2 of the License, or
@@ -15,13 +18,13 @@
15# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16# 19#
17 20
18PROG := busybox 21# PROG := busybox
19VERSION := 0.42 22VERSION := 0.42
20BUILDTIME := $(shell TZ=GMT date "+%Y%m%d-%H%M") 23BUILDTIME := $(shell TZ=GMT date "+%Y%m%d-%H%M")
21 24
22# Set the following to `true' to make a debuggable build. 25# Set the following to `true' to make a debuggable build.
23# Leave this set to `false' for production use. 26# Leave this set to `false' for production use.
24# eg: `make DODEBUG=true' 27# eg: `make DODEBUG=true tests'
25DODEBUG = false 28DODEBUG = false
26 29
27# If you want a static binary, turn this on. I can't think 30# If you want a static binary, turn this on. I can't think
@@ -60,15 +63,21 @@ else
60 OPTIMIZATION = -O2 63 OPTIMIZATION = -O2
61endif 64endif
62 65
66# Allow alternative stripping tools to be used...
67ifndef $(STRIPTOOL)
68 STRIPTOOL = strip
69endif
70
71
63# -D_GNU_SOURCE is needed because environ is used in init.c 72# -D_GNU_SOURCE is needed because environ is used in init.c
64ifeq ($(DODEBUG),true) 73ifeq ($(DODEBUG),true)
65 CFLAGS += -Wall -g -D_GNU_SOURCE 74 CFLAGS += -Wall -g -D_GNU_SOURCE
66 STRIP =
67 LDFLAGS = 75 LDFLAGS =
76 STRIP =
68else 77else
69 CFLAGS += -Wall $(OPTIMIZATION) -fomit-frame-pointer -fno-builtin -D_GNU_SOURCE 78 CFLAGS += -Wall $(OPTIMIZATION) -fomit-frame-pointer -fno-builtin -D_GNU_SOURCE
70 LDFLAGS = -s 79 LDFLAGS = -s
71 STRIP = strip --remove-section=.note --remove-section=.comment $(PROG) 80 STRIP = $(STRIPTOOL) --remove-section=.note --remove-section=.comment
72 #Only staticly link when _not_ debugging 81 #Only staticly link when _not_ debugging
73 ifeq ($(DOSTATIC),true) 82 ifeq ($(DOSTATIC),true)
74 LDFLAGS += --static 83 LDFLAGS += --static
@@ -84,33 +93,43 @@ OBJECTS = $(shell ./busybox.sh) messages.o utility.o
84CFLAGS += -DBB_VER='"$(VERSION)"' 93CFLAGS += -DBB_VER='"$(VERSION)"'
85CFLAGS += -DBB_BT='"$(BUILDTIME)"' 94CFLAGS += -DBB_BT='"$(BUILDTIME)"'
86ifdef BB_INIT_SCRIPT 95ifdef BB_INIT_SCRIPT
87 CFLAGS += -DINIT_SCRIPT=${BB_INIT_SCRIPT} 96 CFLAGS += -DINIT_SCRIPT='"$(BB_INIT_SCRIPT)"'
88endif 97endif
89 98
90all: busybox busybox.links 99all: busybox busybox.links
100.PHONY: all
91 101
92busybox: $(OBJECTS) 102busybox: $(OBJECTS)
93 $(CC) $(LDFLAGS) -o $(PROG) $(OBJECTS) $(LIBRARIES) 103 $(CC) $(LDFLAGS) -o $@ $^ $(LIBRARIES)
94 $(STRIP) 104 $(STRIP) $@
95 105
96busybox.links: busybox.def.h 106busybox.links: busybox.def.h
97 - ./busybox.mkll | sort >$@ 107 - ./busybox.mkll | sort >$@
98 108
109regexp.o nfsmount.o: %.o: %.h
110$(OBJECTS): %.o: busybox.def.h internal.h %.c
111
112.PHONY: test tests
113test tests:
114 cd tests && $(MAKE) all
115
116.PHONY: clean
99clean: 117clean:
100 - rm -f $(PROG) busybox.links *~ *.o core 118 - rm -f busybox.links *~ *.o core
101 - rm -rf _install 119 - rm -rf _install
120 - cd tests && $(MAKE) clean
102 121
122.PHONY: distclean
103distclean: clean 123distclean: clean
104 - rm -f $(PROG) 124 - rm -f busybox
105 125 - cd tests && $(MAKE) distclean
106$(OBJECTS): %.o: %.c busybox.def.h internal.h Makefile messages.c
107 126
127.PHONY: install
108install: busybox busybox.links 128install: busybox busybox.links
109 ./install.sh $(PREFIX) 129 ./install.sh $(PREFIX)
110 130
111dist: release 131.PHONY: dist release
112 132dist release: distclean
113release: distclean
114 cd ..; \ 133 cd ..; \
115 rm -rf busybox-$(VERSION); \ 134 rm -rf busybox-$(VERSION); \
116 cp -a busybox busybox-$(VERSION); \ 135 cp -a busybox busybox-$(VERSION); \