Makefile.custom 6.1 KB

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