blob: 3334b31eb81c86ae6f3c2d8614b7b226e453bd48 [file] [log] [blame]
Denis Vlasenkoda8f43f2006-10-09 19:47:38 +00001# ==========================================================================
2# Build system
3# ==========================================================================
Denis Vlasenko7d219aa2006-10-05 10:17:08 +00004
Bernhard Reutner-Fischer193bcf32006-11-17 13:17:04 +00005busybox.links: $(srctree)/applets/busybox.mkll $(objtree)/include/autoconf.h $(srctree)/include/applets.h
Denis Vlasenko7d219aa2006-10-05 10:17:08 +00006 $(Q)-$(SHELL) $^ >$@
7
8.PHONY: install
Bernhard Reutner-Fischer8bfd2152006-11-17 13:54:29 +00009ifeq ($(CONFIG_INSTALL_APPLET_SYMLINKS),y)
10INSTALL_OPTS:= --symlinks
11endif
12ifeq ($(CONFIG_INSTALL_APPLET_HARDLINKS),y)
13INSTALL_OPTS:= --hardlinks
14endif
Denis Vlasenko737d1312007-08-25 18:25:24 +000015ifeq ($(CONFIG_INSTALL_APPLET_SCRIPT_WRAPPERS),y)
16ifeq ($(CONFIG_INSTALL_SH_APPLET_SYMLINK),y)
17INSTALL_OPTS:= --sw-sh-sym
18endif
19ifeq ($(CONFIG_INSTALL_SH_APPLET_HARDLINK),y)
20INSTALL_OPTS:= --sw-sh-hard
21endif
22ifeq ($(CONFIG_INSTALL_SH_APPLET_SCRIPT_WRAPPER),y)
23INSTALL_OPTS:= --scriptwrapper
24endif
25endif
Denis Vlasenko7d219aa2006-10-05 10:17:08 +000026install: $(srctree)/applets/install.sh busybox busybox.links
27 $(Q)DO_INSTALL_LIBS="$(strip $(LIBBUSYBOX_SONAME) $(DO_INSTALL_LIBS))" \
28 $(SHELL) $< $(CONFIG_PREFIX) $(INSTALL_OPTS)
29ifeq ($(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
38endif
39
40uninstall: busybox.links
41 rm -f $(CONFIG_PREFIX)/bin/busybox
42 for i in `cat busybox.links` ; do rm -f $(CONFIG_PREFIX)$$i; done
43ifneq ($(strip $(DO_INSTALL_LIBS)),n)
44 for i in $(LIBBUSYBOX_SONAME) $(DO_INSTALL_LIBS); do \
45 rm -f $(CONFIG_PREFIX)$$i; \
46 done
47endif
48
Denis Vlasenkob75a1c32008-04-10 19:59:20 +000049# Not very elegant: copies testsuite to objdir...
Denis Vlasenko80f647c2008-04-11 10:54:37 +000050# (cp -pPR is POSIX-compliant (cp -dpR or cp -a would not be))
Denis Vlasenkob75a1c32008-04-10 19:59:20 +000051.PHONY: check
52.PHONY: test
Bernhard Reutner-Fischeraae82e02007-01-27 22:04:58 +000053check test: busybox busybox.links
Denis Vlasenko80f647c2008-04-11 10:54:37 +000054 test -d $(objtree)/testsuite || cp -pPR $(srctree)/testsuite $(objtree)
Denis Vlasenkob75a1c32008-04-10 19:59:20 +000055 bindir=$(objtree) srcdir=$(srctree)/testsuite \
56 $(SHELL) -c "cd $(objtree)/testsuite && $(srctree)/testsuite/runtest $(if $(KBUILD_VERBOSE:0=),-v)"
Denis Vlasenko7d219aa2006-10-05 10:17:08 +000057
Denis Vlasenko5fa71482006-12-12 22:31:15 +000058.PHONY: release
59release: distclean
60 cd ..; \
61 rm -r -f busybox-$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION); \
Denis Vlasenko80f647c2008-04-11 10:54:37 +000062 cp -pPR busybox busybox-$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION) && { \
Denis Vlasenko5fa71482006-12-12 22:31:15 +000063 find busybox-$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)/ -type d \
64 -name .svn \
65 -print \
Denis Vlasenko5e2db5e2006-12-12 23:46:31 +000066 -exec rm -r -f {} \; ; \
Denis Vlasenko5fa71482006-12-12 22:31:15 +000067 find busybox-$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)/ -type f \
68 -name .\#* \
69 -print \
Denis Vlasenko5e2db5e2006-12-12 23:46:31 +000070 -exec rm -f {} \; ; \
Denis Vlasenko5fa71482006-12-12 22:31:15 +000071 tar -czf busybox-$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION).tar.gz \
Denis Vlasenko5e2db5e2006-12-12 23:46:31 +000072 busybox-$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)/ ; }
Denis Vlasenko5fa71482006-12-12 22:31:15 +000073
Bernhard Reutner-Fischerd6bbf992006-11-22 09:39:48 +000074.PHONY: checkhelp
75checkhelp:
76 $(Q)$(srctree)/scripts/checkhelp.awk \
77 $(patsubst %,$(srctree)/%,$(wildcard $(patsubst %,%/Config.in,$(busybox-dirs) ./)))
Denis Vlasenko7d219aa2006-10-05 10:17:08 +000078
79.PHONY: sizes
80sizes: busybox_unstripped
81 $(NM) --size-sort $(<)
82
83.PHONY: bloatcheck
84bloatcheck: busybox_old busybox_unstripped
85 @$(srctree)/scripts/bloat-o-meter busybox_old busybox_unstripped
Denis Vlasenko931de892007-06-21 12:43:45 +000086 @$(CROSS_COMPILE)size busybox_old busybox_unstripped
Denis Vlasenko7d219aa2006-10-05 10:17:08 +000087
88.PHONY: baseline
89baseline: busybox_unstripped
90 @mv busybox_unstripped busybox_old
91
92.PHONY: objsizes
93objsizes: busybox_unstripped
Denis Vlasenko18684092006-10-05 17:11:08 +000094 $(srctree)/scripts/objsizes
Denis Vlasenko7d219aa2006-10-05 10:17:08 +000095
Denis Vlasenkod4fea902007-06-10 00:54:27 +000096.PHONY: stksizes
97stksizes: busybox_unstripped
Denis Vlasenkoab801872007-12-02 08:35:37 +000098 $(CROSS_COMPILE)objdump -d busybox_unstripped | $(srctree)/scripts/checkstack.pl $(ARCH) | uniq
Denis Vlasenkod4fea902007-06-10 00:54:27 +000099
Denis Vlasenko00252642006-11-30 20:41:28 +0000100.PHONY: bigdata
101bigdata: busybox_unstripped
Denis Vlasenkod4fea902007-06-10 00:54:27 +0000102 $(CROSS_COMPILE)nm --size-sort busybox_unstripped | grep -vi ' [tr] '
Denis Vlasenko00252642006-11-30 20:41:28 +0000103
Denis Vlasenko7d219aa2006-10-05 10:17:08 +0000104# Documentation Targets
105.PHONY: doc
106doc: docs/busybox.pod docs/BusyBox.txt docs/BusyBox.1 docs/BusyBox.html
107
108docs/busybox.pod: $(srctree)/docs/busybox_header.pod \
109 $(srctree)/include/usage.h \
110 $(srctree)/docs/busybox_footer.pod \
111 $(srctree)/docs/autodocifier.pl
112 $(disp_doc)
113 $(Q)-mkdir -p docs
114 $(Q)-( cat $(srctree)/docs/busybox_header.pod ; \
115 $(srctree)/docs/autodocifier.pl $(srctree)/include/usage.h ; \
116 cat $(srctree)/docs/busybox_footer.pod ; ) > docs/busybox.pod
117
118docs/BusyBox.txt: docs/busybox.pod
119 $(disp_doc)
120 $(Q)-mkdir -p docs
121 $(Q)-pod2text $< > $@
122
123docs/BusyBox.1: docs/busybox.pod
124 $(disp_doc)
125 $(Q)-mkdir -p docs
126 $(Q)-pod2man --center=BusyBox --release="version $(VERSION)" \
127 $< > $@
128
129docs/BusyBox.html: docs/busybox.net/BusyBox.html
130 $(disp_doc)
131 $(Q)-mkdir -p docs
132 $(Q)-rm -f docs/BusyBox.html
133 $(Q)-cp docs/busybox.net/BusyBox.html docs/BusyBox.html
134
135docs/busybox.net/BusyBox.html: docs/busybox.pod
136 $(Q)-mkdir -p docs/busybox.net
137 $(Q)-pod2html --noindex $< > \
138 docs/busybox.net/BusyBox.html
139 $(Q)-rm -f pod2htm*
140
141# documentation, cross-reference
142# Modern distributions already ship synopsis packages (e.g. debian)
143# If you have an old distribution go to http://synopsis.fresco.org/
Bernhard Reutner-Fischerbc95f572006-12-06 15:29:00 +0000144syn_tgt = $(wildcard $(patsubst %,%/*.c,$(busybox-alldirs)))
145syn = $(patsubst %.c, %.syn, $(syn_tgt))
Denis Vlasenko7d219aa2006-10-05 10:17:08 +0000146
Bernhard Reutner-Fischerfeea1b92006-12-06 21:51:59 +0000147comma:= ,
148brace_open:= (
149brace_close:= )
150
151SYN_CPPFLAGS := $(strip $(CPPFLAGS) $(EXTRA_CPPFLAGS))
152SYN_CPPFLAGS := $(subst $(brace_open),\$(brace_open),$(SYN_CPPFLAGS))
153SYN_CPPFLAGS := $(subst $(brace_close),\$(brace_close),$(SYN_CPPFLAGS))
154#SYN_CPPFLAGS := $(subst ",\",$(SYN_CPPFLAGS))
155#")
156#SYN_CPPFLAGS := [$(patsubst %,'%'$(comma),$(SYN_CPPFLAGS))'']
157
Denis Vlasenko7d219aa2006-10-05 10:17:08 +0000158%.syn: %.c
Bernhard Reutner-Fischerfeea1b92006-12-06 21:51:59 +0000159 synopsis -p C -l Comments.SSDFilter,Comments.Previous -Wp,preprocess=True,cppflags="'$(SYN_CPPFLAGS)'" -o $@ $<
Denis Vlasenko7d219aa2006-10-05 10:17:08 +0000160
161.PHONY: html
162html: $(syn)
163 synopsis -f HTML -Wf,title="'BusyBox Documentation'" -o $@ $^
Mike Frysinger3c82e482007-05-02 22:07:03 +0000164
165-include $(srctree)/Makefile.local