Bump to version 1.22.1
[platform/upstream/busybox.git] / Makefile.custom
1 # ==========================================================================
2 # Build system
3 # ==========================================================================
4
5 busybox.links: $(srctree)/applets/busybox.mkll $(objtree)/include/autoconf.h include/applets.h
6         $(Q)-$(SHELL) $^ > $@
7
8 busybox.cfg.suid: $(srctree)/applets/busybox.mksuid $(objtree)/include/autoconf.h include/applets.h
9         $(Q)-SUID="yes" $(SHELL) $^ > $@
10 busybox.cfg.nosuid: $(srctree)/applets/busybox.mksuid $(objtree)/include/autoconf.h include/applets.h
11         $(Q)-SUID="DROP" $(SHELL) $^ > $@
12
13 .PHONY: install
14 ifeq ($(CONFIG_INSTALL_APPLET_SYMLINKS),y)
15 INSTALL_OPTS:= --symlinks
16 endif
17 ifeq ($(CONFIG_INSTALL_APPLET_HARDLINKS),y)
18 INSTALL_OPTS:= --hardlinks
19 endif
20 ifeq ($(CONFIG_INSTALL_APPLET_SCRIPT_WRAPPERS),y)
21 ifeq ($(CONFIG_INSTALL_SH_APPLET_SYMLINK),y)
22 INSTALL_OPTS:= --sw-sh-sym
23 endif
24 ifeq ($(CONFIG_INSTALL_SH_APPLET_HARDLINK),y)
25 INSTALL_OPTS:= --sw-sh-hard
26 endif
27 ifeq ($(CONFIG_INSTALL_SH_APPLET_SCRIPT_WRAPPER),y)
28 INSTALL_OPTS:= --scriptwrapper
29 endif
30 endif
31 install: $(srctree)/applets/install.sh busybox busybox.links
32         $(Q)DO_INSTALL_LIBS="$(strip $(LIBBUSYBOX_SONAME) $(DO_INSTALL_LIBS))" \
33                 $(SHELL) $< $(CONFIG_PREFIX) $(INSTALL_OPTS)
34 ifeq ($(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
43 endif
44
45 uninstall: busybox.links
46         rm -f $(CONFIG_PREFIX)/bin/busybox
47         for i in `cat busybox.links` ; do rm -f $(CONFIG_PREFIX)$$i; done
48 ifneq ($(strip $(DO_INSTALL_LIBS)),n)
49         for i in $(LIBBUSYBOX_SONAME) $(DO_INSTALL_LIBS); do \
50                 rm -f $(CONFIG_PREFIX)$$i; \
51         done
52 endif
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
58 check 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
64 release: 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
88 checkhelp:
89         $(Q)$(srctree)/scripts/checkhelp.awk \
90                 $(patsubst %,$(srctree)/%,$(wildcard $(patsubst %,%/Config.in,$(busybox-dirs) ./)))
91
92 .PHONY: sizes
93 sizes: busybox_unstripped
94         $(NM) --size-sort $(<)
95
96 .PHONY: bloatcheck
97 bloatcheck: 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
102 baseline: busybox_unstripped
103         @mv busybox_unstripped busybox_old
104
105 .PHONY: objsizes
106 objsizes: busybox_unstripped
107         $(srctree)/scripts/objsizes
108
109 .PHONY: stksizes
110 stksizes: busybox_unstripped
111         $(CROSS_COMPILE)objdump -d busybox_unstripped | $(srctree)/scripts/checkstack.pl $(ARCH) | uniq
112
113 .PHONY: bigdata
114 bigdata: busybox_unstripped
115         $(CROSS_COMPILE)nm --size-sort busybox_unstripped | grep -vi ' [trw] '
116
117 # Documentation Targets
118 .PHONY: doc
119 doc: 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)"
124 silent_cmd_doc =
125 disp_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}
129 docs/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
142 docs/BusyBox.txt: docs/busybox.pod
143         $(disp_doc)
144         $(Q)-mkdir -p docs
145         $(Q)-pod2text $< > $@
146
147 docs/busybox.1: docs/busybox.pod
148         $(disp_doc)
149         $(Q)-mkdir -p docs
150         $(Q)-pod2man --center=busybox --release="version $(KERNELVERSION)" $< > $@
151
152 docs/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
158 docs/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/
166 syn_tgt = $(wildcard $(patsubst %,%/*.c,$(busybox-alldirs)))
167 syn     = $(patsubst %.c, %.syn, $(syn_tgt))
168
169 comma:= ,
170 brace_open:= (
171 brace_close:= )
172
173 SYN_CPPFLAGS := $(strip $(CPPFLAGS) $(EXTRA_CPPFLAGS))
174 SYN_CPPFLAGS := $(subst $(brace_open),\$(brace_open),$(SYN_CPPFLAGS))
175 SYN_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
184 html: $(syn)
185         synopsis -f HTML -Wf,title="'BusyBox Documentation'" -o $@ $^
186
187 -include $(srctree)/Makefile.local