summaryrefslogtreecommitdiff
path: root/Makefile.custom (plain)
blob: 8c95ef2d42349349cc863865a3e7a41f42165769
1# ==========================================================================
2# Build system
3# ==========================================================================
4
5busybox.links: $(srctree)/applets/busybox.mkll $(objtree)/include/autoconf.h include/applets.h
6 $(Q)-$(SHELL) $^ > $@
7
8busybox.cfg.suid: $(srctree)/applets/busybox.mksuid $(objtree)/include/autoconf.h include/applets.h
9 $(Q)-SUID="yes" $(SHELL) $^ > $@
10busybox.cfg.nosuid: $(srctree)/applets/busybox.mksuid $(objtree)/include/autoconf.h include/applets.h
11 $(Q)-SUID="DROP" $(SHELL) $^ > $@
12
13.PHONY: install
14ifeq ($(CONFIG_INSTALL_APPLET_SYMLINKS),y)
15INSTALL_OPTS:= --symlinks
16endif
17ifeq ($(CONFIG_INSTALL_APPLET_HARDLINKS),y)
18INSTALL_OPTS:= --hardlinks
19endif
20ifeq ($(CONFIG_INSTALL_APPLET_SCRIPT_WRAPPERS),y)
21ifeq ($(CONFIG_INSTALL_SH_APPLET_SYMLINK),y)
22INSTALL_OPTS:= --sw-sh-sym
23endif
24ifeq ($(CONFIG_INSTALL_SH_APPLET_HARDLINK),y)
25INSTALL_OPTS:= --sw-sh-hard
26endif
27ifeq ($(CONFIG_INSTALL_SH_APPLET_SCRIPT_WRAPPER),y)
28INSTALL_OPTS:= --scriptwrapper
29endif
30endif
31install: $(srctree)/applets/install.sh busybox busybox.links
32 $(Q)DO_INSTALL_LIBS="$(strip $(LIBBUSYBOX_SONAME) $(DO_INSTALL_LIBS))" \
33 $(SHELL) $< $(CONFIG_PREFIX) $(INSTALL_OPTS)
34ifeq ($(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
43endif
44
45uninstall: busybox.links
46 rm -f $(CONFIG_PREFIX)/bin/busybox
47 for i in `cat busybox.links` ; do rm -f $(CONFIG_PREFIX)$$i; done
48ifneq ($(strip $(DO_INSTALL_LIBS)),n)
49 for i in $(LIBBUSYBOX_SONAME) $(DO_INSTALL_LIBS); do \
50 rm -f $(CONFIG_PREFIX)$$i; \
51 done
52endif
53
54# Not very elegant: copies testsuite to objdir...
55# (cp -pPR is POSIX-compliant (cp -dpR or cp -a would not be))
56.PHONY: check
57.PHONY: test
58check test: busybox busybox.links
59 test -d $(objtree)/testsuite || cp -pPR $(srctree)/testsuite $(objtree)
60 bindir=$(objtree) srcdir=$(srctree)/testsuite \
61 $(SHELL) -c "cd $(objtree)/testsuite && $(srctree)/testsuite/runtest $(if $(KBUILD_VERBOSE:0=),-v)"
62
63.PHONY: release
64release: distclean
65 cd ..; \
66 rm -r -f busybox-$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION); \
67 cp -pPR busybox busybox-$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION) && { \
68 find busybox-$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)/ -type d \
69 -name .svn \
70 -print \
71 -exec rm -r -f {} \; ; \
72 find busybox-$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)/ -type d \
73 -name .git \
74 -print \
75 -exec rm -r -f {} \; ; \
76 find busybox-$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)/ -type f \
77 -name .gitignore \
78 -print \
79 -exec rm -f {} \; ; \
80 find busybox-$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)/ -type f \
81 -name .\#* \
82 -print \
83 -exec rm -f {} \; ; \
84 tar -czf busybox-$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION).tar.gz \
85 busybox-$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)/ ; }
86
87.PHONY: checkhelp
88checkhelp:
89 $(Q)$(srctree)/scripts/checkhelp.awk \
90 $(patsubst %,$(srctree)/%,$(wildcard $(patsubst %,%/Config.in,$(busybox-dirs) ./)))
91
92.PHONY: sizes
93sizes: busybox_unstripped
94 $(NM) --size-sort $(<)
95
96.PHONY: bloatcheck
97bloatcheck: busybox_old busybox_unstripped
98 @$(srctree)/scripts/bloat-o-meter busybox_old busybox_unstripped
99 @$(CROSS_COMPILE)size busybox_old busybox_unstripped
100
101.PHONY: baseline
102baseline: busybox_unstripped
103 @mv busybox_unstripped busybox_old
104
105.PHONY: objsizes
106objsizes: busybox_unstripped
107 $(srctree)/scripts/objsizes
108
109.PHONY: stksizes
110stksizes: busybox_unstripped
111 $(CROSS_COMPILE)objdump -d busybox_unstripped | $(srctree)/scripts/checkstack.pl $(ARCH) | uniq
112
113.PHONY: bigdata
114bigdata: busybox_unstripped
115 $(CROSS_COMPILE)nm --size-sort busybox_unstripped | grep -vi ' [trw] '
116
117# Documentation Targets
118.PHONY: doc
119doc: docs/busybox.pod docs/BusyBox.txt docs/busybox.1 docs/BusyBox.html
120
121# FIXME: Doesn't belong here
122 cmd_doc =
123 quiet_cmd_doc = $(Q)echo " DOC $(@F)"
124silent_cmd_doc =
125disp_doc = $($(quiet)cmd_doc)
126
127# sed adds newlines after "Options:" etc,
128# this is needed in order to get good BusyBox.{1,txt,html}
129docs/busybox.pod: $(srctree)/docs/busybox_header.pod \
130 include/usage.h \
131 $(srctree)/docs/busybox_footer.pod \
132 applets/usage_pod
133 $(disp_doc)
134 $(Q)-mkdir -p docs
135 $(Q)-( \
136 cat $(srctree)/docs/busybox_header.pod; \
137 echo; \
138 applets/usage_pod | sed 's/^[A-Za-z][A-Za-z ]*[a-z]:$$/&\n/'; \
139 cat $(srctree)/docs/busybox_footer.pod; \
140 ) > docs/busybox.pod
141
142docs/BusyBox.txt: docs/busybox.pod
143 $(disp_doc)
144 $(Q)-mkdir -p docs
145 $(Q)-pod2text $< > $@
146
147docs/busybox.1: docs/busybox.pod
148 $(disp_doc)
149 $(Q)-mkdir -p docs
150 $(Q)-pod2man --center=busybox --release="version $(KERNELVERSION)" $< > $@
151
152docs/BusyBox.html: docs/busybox.net/BusyBox.html
153 $(disp_doc)
154 $(Q)-mkdir -p docs
155 $(Q)-rm -f docs/BusyBox.html
156 $(Q)-cp docs/busybox.net/BusyBox.html docs/BusyBox.html
157
158docs/busybox.net/BusyBox.html: docs/busybox.pod
159 $(Q)-mkdir -p docs/busybox.net
160 $(Q)-pod2html --noindex $< > $@
161 $(Q)-rm -f pod2htm*
162
163# documentation, cross-reference
164# Modern distributions already ship synopsis packages (e.g. debian)
165# If you have an old distribution go to http://synopsis.fresco.org/
166syn_tgt = $(wildcard $(patsubst %,%/*.c,$(busybox-alldirs)))
167syn = $(patsubst %.c, %.syn, $(syn_tgt))
168
169comma:= ,
170brace_open:= (
171brace_close:= )
172
173SYN_CPPFLAGS := $(strip $(CPPFLAGS) $(EXTRA_CPPFLAGS))
174SYN_CPPFLAGS := $(subst $(brace_open),\$(brace_open),$(SYN_CPPFLAGS))
175SYN_CPPFLAGS := $(subst $(brace_close),\$(brace_close),$(SYN_CPPFLAGS))
176#SYN_CPPFLAGS := $(subst ",\",$(SYN_CPPFLAGS))
177#")
178#SYN_CPPFLAGS := [$(patsubst %,'%'$(comma),$(SYN_CPPFLAGS))'']
179
180%.syn: %.c
181 synopsis -p C -l Comments.SSDFilter,Comments.Previous -Wp,preprocess=True,cppflags="'$(SYN_CPPFLAGS)'" -o $@ $<
182
183.PHONY: html
184html: $(syn)
185 synopsis -f HTML -Wf,title="'BusyBox Documentation'" -o $@ $^
186
187-include $(srctree)/Makefile.local
188