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