msh: aliased to hush
[platform/upstream/busybox.git] / Makefile.custom
1 # ==========================================================================
2 # Build system
3 # ==========================================================================
4
5 busybox.links: $(srctree)/applets/busybox.mkll $(objtree)/include/autoconf.h $(srctree)/include/applets.h
6         $(Q)-$(SHELL) $^ >$@
7
8 .PHONY: install
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
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
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
49 # Not very elegant: copies testsuite to objdir...
50 # (cp -pPR is POSIX-compliant (cp -dpR or cp -a would not be))
51 .PHONY: check
52 .PHONY: test
53 check test: busybox busybox.links
54         test -d $(objtree)/testsuite || cp -pPR $(srctree)/testsuite $(objtree)
55         bindir=$(objtree) srcdir=$(srctree)/testsuite \
56         $(SHELL) -c "cd $(objtree)/testsuite && $(srctree)/testsuite/runtest $(if $(KBUILD_VERBOSE:0=),-v)"
57
58 .PHONY: release
59 release: distclean
60         cd ..; \
61         rm -r -f busybox-$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION); \
62         cp -pPR busybox busybox-$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION) && { \
63         find busybox-$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)/ -type d \
64                 -name .svn \
65                 -print \
66                 -exec rm -r -f {} \; ; \
67         find busybox-$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)/ -type f \
68                 -name .\#* \
69                 -print \
70                 -exec rm -f {} \; ; \
71         tar -czf busybox-$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION).tar.gz \
72                 busybox-$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)/ ; }
73
74 .PHONY: checkhelp
75 checkhelp:
76         $(Q)$(srctree)/scripts/checkhelp.awk \
77                 $(patsubst %,$(srctree)/%,$(wildcard $(patsubst %,%/Config.in,$(busybox-dirs) ./)))
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
86         @$(CROSS_COMPILE)size busybox_old busybox_unstripped
87
88 .PHONY: baseline
89 baseline: busybox_unstripped
90         @mv busybox_unstripped busybox_old
91
92 .PHONY: objsizes
93 objsizes: busybox_unstripped
94         $(srctree)/scripts/objsizes
95
96 .PHONY: stksizes
97 stksizes: busybox_unstripped
98         $(CROSS_COMPILE)objdump -d busybox_unstripped | $(srctree)/scripts/checkstack.pl $(ARCH) | uniq
99
100 .PHONY: bigdata
101 bigdata: busybox_unstripped
102         $(CROSS_COMPILE)nm --size-sort busybox_unstripped | grep -vi ' [trw] '
103
104 # Documentation Targets
105 .PHONY: doc
106 doc: docs/busybox.pod docs/BusyBox.txt docs/BusyBox.1 docs/BusyBox.html
107
108 # FIXME: Doesn't belong here
109        cmd_doc =
110  quiet_cmd_doc = $(Q)echo "  DOC     $(@F)"
111 silent_cmd_doc =
112 disp_doc       = $($(quiet)cmd_doc)
113
114 docs/busybox.pod: $(srctree)/docs/busybox_header.pod \
115                 $(srctree)/include/usage.h \
116                 $(srctree)/docs/busybox_footer.pod \
117                 $(srctree)/docs/autodocifier.pl
118         $(disp_doc)
119         $(Q)-mkdir -p docs
120         $(Q)-( cat $(srctree)/docs/busybox_header.pod ; \
121             $(srctree)/docs/autodocifier.pl $(srctree)/include/usage.h ; \
122             cat $(srctree)/docs/busybox_footer.pod ; ) > docs/busybox.pod
123
124 docs/BusyBox.txt: docs/busybox.pod
125         $(disp_doc)
126         $(Q)-mkdir -p docs
127         $(Q)-pod2text $< > $@
128
129 docs/BusyBox.1: docs/busybox.pod
130         $(disp_doc)
131         $(Q)-mkdir -p docs
132         $(Q)-pod2man --center=BusyBox --release="version $(VERSION)" \
133                 $< > $@
134
135 docs/BusyBox.html: docs/busybox.net/BusyBox.html
136         $(disp_doc)
137         $(Q)-mkdir -p docs
138         $(Q)-rm -f docs/BusyBox.html
139         $(Q)-cp docs/busybox.net/BusyBox.html docs/BusyBox.html
140
141 docs/busybox.net/BusyBox.html: docs/busybox.pod
142         $(Q)-mkdir -p docs/busybox.net
143         $(Q)-pod2html --noindex $< > \
144             docs/busybox.net/BusyBox.html
145         $(Q)-rm -f pod2htm*
146
147 # documentation, cross-reference
148 # Modern distributions already ship synopsis packages (e.g. debian)
149 # If you have an old distribution go to http://synopsis.fresco.org/
150 syn_tgt = $(wildcard $(patsubst %,%/*.c,$(busybox-alldirs)))
151 syn     = $(patsubst %.c, %.syn, $(syn_tgt))
152
153 comma:= ,
154 brace_open:= (
155 brace_close:= )
156
157 SYN_CPPFLAGS := $(strip $(CPPFLAGS) $(EXTRA_CPPFLAGS))
158 SYN_CPPFLAGS := $(subst $(brace_open),\$(brace_open),$(SYN_CPPFLAGS))
159 SYN_CPPFLAGS := $(subst $(brace_close),\$(brace_close),$(SYN_CPPFLAGS))
160 #SYN_CPPFLAGS := $(subst ",\",$(SYN_CPPFLAGS))
161 #")
162 #SYN_CPPFLAGS := [$(patsubst %,'%'$(comma),$(SYN_CPPFLAGS))'']
163
164 %.syn: %.c
165         synopsis -p C -l Comments.SSDFilter,Comments.Previous -Wp,preprocess=True,cppflags="'$(SYN_CPPFLAGS)'" -o $@ $<
166
167 .PHONY: html
168 html: $(syn)
169         synopsis -f HTML -Wf,title="'BusyBox Documentation'" -o $@ $^
170
171 -include $(srctree)/Makefile.local