blob: 5562ba39689ef456394078cc2e7d00991fb60cfc [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
Bernhard Reutner-Fischeraae82e02007-01-27 22:04:58 +000049check test: busybox busybox.links
Denis Vlasenko7d219aa2006-10-05 10:17:08 +000050 bindir=$(objtree) srcdir=$(srctree)/testsuite SED="$(SED)" \
Bernhard Reutner-Fischeraae82e02007-01-27 22:04:58 +000051 $(SHELL) $(srctree)/testsuite/runtest $(if $(KBUILD_VERBOSE:0=),-v)
Denis Vlasenko7d219aa2006-10-05 10:17:08 +000052
Denis Vlasenko5fa71482006-12-12 22:31:15 +000053.PHONY: release
54release: distclean
55 cd ..; \
56 rm -r -f busybox-$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION); \
Denis Vlasenko5e2db5e2006-12-12 23:46:31 +000057 cp -a busybox busybox-$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION) && { \
Denis Vlasenko5fa71482006-12-12 22:31:15 +000058 find busybox-$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)/ -type d \
59 -name .svn \
60 -print \
Denis Vlasenko5e2db5e2006-12-12 23:46:31 +000061 -exec rm -r -f {} \; ; \
Denis Vlasenko5fa71482006-12-12 22:31:15 +000062 find busybox-$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)/ -type f \
63 -name .\#* \
64 -print \
Denis Vlasenko5e2db5e2006-12-12 23:46:31 +000065 -exec rm -f {} \; ; \
Denis Vlasenko5fa71482006-12-12 22:31:15 +000066 tar -czf busybox-$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION).tar.gz \
Denis Vlasenko5e2db5e2006-12-12 23:46:31 +000067 busybox-$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)/ ; }
Denis Vlasenko5fa71482006-12-12 22:31:15 +000068
Bernhard Reutner-Fischerd6bbf992006-11-22 09:39:48 +000069.PHONY: checkhelp
70checkhelp:
71 $(Q)$(srctree)/scripts/checkhelp.awk \
72 $(patsubst %,$(srctree)/%,$(wildcard $(patsubst %,%/Config.in,$(busybox-dirs) ./)))
Denis Vlasenko7d219aa2006-10-05 10:17:08 +000073
74.PHONY: sizes
75sizes: busybox_unstripped
76 $(NM) --size-sort $(<)
77
78.PHONY: bloatcheck
79bloatcheck: busybox_old busybox_unstripped
80 @$(srctree)/scripts/bloat-o-meter busybox_old busybox_unstripped
Denis Vlasenko931de892007-06-21 12:43:45 +000081 @$(CROSS_COMPILE)size busybox_old busybox_unstripped
Denis Vlasenko7d219aa2006-10-05 10:17:08 +000082
83.PHONY: baseline
84baseline: busybox_unstripped
85 @mv busybox_unstripped busybox_old
86
87.PHONY: objsizes
88objsizes: busybox_unstripped
Denis Vlasenko18684092006-10-05 17:11:08 +000089 $(srctree)/scripts/objsizes
Denis Vlasenko7d219aa2006-10-05 10:17:08 +000090
Denis Vlasenkod4fea902007-06-10 00:54:27 +000091.PHONY: stksizes
92stksizes: busybox_unstripped
93 $(CROSS_COMPILE)objdump -d busybox_unstripped | $(srctree)/scripts/checkstack.pl $(ARCH)
94
Denis Vlasenko00252642006-11-30 20:41:28 +000095.PHONY: bigdata
96bigdata: busybox_unstripped
Denis Vlasenkod4fea902007-06-10 00:54:27 +000097 $(CROSS_COMPILE)nm --size-sort busybox_unstripped | grep -vi ' [tr] '
Denis Vlasenko00252642006-11-30 20:41:28 +000098
Denis Vlasenko7d219aa2006-10-05 10:17:08 +000099# Documentation Targets
100.PHONY: doc
101doc: docs/busybox.pod docs/BusyBox.txt docs/BusyBox.1 docs/BusyBox.html
102
103docs/busybox.pod: $(srctree)/docs/busybox_header.pod \
104 $(srctree)/include/usage.h \
105 $(srctree)/docs/busybox_footer.pod \
106 $(srctree)/docs/autodocifier.pl
107 $(disp_doc)
108 $(Q)-mkdir -p docs
109 $(Q)-( cat $(srctree)/docs/busybox_header.pod ; \
110 $(srctree)/docs/autodocifier.pl $(srctree)/include/usage.h ; \
111 cat $(srctree)/docs/busybox_footer.pod ; ) > docs/busybox.pod
112
113docs/BusyBox.txt: docs/busybox.pod
114 $(disp_doc)
115 $(Q)-mkdir -p docs
116 $(Q)-pod2text $< > $@
117
118docs/BusyBox.1: docs/busybox.pod
119 $(disp_doc)
120 $(Q)-mkdir -p docs
121 $(Q)-pod2man --center=BusyBox --release="version $(VERSION)" \
122 $< > $@
123
124docs/BusyBox.html: docs/busybox.net/BusyBox.html
125 $(disp_doc)
126 $(Q)-mkdir -p docs
127 $(Q)-rm -f docs/BusyBox.html
128 $(Q)-cp docs/busybox.net/BusyBox.html docs/BusyBox.html
129
130docs/busybox.net/BusyBox.html: docs/busybox.pod
131 $(Q)-mkdir -p docs/busybox.net
132 $(Q)-pod2html --noindex $< > \
133 docs/busybox.net/BusyBox.html
134 $(Q)-rm -f pod2htm*
135
136# documentation, cross-reference
137# Modern distributions already ship synopsis packages (e.g. debian)
138# If you have an old distribution go to http://synopsis.fresco.org/
Bernhard Reutner-Fischerbc95f572006-12-06 15:29:00 +0000139syn_tgt = $(wildcard $(patsubst %,%/*.c,$(busybox-alldirs)))
140syn = $(patsubst %.c, %.syn, $(syn_tgt))
Denis Vlasenko7d219aa2006-10-05 10:17:08 +0000141
Bernhard Reutner-Fischerfeea1b92006-12-06 21:51:59 +0000142comma:= ,
143brace_open:= (
144brace_close:= )
145
146SYN_CPPFLAGS := $(strip $(CPPFLAGS) $(EXTRA_CPPFLAGS))
147SYN_CPPFLAGS := $(subst $(brace_open),\$(brace_open),$(SYN_CPPFLAGS))
148SYN_CPPFLAGS := $(subst $(brace_close),\$(brace_close),$(SYN_CPPFLAGS))
149#SYN_CPPFLAGS := $(subst ",\",$(SYN_CPPFLAGS))
150#")
151#SYN_CPPFLAGS := [$(patsubst %,'%'$(comma),$(SYN_CPPFLAGS))'']
152
Denis Vlasenko7d219aa2006-10-05 10:17:08 +0000153%.syn: %.c
Bernhard Reutner-Fischerfeea1b92006-12-06 21:51:59 +0000154 synopsis -p C -l Comments.SSDFilter,Comments.Previous -Wp,preprocess=True,cppflags="'$(SYN_CPPFLAGS)'" -o $@ $<
Denis Vlasenko7d219aa2006-10-05 10:17:08 +0000155
156.PHONY: html
157html: $(syn)
158 synopsis -f HTML -Wf,title="'BusyBox Documentation'" -o $@ $^
Mike Frysinger3c82e482007-05-02 22:07:03 +0000159
160-include $(srctree)/Makefile.local