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