3
0

Makefile.custom 6.2 KB

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