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