diff options
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 47 |
1 files changed, 33 insertions, 14 deletions
@@ -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 | ||
18 | PROG := busybox | 21 | # PROG := busybox |
19 | VERSION := 0.42 | 22 | VERSION := 0.42 |
20 | BUILDTIME := $(shell TZ=GMT date "+%Y%m%d-%H%M") | 23 | BUILDTIME := $(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' |
25 | DODEBUG = false | 28 | DODEBUG = 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 |
61 | endif | 64 | endif |
62 | 65 | ||
66 | # Allow alternative stripping tools to be used... | ||
67 | ifndef $(STRIPTOOL) | ||
68 | STRIPTOOL = strip | ||
69 | endif | ||
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 |
64 | ifeq ($(DODEBUG),true) | 73 | ifeq ($(DODEBUG),true) |
65 | CFLAGS += -Wall -g -D_GNU_SOURCE | 74 | CFLAGS += -Wall -g -D_GNU_SOURCE |
66 | STRIP = | ||
67 | LDFLAGS = | 75 | LDFLAGS = |
76 | STRIP = | ||
68 | else | 77 | else |
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 | |||
84 | CFLAGS += -DBB_VER='"$(VERSION)"' | 93 | CFLAGS += -DBB_VER='"$(VERSION)"' |
85 | CFLAGS += -DBB_BT='"$(BUILDTIME)"' | 94 | CFLAGS += -DBB_BT='"$(BUILDTIME)"' |
86 | ifdef BB_INIT_SCRIPT | 95 | ifdef BB_INIT_SCRIPT |
87 | CFLAGS += -DINIT_SCRIPT=${BB_INIT_SCRIPT} | 96 | CFLAGS += -DINIT_SCRIPT='"$(BB_INIT_SCRIPT)"' |
88 | endif | 97 | endif |
89 | 98 | ||
90 | all: busybox busybox.links | 99 | all: busybox busybox.links |
100 | .PHONY: all | ||
91 | 101 | ||
92 | busybox: $(OBJECTS) | 102 | busybox: $(OBJECTS) |
93 | $(CC) $(LDFLAGS) -o $(PROG) $(OBJECTS) $(LIBRARIES) | 103 | $(CC) $(LDFLAGS) -o $@ $^ $(LIBRARIES) |
94 | $(STRIP) | 104 | $(STRIP) $@ |
95 | 105 | ||
96 | busybox.links: busybox.def.h | 106 | busybox.links: busybox.def.h |
97 | - ./busybox.mkll | sort >$@ | 107 | - ./busybox.mkll | sort >$@ |
98 | 108 | ||
109 | regexp.o nfsmount.o: %.o: %.h | ||
110 | $(OBJECTS): %.o: busybox.def.h internal.h %.c | ||
111 | |||
112 | .PHONY: test tests | ||
113 | test tests: | ||
114 | cd tests && $(MAKE) all | ||
115 | |||
116 | .PHONY: clean | ||
99 | clean: | 117 | clean: |
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 | ||
103 | distclean: clean | 123 | distclean: 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 | ||
108 | install: busybox busybox.links | 128 | install: busybox busybox.links |
109 | ./install.sh $(PREFIX) | 129 | ./install.sh $(PREFIX) |
110 | 130 | ||
111 | dist: release | 131 | .PHONY: dist release |
112 | 132 | dist release: distclean | |
113 | release: 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); \ |