blob: 0cc40a667926155cac235a11dae2e28a75b7960c [file] [log] [blame]
Denis Vlasenkoda8f43f2006-10-09 19:47:38 +00001# ==========================================================================
2# Build system
3# ==========================================================================
Denis Vlasenko7d219aa2006-10-05 10:17:08 +00004
5%.bflt: %_unstripped
6 $(CROSS_COMPILE)elf2flt $(ELF2FLTFLAGS) $< -o $@
7
Bernhard Reutner-Fischer193bcf32006-11-17 13:17:04 +00008busybox.links: $(srctree)/applets/busybox.mkll $(objtree)/include/autoconf.h $(srctree)/include/applets.h
Denis Vlasenko7d219aa2006-10-05 10:17:08 +00009 $(Q)-$(SHELL) $^ >$@
10
11.PHONY: install
Bernhard Reutner-Fischer8bfd2152006-11-17 13:54:29 +000012ifeq ($(CONFIG_INSTALL_APPLET_SYMLINKS),y)
13INSTALL_OPTS:= --symlinks
14endif
15ifeq ($(CONFIG_INSTALL_APPLET_HARDLINKS),y)
16INSTALL_OPTS:= --hardlinks
17endif
Denis Vlasenko7d219aa2006-10-05 10:17:08 +000018install: $(srctree)/applets/install.sh busybox busybox.links
19 $(Q)DO_INSTALL_LIBS="$(strip $(LIBBUSYBOX_SONAME) $(DO_INSTALL_LIBS))" \
20 $(SHELL) $< $(CONFIG_PREFIX) $(INSTALL_OPTS)
21ifeq ($(strip $(CONFIG_FEATURE_SUID)),y)
22 @echo
23 @echo
24 @echo --------------------------------------------------
25 @echo You will probably need to make your busybox binary
26 @echo setuid root to ensure all configured applets will
27 @echo work properly.
28 @echo --------------------------------------------------
29 @echo
30endif
31
32uninstall: busybox.links
33 rm -f $(CONFIG_PREFIX)/bin/busybox
34 for i in `cat busybox.links` ; do rm -f $(CONFIG_PREFIX)$$i; done
35ifneq ($(strip $(DO_INSTALL_LIBS)),n)
36 for i in $(LIBBUSYBOX_SONAME) $(DO_INSTALL_LIBS); do \
37 rm -f $(CONFIG_PREFIX)$$i; \
38 done
39endif
40
Bernhard Reutner-Fischeraae82e02007-01-27 22:04:58 +000041check test: busybox busybox.links
Denis Vlasenko7d219aa2006-10-05 10:17:08 +000042 bindir=$(objtree) srcdir=$(srctree)/testsuite SED="$(SED)" \
Bernhard Reutner-Fischeraae82e02007-01-27 22:04:58 +000043 $(SHELL) $(srctree)/testsuite/runtest $(if $(KBUILD_VERBOSE:0=),-v)
Denis Vlasenko7d219aa2006-10-05 10:17:08 +000044
Denis Vlasenko5fa71482006-12-12 22:31:15 +000045.PHONY: release
46release: distclean
47 cd ..; \
48 rm -r -f busybox-$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION); \
Denis Vlasenko5e2db5e2006-12-12 23:46:31 +000049 cp -a busybox busybox-$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION) && { \
Denis Vlasenko5fa71482006-12-12 22:31:15 +000050 find busybox-$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)/ -type d \
51 -name .svn \
52 -print \
Denis Vlasenko5e2db5e2006-12-12 23:46:31 +000053 -exec rm -r -f {} \; ; \
Denis Vlasenko5fa71482006-12-12 22:31:15 +000054 find busybox-$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)/ -type f \
55 -name .\#* \
56 -print \
Denis Vlasenko5e2db5e2006-12-12 23:46:31 +000057 -exec rm -f {} \; ; \
Denis Vlasenko5fa71482006-12-12 22:31:15 +000058 tar -czf busybox-$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION).tar.gz \
Denis Vlasenko5e2db5e2006-12-12 23:46:31 +000059 busybox-$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)/ ; }
Denis Vlasenko5fa71482006-12-12 22:31:15 +000060
Bernhard Reutner-Fischerd6bbf992006-11-22 09:39:48 +000061.PHONY: checkhelp
62checkhelp:
63 $(Q)$(srctree)/scripts/checkhelp.awk \
64 $(patsubst %,$(srctree)/%,$(wildcard $(patsubst %,%/Config.in,$(busybox-dirs) ./)))
Denis Vlasenko7d219aa2006-10-05 10:17:08 +000065
66.PHONY: sizes
67sizes: busybox_unstripped
68 $(NM) --size-sort $(<)
69
70.PHONY: bloatcheck
71bloatcheck: busybox_old busybox_unstripped
72 @$(srctree)/scripts/bloat-o-meter busybox_old busybox_unstripped
73
74.PHONY: baseline
75baseline: busybox_unstripped
76 @mv busybox_unstripped busybox_old
77
78.PHONY: objsizes
79objsizes: busybox_unstripped
Denis Vlasenko18684092006-10-05 17:11:08 +000080 $(srctree)/scripts/objsizes
Denis Vlasenko7d219aa2006-10-05 10:17:08 +000081
Denis Vlasenko00252642006-11-30 20:41:28 +000082.PHONY: bigdata
83bigdata: busybox_unstripped
84 nm --size-sort busybox_unstripped | grep -vi ' [tr] ' | tail -20
85
Denis Vlasenko7d219aa2006-10-05 10:17:08 +000086# Documentation Targets
87.PHONY: doc
88doc: docs/busybox.pod docs/BusyBox.txt docs/BusyBox.1 docs/BusyBox.html
89
90docs/busybox.pod: $(srctree)/docs/busybox_header.pod \
91 $(srctree)/include/usage.h \
92 $(srctree)/docs/busybox_footer.pod \
93 $(srctree)/docs/autodocifier.pl
94 $(disp_doc)
95 $(Q)-mkdir -p docs
96 $(Q)-( cat $(srctree)/docs/busybox_header.pod ; \
97 $(srctree)/docs/autodocifier.pl $(srctree)/include/usage.h ; \
98 cat $(srctree)/docs/busybox_footer.pod ; ) > docs/busybox.pod
99
100docs/BusyBox.txt: docs/busybox.pod
101 $(disp_doc)
102 $(Q)-mkdir -p docs
103 $(Q)-pod2text $< > $@
104
105docs/BusyBox.1: docs/busybox.pod
106 $(disp_doc)
107 $(Q)-mkdir -p docs
108 $(Q)-pod2man --center=BusyBox --release="version $(VERSION)" \
109 $< > $@
110
111docs/BusyBox.html: docs/busybox.net/BusyBox.html
112 $(disp_doc)
113 $(Q)-mkdir -p docs
114 $(Q)-rm -f docs/BusyBox.html
115 $(Q)-cp docs/busybox.net/BusyBox.html docs/BusyBox.html
116
117docs/busybox.net/BusyBox.html: docs/busybox.pod
118 $(Q)-mkdir -p docs/busybox.net
119 $(Q)-pod2html --noindex $< > \
120 docs/busybox.net/BusyBox.html
121 $(Q)-rm -f pod2htm*
122
123# documentation, cross-reference
124# Modern distributions already ship synopsis packages (e.g. debian)
125# If you have an old distribution go to http://synopsis.fresco.org/
Bernhard Reutner-Fischerbc95f572006-12-06 15:29:00 +0000126syn_tgt = $(wildcard $(patsubst %,%/*.c,$(busybox-alldirs)))
127syn = $(patsubst %.c, %.syn, $(syn_tgt))
Denis Vlasenko7d219aa2006-10-05 10:17:08 +0000128
Bernhard Reutner-Fischerfeea1b92006-12-06 21:51:59 +0000129comma:= ,
130brace_open:= (
131brace_close:= )
132
133SYN_CPPFLAGS := $(strip $(CPPFLAGS) $(EXTRA_CPPFLAGS))
134SYN_CPPFLAGS := $(subst $(brace_open),\$(brace_open),$(SYN_CPPFLAGS))
135SYN_CPPFLAGS := $(subst $(brace_close),\$(brace_close),$(SYN_CPPFLAGS))
136#SYN_CPPFLAGS := $(subst ",\",$(SYN_CPPFLAGS))
137#")
138#SYN_CPPFLAGS := [$(patsubst %,'%'$(comma),$(SYN_CPPFLAGS))'']
139
Denis Vlasenko7d219aa2006-10-05 10:17:08 +0000140%.syn: %.c
Bernhard Reutner-Fischerfeea1b92006-12-06 21:51:59 +0000141 synopsis -p C -l Comments.SSDFilter,Comments.Previous -Wp,preprocess=True,cppflags="'$(SYN_CPPFLAGS)'" -o $@ $<
Denis Vlasenko7d219aa2006-10-05 10:17:08 +0000142
143.PHONY: html
144html: $(syn)
145 synopsis -f HTML -Wf,title="'BusyBox Documentation'" -o $@ $^