Denis Vlasenko | da8f43f | 2006-10-09 19:47:38 +0000 | [diff] [blame] | 1 | # ========================================================================== |
| 2 | # Build system |
| 3 | # ========================================================================== |
Denis Vlasenko | 7d219aa | 2006-10-05 10:17:08 +0000 | [diff] [blame] | 4 | |
Denys Vlasenko | 6c5bf0d | 2010-06-06 00:53:45 +0200 | [diff] [blame] | 5 | busybox.links: $(srctree)/applets/busybox.mkll $(objtree)/include/autoconf.h include/applets.h |
Bernhard Reutner-Fischer | 9078633 | 2013-06-10 17:08:22 +0200 | [diff] [blame] | 6 | $(Q)-$(SHELL) $^ > $@ |
| 7 | |
| 8 | busybox.cfg.suid: $(srctree)/applets/busybox.mksuid $(objtree)/include/autoconf.h include/applets.h |
| 9 | $(Q)-SUID="yes" $(SHELL) $^ > $@ |
| 10 | busybox.cfg.nosuid: $(srctree)/applets/busybox.mksuid $(objtree)/include/autoconf.h include/applets.h |
| 11 | $(Q)-SUID="DROP" $(SHELL) $^ > $@ |
Denis Vlasenko | 7d219aa | 2006-10-05 10:17:08 +0000 | [diff] [blame] | 12 | |
| 13 | .PHONY: install |
Yann E. MORIN | 296381f | 2018-04-15 10:55:30 +0200 | [diff] [blame] | 14 | ifeq ($(CONFIG_INSTALL_APPLET_DONT),y) |
| 15 | INSTALL_OPTS:= --none |
| 16 | endif |
Bernhard Reutner-Fischer | 8bfd215 | 2006-11-17 13:54:29 +0000 | [diff] [blame] | 17 | ifeq ($(CONFIG_INSTALL_APPLET_SYMLINKS),y) |
| 18 | INSTALL_OPTS:= --symlinks |
| 19 | endif |
| 20 | ifeq ($(CONFIG_INSTALL_APPLET_HARDLINKS),y) |
| 21 | INSTALL_OPTS:= --hardlinks |
| 22 | endif |
Denis Vlasenko | 737d131 | 2007-08-25 18:25:24 +0000 | [diff] [blame] | 23 | ifeq ($(CONFIG_INSTALL_APPLET_SCRIPT_WRAPPERS),y) |
| 24 | ifeq ($(CONFIG_INSTALL_SH_APPLET_SYMLINK),y) |
| 25 | INSTALL_OPTS:= --sw-sh-sym |
| 26 | endif |
| 27 | ifeq ($(CONFIG_INSTALL_SH_APPLET_HARDLINK),y) |
| 28 | INSTALL_OPTS:= --sw-sh-hard |
| 29 | endif |
| 30 | ifeq ($(CONFIG_INSTALL_SH_APPLET_SCRIPT_WRAPPER),y) |
| 31 | INSTALL_OPTS:= --scriptwrapper |
| 32 | endif |
| 33 | endif |
Clayton Shotwell | b7ee7e1 | 2015-05-21 14:48:35 -0500 | [diff] [blame] | 34 | ifeq ($(CONFIG_FEATURE_INDIVIDUAL),y) |
| 35 | INSTALL_OPTS:= --binaries |
| 36 | LIBBUSYBOX_SONAME:= 0_lib/libbusybox.so.$(BB_VER) |
| 37 | endif |
Denis Vlasenko | 7d219aa | 2006-10-05 10:17:08 +0000 | [diff] [blame] | 38 | install: $(srctree)/applets/install.sh busybox busybox.links |
| 39 | $(Q)DO_INSTALL_LIBS="$(strip $(LIBBUSYBOX_SONAME) $(DO_INSTALL_LIBS))" \ |
| 40 | $(SHELL) $< $(CONFIG_PREFIX) $(INSTALL_OPTS) |
| 41 | ifeq ($(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 |
| 50 | endif |
| 51 | |
Yann E. MORIN | a47375d | 2017-12-28 23:49:49 +0100 | [diff] [blame] | 52 | install-noclobber: INSTALL_OPTS+=--noclobber |
| 53 | install-noclobber: install |
| 54 | |
Denis Vlasenko | 7d219aa | 2006-10-05 10:17:08 +0000 | [diff] [blame] | 55 | uninstall: busybox.links |
| 56 | rm -f $(CONFIG_PREFIX)/bin/busybox |
| 57 | for i in `cat busybox.links` ; do rm -f $(CONFIG_PREFIX)$$i; done |
| 58 | ifneq ($(strip $(DO_INSTALL_LIBS)),n) |
| 59 | for i in $(LIBBUSYBOX_SONAME) $(DO_INSTALL_LIBS); do \ |
| 60 | rm -f $(CONFIG_PREFIX)$$i; \ |
| 61 | done |
| 62 | endif |
| 63 | |
Denis Vlasenko | b75a1c3 | 2008-04-10 19:59:20 +0000 | [diff] [blame] | 64 | # Not very elegant: copies testsuite to objdir... |
Denis Vlasenko | 80f647c | 2008-04-11 10:54:37 +0000 | [diff] [blame] | 65 | # (cp -pPR is POSIX-compliant (cp -dpR or cp -a would not be)) |
Denis Vlasenko | b75a1c3 | 2008-04-10 19:59:20 +0000 | [diff] [blame] | 66 | .PHONY: check |
| 67 | .PHONY: test |
Bartosz Golaszewski | 3ed81cf | 2014-06-22 16:30:41 +0200 | [diff] [blame] | 68 | ifeq ($(CONFIG_UNIT_TEST),y) |
| 69 | UNIT_CMD = ./busybox unit |
| 70 | endif |
Bernhard Reutner-Fischer | aae82e0 | 2007-01-27 22:04:58 +0000 | [diff] [blame] | 71 | check test: busybox busybox.links |
Bartosz Golaszewski | 3ed81cf | 2014-06-22 16:30:41 +0200 | [diff] [blame] | 72 | $(UNIT_CMD) |
Denis Vlasenko | 80f647c | 2008-04-11 10:54:37 +0000 | [diff] [blame] | 73 | test -d $(objtree)/testsuite || cp -pPR $(srctree)/testsuite $(objtree) |
Denis Vlasenko | b75a1c3 | 2008-04-10 19:59:20 +0000 | [diff] [blame] | 74 | bindir=$(objtree) srcdir=$(srctree)/testsuite \ |
| 75 | $(SHELL) -c "cd $(objtree)/testsuite && $(srctree)/testsuite/runtest $(if $(KBUILD_VERBOSE:0=),-v)" |
Denis Vlasenko | 7d219aa | 2006-10-05 10:17:08 +0000 | [diff] [blame] | 76 | |
Denis Vlasenko | 5fa7148 | 2006-12-12 22:31:15 +0000 | [diff] [blame] | 77 | .PHONY: release |
| 78 | release: distclean |
| 79 | cd ..; \ |
| 80 | rm -r -f busybox-$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION); \ |
Denis Vlasenko | 80f647c | 2008-04-11 10:54:37 +0000 | [diff] [blame] | 81 | cp -pPR busybox busybox-$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION) && { \ |
Denis Vlasenko | 5fa7148 | 2006-12-12 22:31:15 +0000 | [diff] [blame] | 82 | find busybox-$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)/ -type d \ |
| 83 | -name .svn \ |
| 84 | -print \ |
Denis Vlasenko | 5e2db5e | 2006-12-12 23:46:31 +0000 | [diff] [blame] | 85 | -exec rm -r -f {} \; ; \ |
Denys Vlasenko | 603884b | 2010-03-28 20:26:40 +0200 | [diff] [blame] | 86 | find busybox-$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)/ -type d \ |
| 87 | -name .git \ |
| 88 | -print \ |
| 89 | -exec rm -r -f {} \; ; \ |
Denis Vlasenko | 5fa7148 | 2006-12-12 22:31:15 +0000 | [diff] [blame] | 90 | find busybox-$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)/ -type f \ |
Denys Vlasenko | 17f4aca | 2013-11-02 22:06:36 +0100 | [diff] [blame] | 91 | -name .gitignore \ |
| 92 | -print \ |
| 93 | -exec rm -f {} \; ; \ |
| 94 | find busybox-$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)/ -type f \ |
Denis Vlasenko | 5fa7148 | 2006-12-12 22:31:15 +0000 | [diff] [blame] | 95 | -name .\#* \ |
| 96 | -print \ |
Denis Vlasenko | 5e2db5e | 2006-12-12 23:46:31 +0000 | [diff] [blame] | 97 | -exec rm -f {} \; ; \ |
Denis Vlasenko | 5fa7148 | 2006-12-12 22:31:15 +0000 | [diff] [blame] | 98 | tar -czf busybox-$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION).tar.gz \ |
Denis Vlasenko | 5e2db5e | 2006-12-12 23:46:31 +0000 | [diff] [blame] | 99 | busybox-$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)/ ; } |
Denis Vlasenko | 5fa7148 | 2006-12-12 22:31:15 +0000 | [diff] [blame] | 100 | |
Bernhard Reutner-Fischer | d6bbf99 | 2006-11-22 09:39:48 +0000 | [diff] [blame] | 101 | .PHONY: checkhelp |
| 102 | checkhelp: |
| 103 | $(Q)$(srctree)/scripts/checkhelp.awk \ |
| 104 | $(patsubst %,$(srctree)/%,$(wildcard $(patsubst %,%/Config.in,$(busybox-dirs) ./))) |
Denis Vlasenko | 7d219aa | 2006-10-05 10:17:08 +0000 | [diff] [blame] | 105 | |
| 106 | .PHONY: sizes |
| 107 | sizes: busybox_unstripped |
| 108 | $(NM) --size-sort $(<) |
| 109 | |
| 110 | .PHONY: bloatcheck |
| 111 | bloatcheck: busybox_old busybox_unstripped |
| 112 | @$(srctree)/scripts/bloat-o-meter busybox_old busybox_unstripped |
Denis Vlasenko | 931de89 | 2007-06-21 12:43:45 +0000 | [diff] [blame] | 113 | @$(CROSS_COMPILE)size busybox_old busybox_unstripped |
Denis Vlasenko | 7d219aa | 2006-10-05 10:17:08 +0000 | [diff] [blame] | 114 | |
| 115 | .PHONY: baseline |
| 116 | baseline: busybox_unstripped |
| 117 | @mv busybox_unstripped busybox_old |
| 118 | |
| 119 | .PHONY: objsizes |
| 120 | objsizes: busybox_unstripped |
Denis Vlasenko | 1868409 | 2006-10-05 17:11:08 +0000 | [diff] [blame] | 121 | $(srctree)/scripts/objsizes |
Denis Vlasenko | 7d219aa | 2006-10-05 10:17:08 +0000 | [diff] [blame] | 122 | |
Denis Vlasenko | d4fea90 | 2007-06-10 00:54:27 +0000 | [diff] [blame] | 123 | .PHONY: stksizes |
| 124 | stksizes: busybox_unstripped |
Denis Vlasenko | ab80187 | 2007-12-02 08:35:37 +0000 | [diff] [blame] | 125 | $(CROSS_COMPILE)objdump -d busybox_unstripped | $(srctree)/scripts/checkstack.pl $(ARCH) | uniq |
Denis Vlasenko | d4fea90 | 2007-06-10 00:54:27 +0000 | [diff] [blame] | 126 | |
Denis Vlasenko | 0025264 | 2006-11-30 20:41:28 +0000 | [diff] [blame] | 127 | .PHONY: bigdata |
| 128 | bigdata: busybox_unstripped |
Denis Vlasenko | eaad910 | 2008-05-20 06:31:56 +0000 | [diff] [blame] | 129 | $(CROSS_COMPILE)nm --size-sort busybox_unstripped | grep -vi ' [trw] ' |
Denis Vlasenko | 0025264 | 2006-11-30 20:41:28 +0000 | [diff] [blame] | 130 | |
Denis Vlasenko | 7d219aa | 2006-10-05 10:17:08 +0000 | [diff] [blame] | 131 | # Documentation Targets |
| 132 | .PHONY: doc |
Denys Vlasenko | 57b6833 | 2010-10-24 02:09:32 +0200 | [diff] [blame] | 133 | doc: docs/busybox.pod docs/BusyBox.txt docs/busybox.1 docs/BusyBox.html |
Denis Vlasenko | 7d219aa | 2006-10-05 10:17:08 +0000 | [diff] [blame] | 134 | |
Bernhard Reutner-Fischer | a28a05b | 2008-08-21 21:15:28 +0000 | [diff] [blame] | 135 | # FIXME: Doesn't belong here |
Mike Frysinger | 5f9f150 | 2009-03-30 05:26:34 +0000 | [diff] [blame] | 136 | cmd_doc = |
| 137 | quiet_cmd_doc = $(Q)echo " DOC $(@F)" |
| 138 | silent_cmd_doc = |
| 139 | disp_doc = $($(quiet)cmd_doc) |
Bernhard Reutner-Fischer | a28a05b | 2008-08-21 21:15:28 +0000 | [diff] [blame] | 140 | |
Denys Vlasenko | acabf8f | 2009-10-02 01:10:32 +0200 | [diff] [blame] | 141 | # sed adds newlines after "Options:" etc, |
| 142 | # this is needed in order to get good BusyBox.{1,txt,html} |
Denis Vlasenko | 7d219aa | 2006-10-05 10:17:08 +0000 | [diff] [blame] | 143 | docs/busybox.pod: $(srctree)/docs/busybox_header.pod \ |
Denys Vlasenko | f0f9470 | 2010-06-06 01:53:38 +0200 | [diff] [blame] | 144 | include/usage.h \ |
Denis Vlasenko | 7d219aa | 2006-10-05 10:17:08 +0000 | [diff] [blame] | 145 | $(srctree)/docs/busybox_footer.pod \ |
Denys Vlasenko | acabf8f | 2009-10-02 01:10:32 +0200 | [diff] [blame] | 146 | applets/usage_pod |
Denis Vlasenko | 7d219aa | 2006-10-05 10:17:08 +0000 | [diff] [blame] | 147 | $(disp_doc) |
| 148 | $(Q)-mkdir -p docs |
Denys Vlasenko | acabf8f | 2009-10-02 01:10:32 +0200 | [diff] [blame] | 149 | $(Q)-( \ |
| 150 | cat $(srctree)/docs/busybox_header.pod; \ |
Bernhard Reutner-Fischer | 64b6f7c | 2010-07-29 09:34:04 +0200 | [diff] [blame] | 151 | echo; \ |
Denys Vlasenko | acabf8f | 2009-10-02 01:10:32 +0200 | [diff] [blame] | 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 |
Denis Vlasenko | 7d219aa | 2006-10-05 10:17:08 +0000 | [diff] [blame] | 155 | |
| 156 | docs/BusyBox.txt: docs/busybox.pod |
| 157 | $(disp_doc) |
| 158 | $(Q)-mkdir -p docs |
| 159 | $(Q)-pod2text $< > $@ |
| 160 | |
Denys Vlasenko | 57b6833 | 2010-10-24 02:09:32 +0200 | [diff] [blame] | 161 | docs/busybox.1: docs/busybox.pod |
Denis Vlasenko | 7d219aa | 2006-10-05 10:17:08 +0000 | [diff] [blame] | 162 | $(disp_doc) |
| 163 | $(Q)-mkdir -p docs |
Denys Vlasenko | 57b6833 | 2010-10-24 02:09:32 +0200 | [diff] [blame] | 164 | $(Q)-pod2man --center=busybox --release="version $(KERNELVERSION)" $< > $@ |
Denis Vlasenko | 7d219aa | 2006-10-05 10:17:08 +0000 | [diff] [blame] | 165 | |
| 166 | docs/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 | |
| 172 | docs/busybox.net/BusyBox.html: docs/busybox.pod |
| 173 | $(Q)-mkdir -p docs/busybox.net |
Denys Vlasenko | acabf8f | 2009-10-02 01:10:32 +0200 | [diff] [blame] | 174 | $(Q)-pod2html --noindex $< > $@ |
Denis Vlasenko | 7d219aa | 2006-10-05 10:17:08 +0000 | [diff] [blame] | 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/ |
Bernhard Reutner-Fischer | bc95f57 | 2006-12-06 15:29:00 +0000 | [diff] [blame] | 180 | syn_tgt = $(wildcard $(patsubst %,%/*.c,$(busybox-alldirs))) |
| 181 | syn = $(patsubst %.c, %.syn, $(syn_tgt)) |
Denis Vlasenko | 7d219aa | 2006-10-05 10:17:08 +0000 | [diff] [blame] | 182 | |
Bernhard Reutner-Fischer | feea1b9 | 2006-12-06 21:51:59 +0000 | [diff] [blame] | 183 | comma:= , |
| 184 | brace_open:= ( |
| 185 | brace_close:= ) |
| 186 | |
| 187 | SYN_CPPFLAGS := $(strip $(CPPFLAGS) $(EXTRA_CPPFLAGS)) |
| 188 | SYN_CPPFLAGS := $(subst $(brace_open),\$(brace_open),$(SYN_CPPFLAGS)) |
| 189 | SYN_CPPFLAGS := $(subst $(brace_close),\$(brace_close),$(SYN_CPPFLAGS)) |
| 190 | #SYN_CPPFLAGS := $(subst ",\",$(SYN_CPPFLAGS)) |
| 191 | #") |
| 192 | #SYN_CPPFLAGS := [$(patsubst %,'%'$(comma),$(SYN_CPPFLAGS))''] |
| 193 | |
Denis Vlasenko | 7d219aa | 2006-10-05 10:17:08 +0000 | [diff] [blame] | 194 | %.syn: %.c |
Bernhard Reutner-Fischer | feea1b9 | 2006-12-06 21:51:59 +0000 | [diff] [blame] | 195 | synopsis -p C -l Comments.SSDFilter,Comments.Previous -Wp,preprocess=True,cppflags="'$(SYN_CPPFLAGS)'" -o $@ $< |
Denis Vlasenko | 7d219aa | 2006-10-05 10:17:08 +0000 | [diff] [blame] | 196 | |
| 197 | .PHONY: html |
| 198 | html: $(syn) |
| 199 | synopsis -f HTML -Wf,title="'BusyBox Documentation'" -o $@ $^ |
Mike Frysinger | 3c82e48 | 2007-05-02 22:07:03 +0000 | [diff] [blame] | 200 | |
| 201 | -include $(srctree)/Makefile.local |