1# ========================================================================== 2# Build system 3# ========================================================================== 4 5busybox.links: $(srctree)/applets/busybox.mkll $(objtree)/include/autoconf.h include/applets.h 6 $(Q)-$(SHELL) $^ > $@ 7 8busybox.cfg.suid: $(srctree)/applets/busybox.mksuid $(objtree)/include/autoconf.h include/applets.h 9 $(Q)-SUID="yes" $(SHELL) $^ > $@ 10busybox.cfg.nosuid: $(srctree)/applets/busybox.mksuid $(objtree)/include/autoconf.h include/applets.h 11 $(Q)-SUID="DROP" $(SHELL) $^ > $@ 12 13.PHONY: install 14ifeq ($(CONFIG_INSTALL_APPLET_DONT),y) 15INSTALL_OPTS:= --none 16endif 17ifeq ($(CONFIG_INSTALL_APPLET_SYMLINKS),y) 18INSTALL_OPTS:= --symlinks 19endif 20ifeq ($(CONFIG_INSTALL_APPLET_HARDLINKS),y) 21INSTALL_OPTS:= --hardlinks 22endif 23ifeq ($(CONFIG_INSTALL_APPLET_SCRIPT_WRAPPERS),y) 24ifeq ($(CONFIG_INSTALL_SH_APPLET_SYMLINK),y) 25INSTALL_OPTS:= --sw-sh-sym 26endif 27ifeq ($(CONFIG_INSTALL_SH_APPLET_HARDLINK),y) 28INSTALL_OPTS:= --sw-sh-hard 29endif 30ifeq ($(CONFIG_INSTALL_SH_APPLET_SCRIPT_WRAPPER),y) 31INSTALL_OPTS:= --scriptwrapper 32endif 33endif 34ifeq ($(CONFIG_FEATURE_INDIVIDUAL),y) 35INSTALL_OPTS:= --binaries 36LIBBUSYBOX_SONAME:= 0_lib/libbusybox.so.$(BB_VER) 37endif 38install: $(srctree)/applets/install.sh busybox busybox.links 39 $(Q)DO_INSTALL_LIBS="$(strip $(LIBBUSYBOX_SONAME) $(DO_INSTALL_LIBS))" \ 40 $(SHELL) $< $(CONFIG_PREFIX) $(INSTALL_OPTS) 41ifeq ($(strip $(CONFIG_FEATURE_SUID)),y) 42 @echo 43 @echo 44 @echo -------------------------------------------------- 45 @echo You will probably need to make your busybox binary 46 @echo setuid root to ensure all configured applets will 47 @echo work properly. 48 @echo -------------------------------------------------- 49 @echo 50endif 51 52install-noclobber: INSTALL_OPTS+=--noclobber 53install-noclobber: install 54 55uninstall: busybox.links 56 rm -f $(CONFIG_PREFIX)/bin/busybox 57 for i in `cat busybox.links` ; do rm -f $(CONFIG_PREFIX)$$i; done 58ifneq ($(strip $(DO_INSTALL_LIBS)),n) 59 for i in $(LIBBUSYBOX_SONAME) $(DO_INSTALL_LIBS); do \ 60 rm -f $(CONFIG_PREFIX)$$i; \ 61 done 62endif 63 64# Not very elegant: copies testsuite to objdir... 65# (cp -pPR is POSIX-compliant (cp -dpR or cp -a would not be)) 66.PHONY: check 67.PHONY: test 68ifeq ($(CONFIG_UNIT_TEST),y) 69UNIT_CMD = ./busybox unit 70endif 71check test: busybox busybox.links 72 $(UNIT_CMD) 73 test -d $(objtree)/testsuite || cp -pPR $(srctree)/testsuite $(objtree) 74 bindir=$(objtree) srcdir=$(srctree)/testsuite \ 75 $(SHELL) -c "cd $(objtree)/testsuite && $(srctree)/testsuite/runtest $(if $(KBUILD_VERBOSE:0=),-v)" 76 77.PHONY: release 78release: distclean 79 cd ..; \ 80 rm -r -f busybox-$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION); \ 81 cp -pPR busybox busybox-$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION) && { \ 82 find busybox-$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)/ -type d \ 83 -name .svn \ 84 -print \ 85 -exec rm -r -f {} \; ; \ 86 find busybox-$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)/ -type d \ 87 -name .git \ 88 -print \ 89 -exec rm -r -f {} \; ; \ 90 find busybox-$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)/ -type f \ 91 -name .gitignore \ 92 -print \ 93 -exec rm -f {} \; ; \ 94 find busybox-$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)/ -type f \ 95 -name .\#* \ 96 -print \ 97 -exec rm -f {} \; ; \ 98 tar -czf busybox-$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION).tar.gz \ 99 busybox-$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)/ ; } 100 101.PHONY: checkhelp 102checkhelp: 103 $(Q)$(srctree)/scripts/checkhelp.awk \ 104 $(patsubst %,$(srctree)/%,$(wildcard $(patsubst %,%/Config.in,$(busybox-dirs) ./))) 105 106.PHONY: sizes 107sizes: busybox_unstripped 108 $(NM) --size-sort $(<) 109 110.PHONY: bloatcheck 111bloatcheck: busybox_old busybox_unstripped 112 @$(srctree)/scripts/bloat-o-meter busybox_old busybox_unstripped 113 @$(CROSS_COMPILE)size busybox_old busybox_unstripped 114 115.PHONY: baseline 116baseline: busybox_unstripped 117 @mv busybox_unstripped busybox_old 118 119.PHONY: objsizes 120objsizes: busybox_unstripped 121 $(srctree)/scripts/objsizes 122 123.PHONY: stksizes 124stksizes: busybox_unstripped 125 $(CROSS_COMPILE)objdump -d busybox_unstripped | $(srctree)/scripts/checkstack.pl $(ARCH) | uniq 126 127.PHONY: bigdata 128bigdata: busybox_unstripped 129 $(CROSS_COMPILE)nm --size-sort busybox_unstripped | grep -vi ' [trw] ' 130 131# Documentation Targets 132.PHONY: doc 133doc: docs/busybox.pod docs/BusyBox.txt docs/busybox.1 docs/BusyBox.html 134 135# FIXME: Doesn't belong here 136 cmd_doc = 137 quiet_cmd_doc = $(Q)echo " DOC $(@F)" 138silent_cmd_doc = 139disp_doc = $($(quiet)cmd_doc) 140 141# sed adds newlines after "Options:" etc, 142# this is needed in order to get good BusyBox.{1,txt,html} 143docs/busybox.pod: $(srctree)/docs/busybox_header.pod \ 144 include/usage.h \ 145 $(srctree)/docs/busybox_footer.pod \ 146 applets/usage_pod 147 $(disp_doc) 148 $(Q)-mkdir -p docs 149 $(Q)-( \ 150 cat $(srctree)/docs/busybox_header.pod; \ 151 echo; \ 152 applets/usage_pod | sed 's/^[A-Za-z][A-Za-z ]*[a-z]:$$/&\n/'; \ 153 cat $(srctree)/docs/busybox_footer.pod; \ 154 ) > docs/busybox.pod 155 156docs/BusyBox.txt: docs/busybox.pod 157 $(disp_doc) 158 $(Q)-mkdir -p docs 159 $(Q)-pod2text $< > $@ 160 161docs/busybox.1: docs/busybox.pod 162 $(disp_doc) 163 $(Q)-mkdir -p docs 164 $(Q)-pod2man --center=busybox --release="version $(KERNELVERSION)" $< > $@ 165 166docs/BusyBox.html: docs/busybox.net/BusyBox.html 167 $(disp_doc) 168 $(Q)-mkdir -p docs 169 $(Q)-rm -f docs/BusyBox.html 170 $(Q)-cp docs/busybox.net/BusyBox.html docs/BusyBox.html 171 172docs/busybox.net/BusyBox.html: docs/busybox.pod 173 $(Q)-mkdir -p docs/busybox.net 174 $(Q)-pod2html --noindex $< > $@ 175 $(Q)-rm -f pod2htm* 176 177# documentation, cross-reference 178# Modern distributions already ship synopsis packages (e.g. debian) 179# If you have an old distribution go to http://synopsis.fresco.org/ 180syn_tgt = $(wildcard $(patsubst %,%/*.c,$(busybox-alldirs))) 181syn = $(patsubst %.c, %.syn, $(syn_tgt)) 182 183comma:= , 184brace_open:= ( 185brace_close:= ) 186 187SYN_CPPFLAGS := $(strip $(CPPFLAGS) $(EXTRA_CPPFLAGS)) 188SYN_CPPFLAGS := $(subst $(brace_open),\$(brace_open),$(SYN_CPPFLAGS)) 189SYN_CPPFLAGS := $(subst $(brace_close),\$(brace_close),$(SYN_CPPFLAGS)) 190#SYN_CPPFLAGS := $(subst ",\",$(SYN_CPPFLAGS)) 191#") 192#SYN_CPPFLAGS := [$(patsubst %,'%'$(comma),$(SYN_CPPFLAGS))''] 193 194%.syn: %.c 195 synopsis -p C -l Comments.SSDFilter,Comments.Previous -Wp,preprocess=True,cppflags="'$(SYN_CPPFLAGS)'" -o $@ $< 196 197.PHONY: html 198html: $(syn) 199 synopsis -f HTML -Wf,title="'BusyBox Documentation'" -o $@ $^ 200 201-include $(srctree)/Makefile.local 202